lib/d-mark/parser.rb in d-mark-1.0.0b1 vs lib/d-mark/parser.rb in d-mark-1.0.0b2
- old
+ new
@@ -53,10 +53,11 @@
@col_nr = 0
end
loop do
break if eof?
+
res << read_block_with_children
end
res
end
@@ -75,14 +76,14 @@
@pos += 1
@col_nr += 1
end
- def read_char(c)
+ def read_char(expected_char)
char = @input_chars[@pos]
- if char != c
- raise_parse_error("expected #{c.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
+ if char != expected_char
+ raise_parse_error("expected #{expected_char.inspect}, but got #{char.nil? ? 'EOF' : char.inspect}")
else
advance
char
end
end
@@ -230,9 +231,10 @@
res = ''
loop do
char = @input_chars[@pos]
break unless IDENTIFIER_CHARS.include?(char)
+
advance
res << char
end
res.to_s