Codebase list jlex / c3ed8164-0882-410c-a0c5-41245160ec25/main bug7.txt
c3ed8164-0882-410c-a0c5-41245160ec25/main

Tree @c3ed8164-0882-410c-a0c5-41245160ec25/main (Download .tar.gz)

bug7.txt @c3ed8164-0882-410c-a0c5-41245160ec25/mainraw · history · blame

The following JavaLex input file is in error;
an undefined macro is referenced in the rules section.
However, JavaLex generates errors into infinity,
which it shouldn't do.  
				-- Elliot

****************************************************************************

//
//      (c) Copyright 1996 PrinceNet, Inc.
//      All Rights Reserved.
//
// ------------------------------------------------------------------
//


import java.io.*;

%%

%type java_cup.runtime.Symbol
%char
%line

%{
int           firstCharinLine;
int           tabs = 0;
boolean       MacroHeaderDetected = false;

private int stringstart;
private StringBuffer charBuf = null;

private java_cup.runtime.Symbol tok(int kind) {
	return new java_cup.runtime.Symbol(kind, yychar, yychar+yylength());
}

private java_cup.runtime.Symbol tok(int kind, Object o) {
	return new java_cup.runtime.Symbol(kind, yychar, yychar+yylength(), o);
}

private void error(int line, String text) {
	System.out.println("Invalid text on line " + line + " " + text);
}

%}

%eofval{
	return tok(sym.EOF);
%eofval}


%%



<YYINITIAL>'{'	{ return tok(sym.LBRACE); }

<YYINITIAL>\}	{ return tok(sym.RBRACE); }

<YYINITIAL>" "	{ }

<YYINITIAL>\n { firstCharinLine = yychar+1; }

<YYINITIAL>. { 
	error(yyline+1, yytext());
}