MarpaX::Languages::ECMA::AST::Grammar::Base - ECMA, grammars base package
version 0.001
use strict; use warnings FATAL => 'all'; use MarpaX::Languages::ECMA::AST::Grammar::Base; my $grammar = MarpaX::Languages::ECMA::AST::Grammar::Base->new("grammar", "My::Package", "ECMA_262_5"); my $grammar_content = $grammar->content(); my $grammar_option = $grammar->grammar_option(); my $recce_option = $grammar->recce_option();
This modules returns a base package for all the ECMA grammars written in Marpa BNF.
Instance a new object. Takes a grammar, a package name and an ECMA specification as required parameters.
Sets/Returns the strict mode of the grammar.
Returns the content of the grammar.
Returns the part of the grammar that can be safely extracted and injected in another.
Returns recommended option for Marpa::R2::Scanless::G->new(), returned as a reference to a hash.
Returns recommended option for Marpa::R2::Scanless::R->new(), returned as a reference to a hash.
Parse the source given as reference to a scalar, an optional reference to a options that is a hash that can contain:
Callbak Code Reference
Reference to an array of Callback Code Reference first arguments
Failure callback Code Reference
Reference to an array of Failure callback Code Reference first arguments
End callback Code Reference
Reference to an array of End callback Code Reference first arguments
This method must be called as a super method by grammar using this package as a parent. $self must be a reference to a grammar instantiated via MarpaX::Languages::ECMA::AST::Grammar. The callback code will always be called with: per-callback arguments, $sourcep, $pos (i.e. current position), $max (i.e. max position), $impl (i.e. a MarpaX::Languages::ECMA::AST::Impl instance). The default and failure callbacks must always return the new position in the stream, and croak if there is an error. In the 'end' and 'failure' callbacks, $pos is not meaningful: this is the last position where external scanning restarted. You might want to look to the getLastLexeme() method. Output of the 'end' callback is ignored.
Return the blessed value. $impl is the recognizer instance for the grammar. Will croak if there is more than one parse tree value.
Fills a hash with latest paused lexeme:
Lexeme name
Start position
Length
Line number as per Marpa
Column number as per Marpa
Lexeme value
Returns a true value if a lexeme pause information is available.
Fills a hash with latest lexeme (whatever it is, its name is unknown):
undef value
MarpaX::Languages::ECMA::AST::Impl
MarpaX::Languages::ECMA::AST::Util
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2013 by Jean-Damien Durand.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2 POD Errors
The following errors were encountered while parsing the POD:
Unknown directive: =value
To install MarpaX::Languages::ECMA::AST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::Languages::ECMA::AST
CPAN shell
perl -MCPAN -e shell install MarpaX::Languages::ECMA::AST
For more information on module installation, please visit the detailed CPAN module installation guide.