The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5 - ECMAScript-262, Edition 5, grammar

VERSION

version 0.020

SYNOPSIS

    use strict;
    use warnings FATAL => 'all';
    use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5;

    my $ecma = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5->new();

    my $program = $ecma->program();

DESCRIPTION

This modules returns all grammars needed for the ECMAScript 262, Edition 5 grammars written in Marpa BNF, as of http://www.ecma-international.org/publications/standards/Ecma-262.htm. ONLY the Program and JSON grammars provides an AST. The StringNumericLiteral and Pattern grammars, if needed by another engine but a perl executable, will have to be provided expicitely. StringNumericLiteral and Pattern parse tree values presented here are meaningful only for a perl engine.

From a perl engine point of view, there two main notion of numbers: native (i.e. the ones in the math library with which perl was build), and the Math::Big* family. Therefore the parse tree value of the StringNumericLiteral is abstracted to handle both cases.

The Pattern parse tree value provides an anoynmous subroutine to be used directly as a Regexp.prototype.exec call.

SUBROUTINES/METHODS

new($class, %opts)

Instance a new object. Takes as optional argument a hash that may contain the following key/values:

Template

Reference to hash containing options for MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template. These options can be:

g1Callback

G1 callback (CODE ref)

g1CallbackArgs

G1 callback arguments (ARRAY ref). The g1 callback is called like: &$g1Callback(@{$g1CallbackArgs}, \$rc, $ruleId, $value, $index, $lhs, @rhs), where $value is the AST parse tree value of RHS No $index of this G1 rule number $ruleId, whose full definition is $lhs ::= @rhs. If the callback is defined, this will always be executed first, and it must return a true value putting its eventual result in $rc. Only when it returns true, lexemes are processed.

lexemeCallback

lexeme callback (CODE ref).

lexemeCallbackArgs

Lexeme callback arguments (ARRAY ref). The lexeme callback is called like: &$lexemeCallback(@{$lexemeCallbackArgs}, \$rc, $name, $ruleId, $value, $index, $lhs, @rhs), where $value is the AST parse tree value of RHS No $index of this G1 rule number $ruleId, whose full definition is $lhs ::= @rhs. The RHS being a lexeme, $name contains the lexeme's name. If the callback is defined, this will always be executed first, and it must return a true value putting its result in $rc, otherwise default behaviour applies: return the lexeme value as-is.

StringNumericLiteral

Reference to hash containing options for MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral. These options can be:

semantics_package

Semantic package providing host implementation of a Number.

program()

Returns the program grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

JSON()

Returns the JSON grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

URI()

Returns the URI grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

template()

Returns the template associated to this grammar. This is a MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template object.

stringNumericLiteral()

Returns the StringNumericLiteral grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

pattern()

Returns the Pattern grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

spacesAny()

Returns the SpacesAny grammar as a hash reference that is

grammar

A MarpaX::Languages::ECMAScript::AST::Grammar::Base object

impl

A MarpaX::Languages::ECMAScript::AST::Impl object

SEE ALSO

MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral

MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Pattern

MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template

AUTHOR

Jean-Damien Durand <jeandamiendurand@free.fr>

COPYRIGHT AND LICENSE

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.