python like grammar antlr with semicolons -


i trying write grammar python-like language in antlr, language looks this:

if condition:     if condition:     pass;         if condtion:             pass;         if condtion:             pass; pass; if condtion:     pass; 

my problem can't find blocks spaces. want know if there way implement without writing code in grammar?

if remember correctly, did create stack of white space in lexer of course requires actions in lexer.

another way handle create character stream processor sends unicode 16 characters not 8 bit lexer. then, use special bit patterns indicate character nesting depth. lexer can send indent , dedent tokens parser.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -