History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ANTLR-95
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Terence Parr
Reporter: Terence Parr
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ANTLR v3

~T in lexer uses T as token not set of char in rule T

Created: 14/Mar/07 11:17 AM   Updated: 14/Mar/07 01:24 PM
Component/s: ANTLR Core
Affects Version/s: 3.0b6
Fix Version/s: 3.0b7


 Description  « Hide
Jim Idle reports:

lexer grammar jim;
 
fragment EOLTOK
: ( '\n' | '\r' )
                ;
               
ALINE : ((~EOLTOK))+ ;
 
ANOTHER : ( (~('\n' | '\r')) + );
 
You will see that ALINE calculates the set using the token number assigned to EOLTOK, and so the set is:
 
{'\u0000'..'\u0003', '\u0005'..'\uFFFE'}
 
Whereas ANOTHER calculates the correct set as it uses the literals it finds and negates that.
 


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Terence Parr - 14/Mar/07 01:24 PM
Added unit tests to TestCharDFA. Had to fix ~T to go convert T to a set even if T refs U, another lexer rule.