class Treetop::Runtime::SyntaxNode

Public Instance Methods

ast() click to toggle source
# File lib/abnftt.rb, line 12
def ast
  fail "undefined_ast #{inspect}"
end
ast_from_percent(base, first, second) click to toggle source
# File lib/abnftt.rb, line 15
def ast_from_percent(base, first, second)
  c1 = first.to_i(base).chr(Encoding::UTF_8)
  case second[0]
  when nil
    ["cs", c1]
  when "-"
    c2 = second[1..-1].to_i(base).chr(Encoding::UTF_8)
    ["char-range", c1, c2]
  when "."
    el = second.split(".")
    el[0] = first
    ["cs", el.map {|c| c.to_i(base).chr(Encoding::UTF_8)}.join]
  else
    fail "ast_from_percent"
  end
end
clean_abnf() click to toggle source
# File lib/abnftt.rb, line 5
def clean_abnf
  if elements
    elements.map {|el| el.clean_abnf}.join
  else
    text_value
  end
end