Closed jddurand closed 10 years ago
Note: reproduced with 2.097003
Tokens at a specific location should be read either externally with lexeme_alternative()
or lexeme_read()
. There is a point at which you call lexeme_alternative()
, but do not call lexeme_complete()
before calling $slif_recce->resume()
, so that you'd wind up with both internally and externally read lexemes.
Previously, I had no error message to detect this, but when adding the new feature set, I added this.
Since 100% of the calls to Marpa go via an Impl.pm file; let me put trace statement in all its method to check.
There is no call to lexeme_alternative() in the whole of MarpaX::Languages::ECMAScript::AST. Only lexeme_read(). Here is the full sequence of marpa calls:
There is only lexeme_read().
2014/10/25 22:58:32 DEBUG 20840 Marpa::R2::Scanless::G->new()
2014/10/25 22:58:32 DEBUG 20840 Marpa::R2::Scanless::R->new()
2014/10/25 22:58:32 TRACE 20840 Setting trace_terminals option
2014/10/25 22:58:32 TRACE 20840 Setting trace_values option
2014/10/25 22:58:32 DEBUG 20840 recce->read
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" accepted lexeme L1c1 e1: IDENTIFIER; value="a"
2014/10/25 22:58:32 DEBUG 20840 recce->events
2014/10/25 22:58:32 DEBUG 20840 recce->current_g1_location
2014/10/25 22:58:32 DEBUG 20840 recce->g1_location_to_span
2014/10/25 22:58:32 DEBUG 20840 recce->literal
2014/10/25 22:58:32 DEBUG 20840 recce->resume
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" discarded lexeme L1c2: _S_MANY
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" accepted lexeme L1c3 e2: ASSIGN; value="="
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" discarded lexeme L1c4: _S_MANY
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" accepted lexeme L1c5 e3: IDENTIFIER; value="b"
2014/10/25 22:58:32 DEBUG 20840 recce->events
2014/10/25 22:58:32 DEBUG 20840 recce->current_g1_location
2014/10/25 22:58:32 DEBUG 20840 recce->g1_location_to_span
2014/10/25 22:58:32 DEBUG 20840 recce->literal
2014/10/25 22:58:32 DEBUG 20840 recce->resume
2014/10/25 22:58:32 TRACE 20840 Lexer "L0" discarded lexeme L1c6: _S_MANY
2014/10/25 22:58:32 DEBUG 20840 recce->events
2014/10/25 22:58:32 DEBUG 20840 recce->current_g1_location
2014/10/25 22:58:32 DEBUG 20840 recce->g1_location_to_span
2014/10/25 22:58:32 DEBUG 20840 recce->literal
2014/10/25 22:58:32 DEBUG 20840 recce->lexeme_read
2014/10/25 22:58:32 DEBUG 20840 recce->lexeme_read
2014/10/25 22:58:32 DEBUG 20840 recce->resume
2014/10/25 22:58:32 DEBUG 20840 recce->current_g1_location
2014/10/25 22:58:32 DEBUG 20840 recce->g1_location_to_span
2014/10/25 22:58:32 DEBUG 20840 recce->literal
2014/10/25 22:58:32 DEBUG 20840 recce->current_g1_location
2014/10/25 22:58:32 DEBUG 20840 recce->g1_location_to_span
2014/10/25 22:58:32 DEBUG 20840 recce->line_column
2014/10/25 22:58:32 DEBUG 20840 recce->show_progress
2014/10/25 22:58:32 DEBUG 20840 destroy Marpa::R2::Scanless::R
Uncaught exception from user code:
Error in SLIF parse: Unrecognized problem code: unpermitted mix of external and internal scanning
* String before error: a = b\n++
* The error was at line 2, column 3, and at character 0x0063 'c', ...
* here: c\s
Marpa::R2 exception at lib/MarpaX/Languages/ECMAScript/AST/Impl.pm line 141.
Looking back, all the calls to lexeme_alternative()
do take place indirectly via lexeme_read()
. What's probably happening is that lexeme_read()
is returning undef
(for a rejected token) and you're not checking for the failure to accept any lexemes.
Possibly, but then why did it work previously ? I am checking the code.
Yes, I am doing a postfix '++' instead of a normal '++'. Checking all the lexeme_read() has show that it is a bug in my package. Many thanks for your time on this. Do you know if it is possible to move an issue from one repo to another -; ?
It's possible to refer to an issue in another repo. Some of mine do that. What I'd do is open a new issue with a reference to this one.
I take it I can close this.
Reference done. Thanks.
One of the test script in MarpaX::Languages::ECMAScript::AST fails like this:
Running this script with Marpa::R2's traces on says: