Search code examples
jflex

jFlex methods (yypushStream,yypopStream..) trigger "cannot find symbol" error in user code


I have some user code in jFlex that generates a BufferedReader from yytext(), then has it pushed into the stream stack.

However, it seems that yypushStream(), yypopStream(), yymoreStreams() methods are not recognized by javac and trigger a "cannot find symbol" error whenever those methods are called from within the user code.

For instance:

public void toStream(String a){

InputStream fstream= new ByteArrayInputStream(a.getBytes());
BufferedReader freader = new BufferedReader(new  InputStreamReader(fstream));
yypushStream(freader);

    }

Returns the following output:

symbol: method yypushStream(BufferedReader)
Yylex.java:389: error: cannot find symbol
yypushStream(freader);
^

I've also tried Yylex.yyPopStream(); and %public to no effect.

Is it that those methos cannot be used in the user code?

Thanks


Solution

  • If you read carefully Jflex Manual, it is written that the methods yyPushStream(), yyPopStream() and yyMoreStreams() are available only in the skeleton file called skeleton.nested, that you find in the src folder. So you shouldn't use it or call it in the user code.