[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2041) .drl file ending in a single line comment w/o EOL not accepted

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Sun Mar 29 05:03:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12459501#action_12459501 ] 

Wolfgang Laun commented on JBRULES-2041:
----------------------------------------

The rewrite of the lexer rules givenbelow works. The srange thing is that
omitting the quaint '#'-aternative from ('#' | ~('\r'|'\n'))* results in comment
lines such as
   #### this one
   #  ## or this one
within the RHS to fail. I did not try to track this down. (Does DFA.predict() fail?) 

SH_STYLE_SINGLE_LINE_COMMENT	
	:	'#' ('#' | ~('\r'|'\n'))* // (('\r')? '\n')? 
	     { String app = "";
	       if( input.LA(1) == '\r' ) input.consume();
	       if( input.LA(1) == '\n' ){ input.consume(); } else{ app = System.getProperty( "line.separator" ); }
           $channel=HIDDEN; setText( "//" + getText().substring(1) + app );}
	;
        
C_STYLE_SINGLE_LINE_COMMENT	
	:	'//' ~('\r'|'\n')* // (('\r')? '\n')? 
	     { String app = "";
	       if( input.LA(1) == '\r' ) input.consume();
	       if( input.LA(1) == '\n' ){ input.consume(); } else{ app = System.getProperty( "line.separator" ); }
           $channel=HIDDEN; setText( getText() + app );
	;

> .drl file ending in a single line comment w/o EOL not accepted
> --------------------------------------------------------------
>
>                 Key: JBRULES-2041
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2041
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler (expert)
>    Affects Versions: 5.0.0.CR1
>            Reporter: Wolfgang Laun
>            Assignee: Mark Proctor
>             Fix For: 5.0.0.GA
>
>
> If the last line on some .drl file is a single line comment without EOL the compiler reports an error:
> Error message:
> [103,7]: [ERR 101] Line 103:7 no viable alternative at input ''
> I guess the DRL.g will have to provide the alternative (EOL|EOF) in both STYLE_SINGLE_LINE_COMMENT rules.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list