Module: Kaiseki

Defined in:
lib/node.rb,
lib/rule.rb,
lib/action.rb,
lib/extras.rb,
lib/stream.rb,
lib/grammar.rb,
lib/kaiseki.rb,
lib/var_get.rb,
lib/var_set.rb,
lib/parseable.rb,
lib/tag_basic.rb,
lib/tag_error.rb,
lib/parser_eof.rb,
lib/tag_result.rb,
lib/var_insert.rb,
lib/parse_error.rb,
lib/parser_list.rb,
lib/result_cast.rb,
lib/grammar_stub.rb,
lib/parse_result.rb,
lib/parser_basic.rb,
lib/parser_multi.rb,
lib/result_merge.rb,
lib/parser_choice.rb,
lib/parser_custom.rb,
lib/parser_regexp.rb,
lib/parser_repeat.rb,
lib/parser_string.rb,
lib/parser_symbol.rb,
lib/predicate_and.rb,
lib/predicate_not.rb,
lib/result_action.rb,
lib/result_filter.rb,
lib/parser_package.rb,
lib/predicate_skip.rb,
lib/parser_sequence.rb,
lib/result_override.rb,
lib/result_validate.rb

Defined Under Namespace

Modules: Parseable Classes: Action, ActionResult, AndPredicate, BasicParser, BasicTag, CastResult, ChoiceParser, CustomParser, EOFParser, ErrorTag, FilterResult, GetVar, Grammar, GrammarStub, InsertVar, ListParser, MergeResult, MultiParser, Node, NotPredicate, OverrideResult, PackageParser, ParseError, ParseResult, RegexpParser, RepeatParser, ResultTag, Rule, SequenceParser, SetVar, SkipPredicate, Stream, StringParser, SymbolParser, ValidateResult

Constant Summary collapse

LITERAL =
CustomParser.new do
  @stream.lock do
    term = @stream.getc
    failed = true
    string = ''
    raise ParseError.new "unexpected character \"#{term}\" (expected \"\"\" or \"\'\") when parsing #{self}", @options[:rule] unless term == '"' or term == "'"
    while char = @stream.getc
      if char == term
        failed = false
        break
      elsif char == '\\'
        if match = @stream.match(/\d+/)
          string << Kernel.eval("\"\\#{match}\"")
        else
          string << Kernel.eval("\"\\#{@stream.getc}\"")
        end
      else
        string << char
      end
    end
    if failed
      raise ParseError.new "unexpected end-of-string (expected \"#{term}\") when parsing #{self}", @options[:rule]
    else
      string
    end
  end
end
VERSION =
'1.3.2'