Sha256: c6c939baba30a26c13c7a1362dbf544fdc9f066713f36f48ff49b0dbcc07eca3
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
module Treetop class CharacterClass < TerminalParsingExpression attr_reader :char_class_string, :prefix_regex def initialize(char_class_string) super() @char_class_string = char_class_string @prefix_regex = Regexp.new("[#{char_class_string}]") end def parse_at(input, start_index, parser) if input.index(prefix_regex, start_index) == start_index return node_class.new(input, start_index...(start_index + 1)) else TerminalParseFailure.new(start_index, self) end end def to_s return "[#{char_class_string}]" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
treetop-0.1.0 | lib/treetop/grammar/parsing_expressions/character_class.rb |