Closed justdan96 closed 4 years ago
I have replicated the same issue in the very latest version of RLTK - log below:
Parsing schedules...
RLTK::NotInLanguage exception occurred: String not in language. Token info:
Seen:
Current: ON
Remaining: [#<RLTK::Token:0x2f6d9d1c @value=nil, @type=:RUNCYCLE, ...
lib/tws_parser/builder.rb:76:in `process'
app/controllers/tivoli_uploads_controller.rb:37:in `create'
app/controllers/tivoli_uploads_controller.rb:19:in `create'
Rendered tivoli_uploads/_duplicates.html.haml (31.0ms)
Rendered shared/_settings_menu.html.haml (219.0ms)
Rendered tivoli_uploads/create.html.haml within layouts/application (437.0ms)
Completed 200 OK in 31123ms (Views: 453.0ms | ActiveRecord: 0.0ms)
Sorry I am closing the issue. It turned out that the correct replacement for this code:
# Punctuation
rule(/#/) {
# A hash indicates a comment-line iff it is the first character on the line
scanner.pos -= 1
token = scanner.bol? ? nil : :HASH
if token
scanner.pos += 1
else
scanner.scan_until(/\n/)
end
token
}
Is actually this code:
# A hash and then a space at the start of a line indicates a comment-line
rule(/^# /) { push_state :comment }
rule(/\n/, :comment) { pop_state }
rule(/./, :comment)
# Punctuation
rule(/#/) { :HASH }
It was the failure to include the :HASH
definition which was causing us problems.
We have a JRuby-on-Rails application that interprets TWS definitions using RLTK that then inserts them into database tables. The application previously was using this version and has now been updated to 2.2.1.
We initially saw an error saying
NameError exception occurred: undefined local variable or method 'scanner' for #<RLTK::Lexer::Environment:0x2838abe5>
, which seemed to be related to these lines in lib/tws_parser/parser.rb:After replacing these lines we now receive a new error:
I believe the issue is in the same file as before, here is the contents of lib/tws_parser/parser.rb, lines 103 to 129:
I guess the issue is related to the block that assigns
[:STRING, str]
but I don't know what I am supposed to change it to - can you please help?