Class: Tracksperanto::ShakeGrammar::Lexer

Inherits:
Object
  • Object
show all
Defined in:
lib/import/shake_grammar/lexer.rb

Overview

Since Shake uses a C-like language for it’s scripts we rig up a very sloppy but concise C-like lexer to cope

Direct Known Subclasses

Catcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(with_io) ⇒ Lexer

Returns a new instance of Lexer.



8
9
10
11
12
# File 'lib/import/shake_grammar/lexer.rb', line 8

def initialize(with_io)
  @io, @stack, @buf  = with_io, [], ''
  parse until (@io.eof? || @stop)
  in_comment? ? consume_comment("\n") : consume_atom!
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



6
7
8
# File 'lib/import/shake_grammar/lexer.rb', line 6

def stack
  @stack
end