lib/code/parser/list.rb in code-ruby-0.5.6 vs lib/code/parser/list.rb in code-ruby-0.6.0
- old
+ new
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
class Code
class Parser
class List < Language
def code
- ::Code::Parser::Code.new.present
+ Code.new.present
end
def whitespace
- ::Code::Parser::Whitespace
+ Whitespace
end
def whitespace?
whitespace.maybe
end
@@ -30,13 +32,12 @@
end
def root
(
opening_square_bracket.ignore << whitespace? <<
- element.repeat(0, 1) <<
- (whitespace? << comma << whitespace? << element).repeat <<
+ (whitespace? << element << (whitespace? << comma).maybe).repeat <<
(whitespace? << closing_square_bracket.ignore).maybe
- ).aka(:list) | ::Code::Parser::String
+ ).aka(:list) | String
end
end
end
end