java - EBNF to JavaCC lexer -


how convert ::= [a-za-z] javacc?

what have done:

token : {   < letter : (["a"-"z"])> } 

but don't know how smaller letter parts

like this:

token : {   < letter : (["a"-"z", "a"-"z"])> } 

reference:

a character list describes set of characters. legal match character list character in set. character list list of character descriptors separated commas within square brackets. each character descriptor describes single character or range of characters (see character descriptor below), , added set of characters of character list. if character list prefixed "~" symbol, set of characters represents unicode character not in specified set.

note rule:

token : {   < letter : (["a"-"z", "a"-"z"])> } 

is equivalent to:

token : {   < letter : ["a"-"z", "a"-"z"]> } 

which both match single letter. if want repeat class, need parentheses , append + quantifier:

token : {   < letters : (["a"-"z", "a"-"z"])+ > } 

Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -