Method: BusScheme.parse_list
- Defined in:
- lib/parser.rb
.parse_list(tokens) ⇒ Object
Nest a list from a 1-dimensional list of tokens
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/parser.rb', line 25 def parse_list(tokens) list = [] while element = tokens.shift and element != :')' if element == :'(' list << parse_list(tokens) else list << element end end raise IncompleteError unless element == :')' parse_dots_into_cons list end |