Closed lucs closed 10 years ago
(Sorry, but be careful, that code has some unitintended whitespace that messes it up a bit.)
Take this latest source for Progra/Semantics, this is adding lhs and rhs information. StringLiteral is viewed as a lexeme in Program, so it is Literal that applies.
{
lhs => 'Literal',
rhs => [
'StringLiteral'
],
ruleId => 3,
values => [
[
0,
5,
'foo'
]
]
}
In the AST, lexemes are always refs to arrays, while rules are always refs to hash.
Please note this is not tagged - maybe I'll switch back to a bless => ::lhs method - nevertheless I putted this just to allow you to progress in your use of MarpaX::Languages::ECMAScript::AST -;
./.. and values are always ref to an array containing one or the other
Another note: for traveral of the AST you will liekely run into a stack perl limit. The stack-free method to traverse an enormous AST is something like e.g. https://github.com/jddurand/MarpaX-Languages-C-AST/blob/master/lib/MarpaX/Languages/C/AST/Util/Data/Find.pm
Available as-is with 7a7336b39f997db2d368207007b78e2d86ba1c90, indexed version 0.017
According to
MarpaX/Languages/ECMAScript/AST/Grammar/ECMAScript_262_5/Template.pm
, we should have:Yet, it turns out that the code behaves like if it was:
as can be shown with the following program:
Which one should it be?