Age | Commit message (Collapse) | Author | Files | Lines |
|
The calculation of string length was done wrong for dingle
quoted string resulting in negative lengths.
|
|
* upstream/stable:
(PUP-2568) Remove unnecessary calls
(maint) Reorder code to increase clarity
(PUP-2581) Make illegal names interchangeable to legal variable work
(PUP-2568) Downcase class name before validating
Conflicts:
lib/puppet/pops/parser/eparser.rb
Rebuilt eparser.
|
|
In interpolation when using expression mode ${} and having an illegal
name (e.g. _x) that resulted in a syntax error as the _x got translated
to a STRING token (a bare word not being a name). The interpolation
logic could then not transform it into a (valid) variable expression
(i.e. $_x).
The change is to let the lexer emit a WORD token for the illegal NAME.
The interpolation then changes that to a VARIBLE if it is the only
expression. If the WORD token escapes into the grammar, it is equivalent
to having used a quoted string in the source text.
Note that WORD only accepts unqualified input, anything with a : that is
not a valid NAME is still flagged as an error. Thus _x::y, x::_y are
both illegal NAME.
|
|
The problem was that there was only one special case being handled
by the lexer to dis-ambiguate if an expression followed by [ meant
the start of an access operations (e.g. getting an entry out of an
array), or if it represented the start of a literal array.
The supported special case was NAME followed by non-WS followed by [.
This meant that cases like foo(3) [a,b,c] were always treated as
an access operation.
The fix generalizes the dis-ambiguation so that all access operations
must be written without interleaved WS.
|
|
This is a fix for the reported issue that 'slurpfunc' is an unknown
method. Thankfuly that problem masked a much worse problem in that any
false interolation start e.g. $%a was not correctly implemented, and
there were no tests that covered this.
The same issue also existed for interpolation in heredoc.
This commit fixes the interpolation problem, and adds tests.
|
|
Tests were failing due to additional token marking the end of
an EPP render expression.
|
|
Parsing EPP now results in a Program model (if producing only
an EppExpression there are no source code references).
The EPP_START tokten was not emitted (and its precence was not
tested for).
|
|
This completes the implementation of SubLocatedExpression. The
SubLocator refactored to Locator (instead of being nested inside
the support for Heredoc). Heredoc lexing, and the grammar now
cooperate to ensure that sublocated model is wrapped.
|
|
This makes it possible to escapce a backslash in a sq string.
Previously this did not work which made it impossible to end a sq string
with a backslash.
|
|
This adds the ability to use a hyphen in a bare word. The result is the
same as if the bare word had been quoted in single quotes. It is not
allowed to start or end a bare word with a hyphen, those are always
interpreted as :MINUS.
|
|
The problem was caused by the logic using the Kernel method
Integer(string, radix) which was introduced in Ruby 1.9.2. We do
not need to pass radix, since the string converted starts with 0, 0x,
or 0X in all cases.
|
|
This also includes a cleanup of LAMBDA (unused/dead logic in grammar)
|
|
All parser benchmarks are now located in one spec unit test.
Thy are automatically excluded by a filter that can be turned off by
setting the ENV variable BENCHMARK to true when running the tests.
|
|
This adds a comprehensive parse/validate/evaluate test for the
future evaluator. Several parsing and evaluation issues were found and
corrected.
|
|
This makes the future parser use the new faster lexer.
As a consequence features provided by the old lexer has now moved
to the parser (keeping track of namestack).
Locator information is still not optimized wrt the parser as the
tokens/locator information are adapter to the "old" way
(room for performance improvements).
Tests are updated as the new lexer is both more restrictive, and in
some case more relaxed (where regular expressions may occur).
|
|
It was named Lexer2 in the gloval namespace.
|
|
This adds support for epp templates to the new Lexer2 without
affecting the overall performance of the lexer.
This does not add the full epp template feature, only the support in the
lexer and the EppParser that shows how the lexer is used to perform epp
lexing when parsing.
This commit also refacores method names for error handling since
the most common way to report a lexer error is to add location
information.
|
|
The Lexer2 (not yet used by the parser) performs >3x faster on
lexing of 10 lines of mixed code including simple expression
interpolation than the original lexer (which does not keep track
of detailed positions).
|