lib/webidl/parser/idl.rb in webidl-0.0.2 vs lib/webidl/parser/idl.rb in webidl-0.0.3

- old
+ new

@@ -7,11 +7,11 @@ # http://dev.w3.org/2006/webapi/WebIDL/#idl-grammar module IDL include Treetop::Runtime def root - @root || :Definitions + @root ||= :Definitions end module Definitions0 def eal elements[0] @@ -50,11 +50,14 @@ def _nt_Definitions start_index = index if node_cache[:Definitions].has_key?(index) cached = node_cache[:Definitions][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ws @@ -112,11 +115,14 @@ def _nt_Definition start_index = index if node_cache[:Definition].has_key?(index) cached = node_cache[:Definition][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_Module @@ -185,11 +191,14 @@ def _nt_Module start_index = index if node_cache[:Module].has_key?(index) cached = node_cache[:Module][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("module", false, index) @@ -312,11 +321,14 @@ def _nt_Interface start_index = index if node_cache[:Interface].has_key?(index) cached = node_cache[:Interface][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("interface", false, index) @@ -418,11 +430,14 @@ def _nt_InterfaceInheritance start_index = index if node_cache[:InterfaceInheritance].has_key?(index) cached = node_cache[:InterfaceInheritance][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?(":", false, index) @@ -487,11 +502,14 @@ def _nt_InterfaceMembers start_index = index if node_cache[:InterfaceMembers].has_key?(index) cached = node_cache[:InterfaceMembers][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] r2 = _nt_ExtendedAttributeList @@ -536,11 +554,14 @@ def _nt_InterfaceMember start_index = index if node_cache[:InterfaceMember].has_key?(index) cached = node_cache[:InterfaceMember][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_Const @@ -594,11 +615,14 @@ def _nt_Exception start_index = index if node_cache[:Exception].has_key?(index) cached = node_cache[:Exception][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("exception", false, index) @@ -708,11 +732,14 @@ def _nt_ExceptionMembers start_index = index if node_cache[:ExceptionMembers].has_key?(index) cached = node_cache[:ExceptionMembers][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] r2 = _nt_ExtendedAttributeList @@ -780,11 +807,14 @@ def _nt_TypeDef start_index = index if node_cache[:TypeDef].has_key?(index) cached = node_cache[:TypeDef][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("typedef", false, index) @@ -863,11 +893,14 @@ def _nt_ImplementsStatement start_index = index if node_cache[:ImplementsStatement].has_key?(index) cached = node_cache[:ImplementsStatement][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ScopedName @@ -958,11 +991,14 @@ def _nt_Const start_index = index if node_cache[:Const].has_key?(index) cached = node_cache[:Const][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("const", false, index) @@ -1040,11 +1076,14 @@ def _nt_ConstExpr start_index = index if node_cache[:ConstExpr].has_key?(index) cached = node_cache[:ConstExpr][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_BooleanLiteral @@ -1076,11 +1115,14 @@ def _nt_BooleanLiteral start_index = index if node_cache[:BooleanLiteral].has_key?(index) cached = node_cache[:BooleanLiteral][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index if has_terminal?("true", false, index) @@ -1117,11 +1159,14 @@ def _nt_AttributeOrOperation start_index = index if node_cache[:AttributeOrOperation].has_key?(index) cached = node_cache[:AttributeOrOperation][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_StringifierAttributeOrOperation @@ -1159,11 +1204,14 @@ def _nt_StringifierAttributeOrOperation start_index = index if node_cache[:StringifierAttributeOrOperation].has_key?(index) cached = node_cache[:StringifierAttributeOrOperation][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("stringifier", false, index) @@ -1267,11 +1315,14 @@ def _nt_Attribute start_index = index if node_cache[:Attribute].has_key?(index) cached = node_cache[:Attribute][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ReadOnly @@ -1351,11 +1402,14 @@ def _nt_ReadOnly start_index = index if node_cache[:ReadOnly].has_key?(index) cached = node_cache[:ReadOnly][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("readonly", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 8)) @@ -1387,11 +1441,14 @@ def _nt_GetRaises start_index = index if node_cache[:GetRaises].has_key?(index) cached = node_cache[:GetRaises][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?("getraises", false, index) @@ -1440,11 +1497,14 @@ def _nt_SetRaises start_index = index if node_cache[:SetRaises].has_key?(index) cached = node_cache[:SetRaises][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?("setraises", false, index) @@ -1497,11 +1557,14 @@ def _nt_Operation start_index = index if node_cache[:Operation].has_key?(index) cached = node_cache[:Operation][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] i1 = index @@ -1555,11 +1618,14 @@ def _nt_OmittableSpecials start_index = index if node_cache[:OmittableSpecials].has_key?(index) cached = node_cache[:OmittableSpecials][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("omittable", false, index) @@ -1607,11 +1673,14 @@ def _nt_Specials start_index = index if node_cache[:Specials].has_key?(index) cached = node_cache[:Specials][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] r2 = _nt_Special @@ -1644,11 +1713,14 @@ def _nt_Special start_index = index if node_cache[:Special].has_key?(index) cached = node_cache[:Special][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index if has_terminal?("getter", false, index) @@ -1759,11 +1831,14 @@ def _nt_OperationRest start_index = index if node_cache[:OperationRest].has_key?(index) cached = node_cache[:OperationRest][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ReturnType @@ -1849,11 +1924,14 @@ def _nt_OptionalIdentifier start_index = index if node_cache[:OptionalIdentifier].has_key?(index) cached = node_cache[:OptionalIdentifier][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end r1 = _nt_identifier if r1 @@ -1875,11 +1953,14 @@ def _nt_Raises start_index = index if node_cache[:Raises].has_key?(index) cached = node_cache[:Raises][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?("raises", false, index) @@ -1921,11 +2002,14 @@ def _nt_ExceptionList start_index = index if node_cache[:ExceptionList].has_key?(index) cached = node_cache[:ExceptionList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("(", false, index) @@ -1979,11 +2063,14 @@ def _nt_ArgumentList start_index = index if node_cache[:ArgumentList].has_key?(index) cached = node_cache[:ArgumentList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] r2 = _nt_Argument @@ -2034,11 +2121,14 @@ def _nt_Arguments start_index = index if node_cache[:Arguments].has_key?(index) cached = node_cache[:Arguments][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?(",", false, index) @@ -2131,11 +2221,14 @@ def _nt_Argument start_index = index if node_cache[:Argument].has_key?(index) cached = node_cache[:Argument][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ExtendedAttributeList @@ -2195,11 +2288,14 @@ def _nt_In start_index = index if node_cache[:In].has_key?(index) cached = node_cache[:In][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("in", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 2)) @@ -2221,11 +2317,14 @@ def _nt_Optional start_index = index if node_cache[:Optional].has_key?(index) cached = node_cache[:Optional][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("optional", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 8)) @@ -2247,11 +2346,14 @@ def _nt_Ellipsis start_index = index if node_cache[:Ellipsis].has_key?(index) cached = node_cache[:Ellipsis][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("...", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 3)) @@ -2273,11 +2375,14 @@ def _nt_ExceptionMember start_index = index if node_cache[:ExceptionMember].has_key?(index) cached = node_cache[:ExceptionMember][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_Const @@ -2319,11 +2424,14 @@ def _nt_ExceptionField start_index = index if node_cache[:ExceptionField].has_key?(index) cached = node_cache[:ExceptionField][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_Type @@ -2388,11 +2496,14 @@ def _nt_ExtendedAttributeList start_index = index if node_cache[:ExtendedAttributeList].has_key?(index) cached = node_cache[:ExtendedAttributeList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?("[", false, index) @@ -2471,11 +2582,14 @@ def _nt_ExtendedAttributes start_index = index if node_cache[:ExtendedAttributes].has_key?(index) cached = node_cache[:ExtendedAttributes][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?(",", false, index) @@ -2522,11 +2636,14 @@ def _nt_ExtendedAttribute start_index = index if node_cache[:ExtendedAttribute].has_key?(index) cached = node_cache[:ExtendedAttribute][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_ExtendedAttributeNamedArgList @@ -2570,11 +2687,14 @@ def _nt_ExtendedAttributeNoArg start_index = index if node_cache[:ExtendedAttributeNoArg].has_key?(index) cached = node_cache[:ExtendedAttributeNoArg][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end r0 = _nt_identifier r0.extend(ExtendedAttributeNoArg0) @@ -2605,11 +2725,14 @@ def _nt_ExtendedAttributeArgList start_index = index if node_cache[:ExtendedAttributeArgList].has_key?(index) cached = node_cache[:ExtendedAttributeArgList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_identifier @@ -2671,11 +2794,14 @@ def _nt_ExtendedAttributeScopedName start_index = index if node_cache[:ExtendedAttributeScopedName].has_key?(index) cached = node_cache[:ExtendedAttributeScopedName][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_identifier @@ -2720,11 +2846,14 @@ def _nt_ExtendedAttributeIdent start_index = index if node_cache[:ExtendedAttributeIdent].has_key?(index) cached = node_cache[:ExtendedAttributeIdent][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_identifier @@ -2804,11 +2933,14 @@ def _nt_ExtendedAttributeNamedArgList start_index = index if node_cache[:ExtendedAttributeNamedArgList].has_key?(index) cached = node_cache[:ExtendedAttributeNamedArgList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_identifier @@ -2883,11 +3015,14 @@ def _nt_Other start_index = index if node_cache[:Other].has_key?(index) cached = node_cache[:Other][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_integer @@ -2908,302 +3043,434 @@ else r5 = _nt_other if r5 r0 = r5 else - if has_terminal?(":", false, index) - r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) - @index += 1 + if has_terminal?("...", false, index) + r6 = instantiate_node(SyntaxNode,input, index...(index + 3)) + @index += 3 else - terminal_parse_failure(":") + terminal_parse_failure("...") r6 = nil end if r6 r0 = r6 else - if has_terminal?("::", false, index) - r7 = instantiate_node(SyntaxNode,input, index...(index + 2)) - @index += 2 + if has_terminal?(":", false, index) + r7 = instantiate_node(SyntaxNode,input, index...(index + 1)) + @index += 1 else - terminal_parse_failure("::") + terminal_parse_failure(":") r7 = nil end if r7 r0 = r7 else - if has_terminal?(";", false, index) - r8 = instantiate_node(SyntaxNode,input, index...(index + 1)) - @index += 1 + if has_terminal?("::", false, index) + r8 = instantiate_node(SyntaxNode,input, index...(index + 2)) + @index += 2 else - terminal_parse_failure(";") + terminal_parse_failure("::") r8 = nil end if r8 r0 = r8 else - if has_terminal?("<", false, index) + if has_terminal?(";", false, index) r9 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else - terminal_parse_failure("<") + terminal_parse_failure(";") r9 = nil end if r9 r0 = r9 else - if has_terminal?("=", false, index) + if has_terminal?("<", false, index) r10 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else - terminal_parse_failure("=") + terminal_parse_failure("<") r10 = nil end if r10 r0 = r10 else - if has_terminal?(">", false, index) + if has_terminal?("=", false, index) r11 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else - terminal_parse_failure(">") + terminal_parse_failure("=") r11 = nil end if r11 r0 = r11 else - if has_terminal?("DOMString", false, index) - r12 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?(">", false, index) + r12 = instantiate_node(SyntaxNode,input, index...(index + 1)) + @index += 1 else - terminal_parse_failure("DOMString") + terminal_parse_failure(">") r12 = nil end if r12 r0 = r12 else - if has_terminal?("FALSE", false, index) - r13 = instantiate_node(SyntaxNode,input, index...(index + 5)) - @index += 5 + if has_terminal?("?", false, index) + r13 = instantiate_node(SyntaxNode,input, index...(index + 1)) + @index += 1 else - terminal_parse_failure("FALSE") + terminal_parse_failure("?") r13 = nil end if r13 r0 = r13 else - if has_terminal?("Object", false, index) - r14 = instantiate_node(SyntaxNode,input, index...(index + 6)) - @index += 6 + if has_terminal?("false", false, index) + r14 = instantiate_node(SyntaxNode,input, index...(index + 5)) + @index += 5 else - terminal_parse_failure("Object") + terminal_parse_failure("false") r14 = nil end if r14 r0 = r14 else - if has_terminal?("TRUE", false, index) - r15 = instantiate_node(SyntaxNode,input, index...(index + 4)) - @index += 4 + if has_terminal?("object", false, index) + r15 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 else - terminal_parse_failure("TRUE") + terminal_parse_failure("object") r15 = nil end if r15 r0 = r15 else - if has_terminal?("any", false, index) - r16 = instantiate_node(SyntaxNode,input, index...(index + 3)) - @index += 3 + if has_terminal?("true", false, index) + r16 = instantiate_node(SyntaxNode,input, index...(index + 4)) + @index += 4 else - terminal_parse_failure("any") + terminal_parse_failure("true") r16 = nil end if r16 r0 = r16 else - if has_terminal?("attribute", false, index) - r17 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("any", false, index) + r17 = instantiate_node(SyntaxNode,input, index...(index + 3)) + @index += 3 else - terminal_parse_failure("attribute") + terminal_parse_failure("any") r17 = nil end if r17 r0 = r17 else - if has_terminal?("boolean", false, index) - r18 = instantiate_node(SyntaxNode,input, index...(index + 7)) - @index += 7 + if has_terminal?("attribute", false, index) + r18 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 else - terminal_parse_failure("boolean") + terminal_parse_failure("attribute") r18 = nil end if r18 r0 = r18 else - if has_terminal?("const", false, index) - r19 = instantiate_node(SyntaxNode,input, index...(index + 5)) - @index += 5 + if has_terminal?("boolean", false, index) + r19 = instantiate_node(SyntaxNode,input, index...(index + 7)) + @index += 7 else - terminal_parse_failure("const") + terminal_parse_failure("boolean") r19 = nil end if r19 r0 = r19 else - if has_terminal?("exception", false, index) - r20 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("caller", false, index) + r20 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 else - terminal_parse_failure("exception") + terminal_parse_failure("caller") r20 = nil end if r20 r0 = r20 else - if has_terminal?("float", false, index) + if has_terminal?("const", false, index) r21 = instantiate_node(SyntaxNode,input, index...(index + 5)) @index += 5 else - terminal_parse_failure("float") + terminal_parse_failure("const") r21 = nil end if r21 r0 = r21 else - if has_terminal?("getraises", false, index) - r22 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("creator", false, index) + r22 = instantiate_node(SyntaxNode,input, index...(index + 7)) + @index += 7 else - terminal_parse_failure("getraises") + terminal_parse_failure("creator") r22 = nil end if r22 r0 = r22 else - if has_terminal?("in", false, index) - r23 = instantiate_node(SyntaxNode,input, index...(index + 2)) - @index += 2 + if has_terminal?("deleter", false, index) + r23 = instantiate_node(SyntaxNode,input, index...(index + 7)) + @index += 7 else - terminal_parse_failure("in") + terminal_parse_failure("deleter") r23 = nil end if r23 r0 = r23 else - if has_terminal?("interface", false, index) - r24 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("double", false, index) + r24 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 else - terminal_parse_failure("interface") + terminal_parse_failure("double") r24 = nil end if r24 r0 = r24 else - if has_terminal?("long", false, index) - r25 = instantiate_node(SyntaxNode,input, index...(index + 4)) - @index += 4 + if has_terminal?("exception", false, index) + r25 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 else - terminal_parse_failure("long") + terminal_parse_failure("exception") r25 = nil end if r25 r0 = r25 else - if has_terminal?("module", false, index) - r26 = instantiate_node(SyntaxNode,input, index...(index + 6)) - @index += 6 + if has_terminal?("float", false, index) + r26 = instantiate_node(SyntaxNode,input, index...(index + 5)) + @index += 5 else - terminal_parse_failure("module") + terminal_parse_failure("float") r26 = nil end if r26 r0 = r26 else - if has_terminal?("octet", false, index) - r27 = instantiate_node(SyntaxNode,input, index...(index + 5)) - @index += 5 + if has_terminal?("getraises", false, index) + r27 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 else - terminal_parse_failure("octet") + terminal_parse_failure("getraises") r27 = nil end if r27 r0 = r27 else - if has_terminal?("raises", false, index) + if has_terminal?("getter", false, index) r28 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else - terminal_parse_failure("raises") + terminal_parse_failure("getter") r28 = nil end if r28 r0 = r28 else - if has_terminal?("sequence", false, index) - r29 = instantiate_node(SyntaxNode,input, index...(index + 8)) - @index += 8 + if has_terminal?("implements", false, index) + r29 = instantiate_node(SyntaxNode,input, index...(index + 10)) + @index += 10 else - terminal_parse_failure("sequence") + terminal_parse_failure("implements") r29 = nil end if r29 r0 = r29 else - if has_terminal?("setraises", false, index) - r30 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("in", false, index) + r30 = instantiate_node(SyntaxNode,input, index...(index + 2)) + @index += 2 else - terminal_parse_failure("setraises") + terminal_parse_failure("in") r30 = nil end if r30 r0 = r30 else - if has_terminal?("short", false, index) - r31 = instantiate_node(SyntaxNode,input, index...(index + 5)) - @index += 5 + if has_terminal?("interface", false, index) + r31 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 else - terminal_parse_failure("short") + terminal_parse_failure("interface") r31 = nil end if r31 r0 = r31 else - if has_terminal?("typedef", false, index) - r32 = instantiate_node(SyntaxNode,input, index...(index + 7)) - @index += 7 + if has_terminal?("long", false, index) + r32 = instantiate_node(SyntaxNode,input, index...(index + 4)) + @index += 4 else - terminal_parse_failure("typedef") + terminal_parse_failure("long") r32 = nil end if r32 r0 = r32 else - if has_terminal?("unsigned", false, index) - r33 = instantiate_node(SyntaxNode,input, index...(index + 8)) - @index += 8 + if has_terminal?("module", false, index) + r33 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 else - terminal_parse_failure("unsigned") + terminal_parse_failure("module") r33 = nil end if r33 r0 = r33 else - if has_terminal?("valuetype", false, index) - r34 = instantiate_node(SyntaxNode,input, index...(index + 9)) - @index += 9 + if has_terminal?("octet", false, index) + r34 = instantiate_node(SyntaxNode,input, index...(index + 5)) + @index += 5 else - terminal_parse_failure("valuetype") + terminal_parse_failure("octet") r34 = nil end if r34 r0 = r34 else - @index = i0 - r0 = nil + if has_terminal?("omittable", false, index) + r35 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 + else + terminal_parse_failure("omittable") + r35 = nil + end + if r35 + r0 = r35 + else + if has_terminal?("optional", false, index) + r36 = instantiate_node(SyntaxNode,input, index...(index + 8)) + @index += 8 + else + terminal_parse_failure("optional") + r36 = nil + end + if r36 + r0 = r36 + else + if has_terminal?("raises", false, index) + r37 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 + else + terminal_parse_failure("raises") + r37 = nil + end + if r37 + r0 = r37 + else + if has_terminal?("sequence", false, index) + r38 = instantiate_node(SyntaxNode,input, index...(index + 8)) + @index += 8 + else + terminal_parse_failure("sequence") + r38 = nil + end + if r38 + r0 = r38 + else + if has_terminal?("setraises", false, index) + r39 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 + else + terminal_parse_failure("setraises") + r39 = nil + end + if r39 + r0 = r39 + else + if has_terminal?("setter", false, index) + r40 = instantiate_node(SyntaxNode,input, index...(index + 6)) + @index += 6 + else + terminal_parse_failure("setter") + r40 = nil + end + if r40 + r0 = r40 + else + if has_terminal?("short", false, index) + r41 = instantiate_node(SyntaxNode,input, index...(index + 5)) + @index += 5 + else + terminal_parse_failure("short") + r41 = nil + end + if r41 + r0 = r41 + else + if has_terminal?("DOMString", false, index) + r42 = instantiate_node(SyntaxNode,input, index...(index + 9)) + @index += 9 + else + terminal_parse_failure("DOMString") + r42 = nil + end + if r42 + r0 = r42 + else + if has_terminal?("stringifier", false, index) + r43 = instantiate_node(SyntaxNode,input, index...(index + 11)) + @index += 11 + else + terminal_parse_failure("stringifier") + r43 = nil + end + if r43 + r0 = r43 + else + if has_terminal?("typedef", false, index) + r44 = instantiate_node(SyntaxNode,input, index...(index + 7)) + @index += 7 + else + terminal_parse_failure("typedef") + r44 = nil + end + if r44 + r0 = r44 + else + if has_terminal?("unsigned", false, index) + r45 = instantiate_node(SyntaxNode,input, index...(index + 8)) + @index += 8 + else + terminal_parse_failure("unsigned") + r45 = nil + end + if r45 + r0 = r45 + else + if has_terminal?("void", false, index) + r46 = instantiate_node(SyntaxNode,input, index...(index + 4)) + @index += 4 + else + terminal_parse_failure("void") + r46 = nil + end + if r46 + r0 = r46 + else + @index = i0 + r0 = nil + end + end + end + end + end + end + end + end + end + end + end + end end end end end end @@ -3244,11 +3511,14 @@ def _nt_OtherOrComma start_index = index if node_cache[:OtherOrComma].has_key?(index) cached = node_cache[:OtherOrComma][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_Other @@ -3273,53 +3543,79 @@ node_cache[:OtherOrComma][start_index] = r0 r0 end + module Type0 + def type + elements[0] + end + + def array + elements[1] + end + end + def _nt_Type start_index = index if node_cache[:Type].has_key?(index) cached = node_cache[:Type][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end - i0 = index - r1 = _nt_NullableType - if r1 - r0 = r1 + i0, s0 = index, [] + i1 = index + r2 = _nt_NullableType + if r2 + r1 = r2 else - r2 = _nt_ScopedName - if r2 - r0 = r2 + r3 = _nt_ScopedName + if r3 + r1 = r3 else if has_terminal?("any", false, index) - r3 = instantiate_node(SyntaxNode,input, index...(index + 3)) + r4 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure("any") - r3 = nil + r4 = nil end - if r3 - r0 = r3 + if r4 + r1 = r4 else if has_terminal?("object", false, index) - r4 = instantiate_node(SyntaxNode,input, index...(index + 6)) + r5 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure("object") - r4 = nil + r5 = nil end - if r4 - r0 = r4 + if r5 + r1 = r5 else - @index = i0 - r0 = nil + @index = i1 + r1 = nil end end end end + s0 << r1 + if r1 + r6 = _nt_OptionalArray + s0 << r6 + end + if s0.last + r0 = instantiate_node(ParseTree::Type,input, i0...index, s0) + r0.extend(Type0) + else + @index = i0 + r0 = nil + end node_cache[:Type][start_index] = r0 r0 end @@ -3418,11 +3714,14 @@ def _nt_NullableType start_index = index if node_cache[:NullableType].has_key?(index) cached = node_cache[:NullableType][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index i1, s1 = index, [] @@ -3709,11 +4008,14 @@ def _nt_UnsignedIntegerType start_index = index if node_cache[:UnsignedIntegerType].has_key?(index) cached = node_cache[:UnsignedIntegerType][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index i1, s1 = index, [] @@ -3769,11 +4071,14 @@ def _nt_IntegerType start_index = index if node_cache[:IntegerType].has_key?(index) cached = node_cache[:IntegerType][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index if has_terminal?("short", false, index) @@ -3825,11 +4130,14 @@ def _nt_OptionalLong start_index = index if node_cache[:OptionalLong].has_key?(index) cached = node_cache[:OptionalLong][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("long", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 4)) @@ -3851,11 +4159,14 @@ def _nt_Nullable start_index = index if node_cache[:Nullable].has_key?(index) cached = node_cache[:Nullable][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?("?", false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @@ -3873,18 +4184,50 @@ node_cache[:Nullable][start_index] = r0 r0 end + def _nt_OptionalArray + start_index = index + if node_cache[:OptionalArray].has_key?(index) + cached = node_cache[:OptionalArray][index] + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end + return cached + end + + if has_terminal?("[]", false, index) + r1 = instantiate_node(SyntaxNode,input, index...(index + 2)) + @index += 2 + else + terminal_parse_failure("[]") + r1 = nil + end + if r1 + r0 = r1 + else + r0 = instantiate_node(SyntaxNode,input, index...index) + end + + node_cache[:OptionalArray][start_index] = r0 + + r0 + end + module NonSpace0 end def _nt_NonSpace start_index = index if node_cache[:NonSpace].has_key?(index) cached = node_cache[:NonSpace][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] i1 = index @@ -3927,11 +4270,14 @@ def _nt_ReturnType start_index = index if node_cache[:ReturnType].has_key?(index) cached = node_cache[:ReturnType][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_Type @@ -3974,11 +4320,14 @@ def _nt_ScopedNameList start_index = index if node_cache[:ScopedNameList].has_key?(index) cached = node_cache[:ScopedNameList][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_ScopedName @@ -4020,11 +4369,14 @@ def _nt_ScopedNames start_index = index if node_cache[:ScopedNames].has_key?(index) cached = node_cache[:ScopedNames][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?(",", false, index) @@ -4067,11 +4419,14 @@ def _nt_ScopedName start_index = index if node_cache[:ScopedName].has_key?(index) cached = node_cache[:ScopedName][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index r1 = _nt_AbsoluteScopedName @@ -4104,11 +4459,14 @@ def _nt_AbsoluteScopedName start_index = index if node_cache[:AbsoluteScopedName].has_key?(index) cached = node_cache[:AbsoluteScopedName][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("::", false, index) @@ -4152,11 +4510,14 @@ def _nt_RelativeScopedName start_index = index if node_cache[:RelativeScopedName].has_key?(index) cached = node_cache[:RelativeScopedName][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] r1 = _nt_identifier @@ -4194,11 +4555,14 @@ def _nt_ScopedNameParts start_index = index if node_cache[:ScopedNameParts].has_key?(index) cached = node_cache[:ScopedNameParts][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1, s1 = index, [] if has_terminal?("::", false, index) @@ -4254,11 +4618,14 @@ def _nt_integer start_index = index if node_cache[:integer].has_key?(index) cached = node_cache[:integer][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index i1, s1 = index, [] @@ -4431,11 +4798,14 @@ def _nt_float start_index = index if node_cache[:float].has_key?(index) cached = node_cache[:float][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0 = index i1, s1 = index, [] @@ -4749,11 +5119,14 @@ def _nt_identifier start_index = index if node_cache[:identifier].has_key?(index) cached = node_cache[:identifier][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?('\G[A-Z_a-z]', true, index) @@ -4800,11 +5173,14 @@ def _nt_string start_index = index if node_cache[:string].has_key?(index) cached = node_cache[:string][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("\"", false, index) @@ -4864,11 +5240,14 @@ def _nt_ws start_index = index if node_cache[:ws].has_key?(index) cached = node_cache[:ws][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i1 = index i2, s2 = index, [] @@ -4995,11 +5374,14 @@ def _nt_other start_index = index if node_cache[:other].has_key?(index) cached = node_cache[:other][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end if has_terminal?('\G[^\\t\\n\\r 0-9A-Z_a-z]', true, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @@ -5021,11 +5403,14 @@ def _nt_line_comment start_index = index if node_cache[:line_comment].has_key?(index) cached = node_cache[:line_comment][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?("//", false, index) @@ -5101,10 +5486,13 @@ def _nt_block_comment start_index = index if node_cache[:block_comment].has_key?(index) cached = node_cache[:block_comment][index] - @index = cached.interval.end if cached + if cached + cached = SyntaxNode.new(input, index...(index + 1)) if cached == true + @index = cached.interval.end + end return cached end i0, s0 = index, [] if has_terminal?('/*', false, index)