Skip to content

[Bug] Including %type and %standalone produces uncompileable code [sf#93] #95

@lsf37

Description

@lsf37

Reported by mcspanky on 2008-06-21 04:15 UTC
If you include both a %type and a %standalone, the resulting scanner has the specified return type, yet at EOF returns the int YYEOF. javac rightly complains about that and refuses to compile the file.

Here's the file I used; it could be stripped down more:

package foo;

%%

%public
%class Scanner
%standalone

%function nextToken
%type Foo

%line
%column

/* main character classes */
LineTerminator = \r|\n|\r\n

WhiteSpace = [ \t\f]

/* identifiers /
Identifier = [:jletter:][:jletterdigit:]

%%

<YYINITIAL> {

/* keywords */
"double" { System.out.println(yytext()); }
"int" { System.out.println(yytext()); }

/* end of line */
{LineTerminator} { System.out.println("LINE TERMINATOR"); }

/* whitespace /
{WhiteSpace} { /
ignore */ }

/* identifiers */
{Identifier} { System.out.println("identifier: "+ yytext()); }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions