ANTLR What is simpliest way to realize python like indent-depending grammar?

后端 未结 4 1002
自闭症患者
自闭症患者 2020-12-01 06:24

I am trying realize python like indent-depending grammar.

Source example:

ABC QWE
  CDE EFG
  EFG CDE
    ABC 
  QWE ZXC

As i see,

4条回答
  •  遥遥无期
    2020-12-01 07:29

    There is an open-source library antlr-denter for ANTLR v4 that helps parse indents and dedents for you. Check out its README for how to use it.

    Since it is a library, rather than code snippets to copy-and-paste into your grammar, its indentation-handling can be updated separately from the rest of your grammar.

提交回复
热议问题