lib/d-mark/parser.rb in d-mark-1.0.0a1 vs lib/d-mark/parser.rb in d-mark-1.0.0a2

- old
+ new

@@ -131,36 +131,15 @@ end end # FIXME: ugly and duplicated def try_read_block_start - old_pos = @pos - - success = - if try_read_identifier_head - read_identifier_tail - - case peek_char - when '[' - true - when '.' - advance - [' ', "\n", nil].include?(peek_char) - end - end - - @pos = old_pos - success - end - - # FIXME: ugly and duplicated - def try_read_identifier_head - char = peek_char - case char - when 'a'..'z' - advance - char + if peek_char == '#' + next_char = peek_char(@pos + 1) + ('a'..'z').cover?(next_char) + else + false end end def detect_indentation indentation_chars = 0 @@ -185,21 +164,20 @@ read_char(' ') end end def read_single_block + read_char('#') identifier = read_identifier attributes = if peek_char == '[' read_attributes else {} end - read_char('.') - case peek_char when nil, "\n" advance ElementNode.new(identifier, attributes, []) else @@ -372,10 +350,10 @@ end def read_percent_body char = peek_char case char - when '%', '}' + when '%', '}', '#' advance char.to_s when nil, "\n" raise_parse_error("expected something after %") else