Token with different interpretations (i.e. keyword and identifier)

前端 未结 1 1801
春和景丽
春和景丽 2021-01-24 15:10

I am writing a grammar with a lot of case-insensitive keywords in ANTLR4. I collected some example files for the format, that I try to test parse and some use the same tokens wh

1条回答
  •  鱼传尺愫
    2021-01-24 15:30

    You can simply list the keywords that are allowed as identifiers as alternatives in the id rule:

    id: IDSTRING | CORE | ... ;
    

    0 讨论(0)
提交回复
热议问题