[antlr-interest] Optional tokens
hammett
hammett at uol.com.br
Sun May 22 20:12:47 PDT 2005
Howdy!
I'm struggling with my grammar where I need to express that SEMI or NEWLINE
is required to signal the end of my statements while should be totally
ignored elsewhere.
So, a possible AST could be
NEWLINE
TypeDefinition
NEWLINE
MethodDefintion
NEWLINE
Statements either SEMI or NEWLINE must be used to end each statement
But NEWLINEs on the code should be ignored
Being concrete
-- --
# a comment (Token.SKIP)
class MyClass
def self.initialize
x, y = 1, 2
puts x, y
end
end
-- --
Any help would be great!
--
Cheers,
hammett
http://www.castleproject.org/~hammett
More information about the antlr-interest
mailing list