ANTLR What is simpliest way to realize python like indent-depending grammar?
问题 I am trying realize python like indent-depending grammar. Source example: ABC QWE CDE EFG EFG CDE ABC QWE ZXC As i see, what i need is to realize two tokens INDENT and DEDENT, so i could write something like: grammar mygrammar; text: (ID | block)+; block: INDENT (ID|block)+ DEDENT; INDENT: ????; DEDENT: ????; Is there any simple way to realize this using ANTLR? (I'd prefer, if it's possible, to use standard ANTLR lexer.) 回答1: I don't know what the easiest way to handle it is, but the