Module: Yaparc::Parsable
- Included in:
- AbstractParser, Alt, Apply, CR, Char, Digit, FailParser, Ident, Identifier, Item, Literal, Many, ManyOne, Nat, Natural, NoFail, Regex, Satisfy, Seq, Space, String, Succeed, Symbol, Tokenize, WhiteSpace, ZeroOne
- Defined in:
- lib/yaparc/parsable.rb
Constant Summary collapse
- IS_LOWER =
->(c) { c >= 'a' and c <= 'z' }
- IS_ALPHANUM =
->(c) { (c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') }
- IS_DIGIT =
->(i) { i >= '0' and i <= '9' }
- IS_SPACE =
->(i) { i == ' ' }
- IS_WHITESPACE =
->(i) { [' ', "\n", "\t"].include?(i) }
- IS_CR =
->(i) { i == "\n" }
Instance Method Summary collapse
Instance Method Details
#parse(input) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/yaparc/parsable.rb', line 10 def parse(input) result = @parser.call(input) if result.respond_to?(:parse) result.parse(input) else result end end |