Parsers::YYLexer
use Parseres::YYLexer;
use Parsers::YYLexer qw(:all);
YYLexer class provides the following methods:
new, GetYYLex, Next, Peek, SetupYYTabFile, StringifyYYLexer, YYLex
Parsers::YYLexer class is derived from Parsers::Lexer base class, which provides all the underlying lexer functionality. YYLexer class is designed to be used with yyparse code generated by running byacc on a parsers defined using parser definition ParserName.yy file.
YYTabFile containing mapping of token labels to integers must be explicitly specified by the caller. This file is processed during new method invocation and mapping of token labels to integers is loaded in a hash to be used later by YYLex method to return token number and text pairs to the parser.
Using specified Input and YYLexerTokensSpec, new method generates a new YYLexer and returns a reference to newly created YYLexer object.
Examples:
Returns a curried verson of YYLexer as YYLex: yyparse in parser generated by byacc expects it to call without passing any argument for the YYLexer object.
Returns next available TokenNumber and any matched TokenText from input stream by removing it from the input stream. Token number and text of zero corresponds to end of input (EOI).
Returns next available TokenNumber and any matched TokenText from input stream by simply looking ahead and without removing it from the input stream. Token number and text of zero corresponds to end of input (EOI).
Processes token labels to integers data map in specified YYTabFile and returns YYLexer.
Notes:
Returns available TokenNumber and any matched TokenText from input stream by either removing it from the input stream or by simply looking ahead and without removing it from the input stream. Token number and text of zero corresponds to end of input (EOI).
Possible Mode values: Peek, Next. Default: Next.
YYLex is designed to be used with yyparse code generated by running byacc on a parsers defined using parser definition ParserName.yy file.
Notes:
Returns a string containing information about YYLexer object.
Lexer.pm, SimpleCalcYYLexer.pm, SimpleCalcParser.yy
Copyright (C) 2015 Manish Sud. All rights reserved.
This file is part of MayaChemTools.
MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.