[antlr-interest] Problems parsing a file
Dmitri Pissarenko
dmitri.pissarenko at gmail.com
Sun Oct 24 09:56:55 PDT 2010
Hello!
I have a file, which I want to parse (TaskJuggler III bookings file) and a
grammar for it.
When trying to parse it, I get following errors:
line 1:42 mismatched character '-' expecting set '0'..'9'
line 1:48 mismatched character ':' expecting set '0'..'9'
line 1:52 mismatched character '+' expecting set '0'..'9'
line 1:59 mismatched character ' ' expecting set '0'..'9'
at line
> project prj "Sample project" "1.0" 2010-10-24-00:00-+0200 -
2010-11-23-09:00-+0100 {
Here are parts of the grammar, which are relevant for this line:
GRAMMAR (START)
bookingsFile returns [DefaultBookingsFile bookingsFile]
:
{
bookingsFile = new DefaultBookingsFile();
}
projectHeader
projectIds
(resourceDeclaration)*
(task)*
(
suppStmt=supplementStatement
{bookingsFile.addSupplementStatement( $suppStmt.suppStmt ); }
)*
;
projectHeader
:
'project prj "' ANY_TEXT '" "1.0"' TJ3_BOOKING_TIME '-'
TJ3_BOOKING_TIME '{'
'}'
;
TJ3_BOOKING_TIME
: DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT
DIGIT ':' DIGIT DIGIT '-' TIMEZONE
;
TIMEZONE
: ('+'|'-')DIGIT DIGIT DIGIT DIGIT
;
GRAMMAR (END)
What's wrong with this grammar?
Thanks in advance
Dmitri
P. S.: Full code of the parser can be found at
http://bazaar.launchpad.net/~dp-sw-dev/pcc/prototype1/files/head%3A/src/main/java/at/silverstrike/pcc/impl/tj3bookingsparser/grammar/
Files:
1) Bookings.g
2) BookingsParser.java
More information about the antlr-interest
mailing list