Skip to content

Commit

Permalink
Adding spaces to expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
cassiano committed Dec 20, 2011
1 parent ca3f292 commit eb2bbe3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tt_ruby/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def eval(context)
end
end

Context = Struct.new(:current_self, :locals)
@context = Context.new(nil, {})
Context = Struct.new(:current_self, :current_class, :locals, :constants)
@context = Context.new(self, self.class, {}, {})

@parser = RubyParser.new
8 changes: 6 additions & 2 deletions tt_ruby/ruby.treetop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ grammar Ruby
end

rule expressions
expression others:(terminator expression)* <ExpressionsNode>
spaces expression spaces others:(terminator spaces expression spaces)* <ExpressionsNode>
end

rule expression
Expand All @@ -15,6 +15,10 @@ grammar Ruby
assignment
end

rule spaces
' '*
end

rule terminator
newline
/
Expand Down Expand Up @@ -72,7 +76,7 @@ grammar Ruby
end

rule assignment
identifier '=' expression <AssignmentNode>
identifier spaces '=' spaces expression <AssignmentNode>
end

rule identifier
Expand Down

0 comments on commit eb2bbe3

Please sign in to comment.