# Autogenerated from a Treetop grammar. Edits may be lost. module Bindy module Language include Treetop::Runtime def root @root ||= :expression end def _nt_expression start_index = index if node_cache[:expression].has_key?(index) cached = node_cache[:expression][index] if cached node_cache[:expression][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_function if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_value if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:expression][start_index] = r0 r0 end module Function0 def identifier elements[0] end def arg_list elements[4] end end def _nt_function start_index = index if node_cache[:function].has_key?(index) cached = node_cache[:function][index] if cached node_cache[:function][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_identifier s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if (match_len = has_terminal?('(', false, index)) r4 = true @index += match_len else terminal_parse_failure('\'(\'') r4 = nil end s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r7 = _nt_arg_list s0 << r7 if r7 s8, i8 = [], index loop do r9 = _nt_space if r9 s8 << r9 else break end end r8 = instantiate_node(SyntaxNode,input, i8...index, s8) s0 << r8 if r8 if (match_len = has_terminal?(')', false, index)) r10 = true @index += match_len else terminal_parse_failure('\')\'') r10 = nil end s0 << r10 end end end end end end if s0.last r0 = instantiate_node(Function,input, i0...index, s0) r0.extend(Function0) else @index = i0 r0 = nil end node_cache[:function][start_index] = r0 r0 end module ArgList0 def expression elements[0] end def arg_list elements[4] end end def _nt_arg_list start_index = index if node_cache[:arg_list].has_key?(index) cached = node_cache[:arg_list][index] if cached node_cache[:arg_list][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index i1, s1 = index, [] r2 = _nt_expression s1 << r2 if r2 s3, i3 = [], index loop do r4 = _nt_space if r4 s3 << r4 else break end end r3 = instantiate_node(SyntaxNode,input, i3...index, s3) s1 << r3 if r3 if (match_len = has_terminal?(',', false, index)) r5 = true @index += match_len else terminal_parse_failure('\',\'') r5 = nil end s1 << r5 if r5 s6, i6 = [], index loop do r7 = _nt_space if r7 s6 << r7 else break end end r6 = instantiate_node(SyntaxNode,input, i6...index, s6) s1 << r6 if r6 r8 = _nt_arg_list s1 << r8 end end end end if s1.last r1 = instantiate_node(ArgList,input, i1...index, s1) r1.extend(ArgList0) else @index = i1 r1 = nil end if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r9 = _nt_expression if r9 r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true r0 = r9 else s10, i10 = [], index loop do r11 = _nt_space if r11 s10 << r11 else break end end r10 = instantiate_node(SyntaxNode,input, i10...index, s10) if r10 r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true r0 = r10 else @index = i0 r0 = nil end end end node_cache[:arg_list][start_index] = r0 r0 end def _nt_identifier start_index = index if node_cache[:identifier].has_key?(index) cached = node_cache[:identifier][index] if cached node_cache[:identifier][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?(@regexps[gr = '\A[a-z\\_]'] ||= Regexp.new(gr), :regexp, index) r1 = true @index += 1 else terminal_parse_failure('[a-z\\_]') r1 = nil end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(SyntaxNode,input, i0...index, s0) end node_cache[:identifier][start_index] = r0 r0 end def _nt_value start_index = index if node_cache[:value].has_key?(index) cached = node_cache[:value][index] if cached node_cache[:value][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_number if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_boolean if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else r3 = _nt_string if r3 r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true r0 = r3 else @index = i0 r0 = nil end end end node_cache[:value][start_index] = r0 r0 end module String0 def value elements[1] end end def _nt_string start_index = index if node_cache[:string].has_key?(index) cached = node_cache[:string][index] if cached node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("'", false, index)) r1 = true @index += match_len else terminal_parse_failure('"\'"') r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do if has_terminal?(@regexps[gr = '\A[\\da-zA-ZáéíóúüñÁÉÍÓÚÜÑ¿?!¡\\s\\@\\#\\$\\%\\&\\/\\\\\\*\\_\\-\\+\\/\\\\\\*\\_\\-\\+\\.\\:\\,\\;\\<\\>\\|\\"\\\\(\\)]'] ||= Regexp.new(gr), :regexp, index) r3 = true @index += 1 else terminal_parse_failure('[\\da-zA-ZáéíóúüñÁÉÍÓÚÜÑ¿?!¡\\s\\@\\#\\$\\%\\&\\/\\\\\\*\\_\\-\\+\\/\\\\\\*\\_\\-\\+\\.\\:\\,\\;\\<\\>\\|\\"\\\\(\\)]') r3 = nil end if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if (match_len = has_terminal?("'", false, index)) r4 = true @index += match_len else terminal_parse_failure('"\'"') r4 = nil end s0 << r4 end end if s0.last r0 = instantiate_node(LiteralString,input, i0...index, s0) r0.extend(String0) else @index = i0 r0 = nil end node_cache[:string][start_index] = r0 r0 end def _nt_number start_index = index if node_cache[:number].has_key?(index) cached = node_cache[:number][index] if cached node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_float if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_integer if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:number][start_index] = r0 r0 end module Integer0 end def _nt_integer start_index = index if node_cache[:integer].has_key?(index) cached = node_cache[:integer][index] if cached node_cache[:integer][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?(@regexps[gr = '\A[\\+\\-]'] ||= Regexp.new(gr), :regexp, index) r2 = true @index += 1 else terminal_parse_failure('[\\+\\-]') r2 = nil end if r2 r1 = r2 else r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 s3, i3 = [], index loop do if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index) r4 = true @index += 1 else terminal_parse_failure('[\\d]') r4 = nil end if r4 s3 << r4 else break end end if s3.empty? @index = i3 r3 = nil else r3 = instantiate_node(SyntaxNode,input, i3...index, s3) end s0 << r3 end if s0.last r0 = instantiate_node(LiteralInteger,input, i0...index, s0) r0.extend(Integer0) else @index = i0 r0 = nil end node_cache[:integer][start_index] = r0 r0 end module Float0 end def _nt_float start_index = index if node_cache[:float].has_key?(index) cached = node_cache[:float][index] if cached node_cache[:float][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?(@regexps[gr = '\A[\\+\\-]'] ||= Regexp.new(gr), :regexp, index) r2 = true @index += 1 else terminal_parse_failure('[\\+\\-]') r2 = nil end if r2 r1 = r2 else r1 = instantiate_node(SyntaxNode,input, index...index) end s0 << r1 if r1 s3, i3 = [], index loop do if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index) r4 = true @index += 1 else terminal_parse_failure('[\\d]') r4 = nil end if r4 s3 << r4 else break end end if s3.empty? @index = i3 r3 = nil else r3 = instantiate_node(SyntaxNode,input, i3...index, s3) end s0 << r3 if r3 if (match_len = has_terminal?('.', false, index)) r5 = true @index += match_len else terminal_parse_failure('\'.\'') r5 = nil end s0 << r5 if r5 s6, i6 = [], index loop do if has_terminal?(@regexps[gr = '\A[\\d]'] ||= Regexp.new(gr), :regexp, index) r7 = true @index += 1 else terminal_parse_failure('[\\d]') r7 = nil end if r7 s6 << r7 else break end end if s6.empty? @index = i6 r6 = nil else r6 = instantiate_node(SyntaxNode,input, i6...index, s6) end s0 << r6 end end end if s0.last r0 = instantiate_node(LiteralFloat,input, i0...index, s0) r0.extend(Float0) else @index = i0 r0 = nil end node_cache[:float][start_index] = r0 r0 end def _nt_boolean start_index = index if node_cache[:boolean].has_key?(index) cached = node_cache[:boolean][index] if cached node_cache[:boolean][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_true if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_false if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else @index = i0 r0 = nil end end node_cache[:boolean][start_index] = r0 r0 end def _nt_true start_index = index if node_cache[:true].has_key?(index) cached = node_cache[:true][index] if cached node_cache[:true][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if (match_len = has_terminal?('true', false, index)) r0 = instantiate_node(LiteralTrue,input, index...(index + match_len)) @index += match_len else terminal_parse_failure('\'true\'') r0 = nil end node_cache[:true][start_index] = r0 r0 end def _nt_false start_index = index if node_cache[:false].has_key?(index) cached = node_cache[:false][index] if cached node_cache[:false][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if (match_len = has_terminal?('false', false, index)) r0 = instantiate_node(LiteralFalse,input, index...(index + match_len)) @index += match_len else terminal_parse_failure('\'false\'') r0 = nil end node_cache[:false][start_index] = r0 r0 end def _nt_space start_index = index if node_cache[:space].has_key?(index) cached = node_cache[:space][index] if cached node_cache[:space][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?(@regexps[gr = '\A[\\s\\t\\n]'] ||= Regexp.new(gr), :regexp, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('[\\s\\t\\n]') r0 = nil end node_cache[:space][start_index] = r0 r0 end end class LanguageParser < Treetop::Runtime::CompiledParser include Language end end