English 中文(简体)
3. 与荷兰皇家骑士团的调子
原标题:Match lowercase with ANTLR

我使用国家航天中心的工作方式简单:

grammar boolean;

// [...]
lowercase_string
        :   ( a .. z )+ ;

但是,<代码>下调—string 页: 1 根据口译(MismatdatedSetException(10!={})。 想法?

最佳回答

您可使用<代码>。 为与<代码> a 至z 匹配,为之制定更灵活的规则(从资本开始的更灵活规则)。

Try it like this:

lowercase_string
  :  Lower+ 
  ;

Lower
  :   a .. z 
  ;

lowercase_string
  :  Lower
  ;

Lower
  :   a .. z +
  ;

另见前次Q&A:。 《新航程》中“主食”规则和弹性规则之间的实际区别?

问题回答

暂无回答




相关问题
ANTLR parser hanging at proxy.handshake call

I am attempting to get a basic ECMAScript parser working, and found a complete ANTLR grammar for ECMAScript 3, which appears to compile ok and produces the appropriate Lexer/Parser/Walker Java files. (...

Will ANTLR Help? Different Suggestion?

Before I dive into ANTLR (because it is apparently not for the faint of heart), I just want to make sure I have made the right decision regarding its usage. I want to create a grammar that will parse ...

How to use ANTLR to parse xml document

can anybody tell how to use ANTLR tool(in java) to create our own grammar for xml documents and how to parse those documents using ANTLR tool(in java)?

JavaCC Problem - Generated code doesn t find all parse errors

Just started with JavaCC. But I have a strange behaviour with it. I want to verify input int the form of tokens (letters and numbers) wich are concatenated with signs (+, -, /) and wich can contain ...

How to generate introductory recognizer using ANTLR3C?

The Definitive ANTLR Guide starts with a simple recognizer. Using grammar verbatim to target C-runtime fails because %s means something to ANTLR: $ cat T.g grammar T; options { language = ...

What s the matter with this Grammar?

grammar Test; IDHEAD: ( a .. z | A .. Z | _ ); IDTAIL: (IDHEAD | 0 .. 9 ); ID: (IDHEAD IDTAIL*); fragment TYPE: ( text | number | bool ); define: define ID as TYPE; The problem ...

热门标签