Class: RubyLex
- Defined in:
- lib/openc3/utilities/ruby_lex_utils.rb,
lib/openc3/utilities/ruby_lex_utils.rb
Instance Attribute Summary collapse
-
#code_block_open ⇒ Object
Returns the value of attribute code_block_open.
-
#continue ⇒ Object
Returns the value of attribute continue.
-
#exp_line_no ⇒ Integer
The expression line number.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#line ⇒ Object
Returns the value of attribute line.
-
#line_no ⇒ Object
Returns the value of attribute line_no.
-
#ltype ⇒ Object
Returns the value of attribute ltype.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#identify_string_dvar ⇒ Object
Monkey patch to keep this from looping forever if the string never is closed with a right brace.
-
#reinitialize ⇒ Object
Resets the RubyLex in preparation of parsing a line.
Instance Attribute Details
#code_block_open ⇒ Object
Returns the value of attribute code_block_open.
32 33 34 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 32 def code_block_open @code_block_open end |
#continue ⇒ Object
Returns the value of attribute continue.
35 36 37 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 35 def continue @continue end |
#exp_line_no ⇒ Integer
Returns The expression line number. This can differ from the actual line number due to white space and Ruby control keywords.
278 279 280 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 278 def exp_line_no @exp_line_no end |
#indent ⇒ Object
Returns the value of attribute indent.
28 29 30 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 28 def indent @indent end |
#line ⇒ Object
Returns the value of attribute line.
34 35 36 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 34 def line @line end |
#line_no ⇒ Object
Returns the value of attribute line_no.
29 30 31 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 29 def line_no @line_no end |
#ltype ⇒ Object
Returns the value of attribute ltype.
33 34 35 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 33 def ltype @ltype end |
#tokens ⇒ Object
Returns the value of attribute tokens.
31 32 33 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 31 def tokens @tokens end |
Instance Method Details
#identify_string_dvar ⇒ Object
Monkey patch to keep this from looping forever if the string never is closed with a right brace
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 304 def identify_string_dvar getc reserve_continue = @continue reserve_ltype = @ltype reserve_indent = @indent reserve_indent_stack = @indent_stack reserve_state = @lex_state reserve_quoted = @quoted @ltype = nil @quoted = nil @indent = 0 @indent_stack = [] @lex_state = EXPR_BEG loop do @continue = false prompt tk = token break if tk.nil? # This is the patch if @ltype or @continue or @indent >= 0 next end break if tk.kind_of?(TkRBRACE) end ensure @continue = reserve_continue @ltype = reserve_ltype @indent = reserve_indent @indent_stack = reserve_indent_stack @lex_state = reserve_state @quoted = reserve_quoted end |
#reinitialize ⇒ Object
Resets the RubyLex in preparation of parsing a line
281 282 283 284 285 |
# File 'lib/openc3/utilities/ruby_lex_utils.rb', line 281 def reinitialize @line_no = 1 @prompt = nil initialize_input() end |