Wiki

Ticket #373 (new defect)

Opened 3 years ago

block comments extends to last commented line

Reported by: ptokremin Owned by:
Priority: major Milestone:
Component: Cobra Compiler Version: 0.9.6
Keywords: comments Cc:

Description

The entire line following the closing tag for a block comment #/ is deactivated as well.

Compilation of...

class DebugCase 
	def main is shared
/#		i as int
		for i in -13:57:7
			print i
		i as int
#/		i=-13
		while i<57
			print i
			i += 7

...fails with

# cobra.bat -version
Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1
# -c CobraDebug01.cobra
CobraDebug01.cobra(10): error: Cannot find "i". There are members with similar names including ".cue.init", ".finalize", ".main", ".memberwiseClone" and ".toString".
CobraDebug01.cobra(11): error: For "print" arg 1: Cannot find "i". There are members with similar names including ".cue.init", ".finalize", ".main", ".memberwiseClone" and ".toString".
CobraDebug01.cobra(12): error: Cannot find "i". There are members with similar names including ".cue.init", ".finalize", ".main", ".memberwiseClone" and ".toString".			

You can create all sorts of compiler- or runtime errors this way.
For instance the following...

class DebugCase 
	def main is shared
		i = -27
/#		i as int
		for i in -13:57:7
			print i
		i as int
#/		i=-13
		while i<57
			print i
			i += 7

... produces the output

-27
-20
-13
-6
1
8
15
22
29
36
43
50

It is possible to work around this by putting the closing tag at the end of the last line to comment OR insert a line break after it.

Note: See TracTickets for help on using tickets.