字句解析:lengthOfMatch

PARSER_BEGIN(Test)

public class Test {
  public static void main(String args[]) throws ParseException {
    Test parser = new Test(System.in);
    parser.Input();
  }
}

PARSER_END(Test)

SKIP :
{
    <SPACE:  " " | "\t" | "\n" | "\r">
}

TOKEN :
{
    <A: "a"> { System.out.print("lengthOfMatch: ");
               System.out.println(lengthOfMatch); }
}

MORE :
{
    <B: "bb"> { System.out.print("lengthOfMatch: ");
                System.out.println(lengthOfMatch);
                System.out.println("+");
                image.insert(0, "/"); image.append("/"); } : E
}

<E> TOKEN :
{
    <C: "cccc"> { System.out.print("lengthOfMatch: ");
                  System.out.println(lengthOfMatch);
                  System.out.println("+" + image + "+"); } : DEFAULT
}

void Input() :
{ Token t; }
{
    ((t = <A> | t = <C> )
        { System.out.println("*" + t.image + "*"); })+ <EOF>
}

で、

abbcccc
lengthOfMatch: 0
*a*
lengthOfMatch: 2
+
lengthOfMatch: 4
+/bb/cccc+
*bbcccc*