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

Key: ANTLR-105
Type: Bug Bug
Status: Closed Closed
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

Extra backslash generated for literals in lexer

Created: 12/Apr/07 12:02 PM   Updated: 27/Dec/07 01:49 PM
Component/s: None
Affects Version/s: 3.0b6
Fix Version/s: 3.1


 Description  « Hide
Weird

SIMPLE_ESCAPE_SEQUENCE
        : '\"'
        ;

generates:

match('\"');

but

SIMPLE_ESCAPE_SEQUENCE
        : '\\\"'
        ;

gens

match("\\\\"");


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Terence Parr - 28/Jun/07 12:27 PM
Johannes Luber says he has reproduced with the following:

grammar BackslashBugTest;

data: CHARACTER*;

CHARACTER
: SINGLE_CHARACTER
| SIMPLE_ESCAPE_SEQUENCE
;

fragment SINGLE_CHARACTER
: ~('\'' | '\\' | NEW_LINE_CHARACTER )
;

fragment SIMPLE_ESCAPE_SEQUENCE
: '\\\''
| '\\\"'
| '\\\\'
| '\\0'
| '\\a'
| '\\b'
| '\\f'
| '\\n'
| '\\r'
| '\\t'
| '\\v'
;

NEW_LINE_CHARACTER
: '\u000D' // Carriage return character
| '\u000A' // Line feed character
| '\u0085' // Next line character
| '\u2028' // Line separator character
| '\u2029' // Paragraph separator character

Terence Parr - 27/Dec/07 01:49 PM
Target.getTargetStringLiteralFromANTLRStringLiteral() escape " that were already escaped.