lib/webidl/parser/idl.treetop in webidl-0.0.6 vs lib/webidl/parser/idl.treetop in webidl-0.0.7

- old
+ new

@@ -278,11 +278,11 @@ rule Type type:( NullableType / ScopedName / "any" # not sure why these two are here, since / "object" # they will be caught by ScopedName anyway.. - ) array:OptionalArray <ParseTree::Type> + ) array:Array <ParseTree::Type> end # # added: cannot be followed by a NonSpace character, since e.g. DOMStringMap would break parsing # @@ -311,15 +311,11 @@ rule Nullable "?"? end - # - # added: can't find anything about this in the spec's LL grammar - # - - rule OptionalArray + rule Array "[]"? end rule NonSpace (!' ' .) @@ -352,18 +348,30 @@ rule ScopedNameParts ("::" ws name:identifier parts:ScopedNameParts)? end rule integer - ("-"? "0" ([0-7]* / [Xx] [0-9A-Fa-f]+) / [1-9] [0-9]*) { def build() Integer(text_value) end} # TODO: check edge cases + (hexint / octint / decint) { def build() Integer(text_value) end} # TODO: check edge cases end + rule hexint + "-"? "0" [Xx] [0-9A-Fa-f]+ + end + + rule octint + "-"? "0" [0-7]+ + end + + rule decint + "-"? [0-9]* + end + rule float ("-"? ([0-9]+ "." [0-9]* / [0-9]* "." [0-9]+) ([Ee] [+-]? [0-9]+)? / [0-9]+ [Ee] [+-]? [0-9]+) { def build() Float(text_value) end} # TODO: check edge cases end rule identifier - [A-Z_a-z] [0-9A-Z_a-z]* { def build() text_value[/^_?(.+)/, 1] end} + [A-Z_a-z] [0-9A-Z_a-z]* { def build() text_value[/^_?(.+)/, 1] end } end rule string "\"" [^"]* "\"" end