leaving the name for field defs
so we can reuse that expression so we can highlight it in the debugger
This commit is contained in:
parent
335a6b1e37
commit
6ae4b624b0
@ -25,9 +25,10 @@ module Parser
|
||||
rule(:integer => simple(:value)) { s(:int ,value.to_i) }
|
||||
rule(:name => simple(:name)) { s(:name , name.to_sym) }
|
||||
# local variables
|
||||
rule(:type => simple(:type), :name => simple(:name)) { s(:field_def , type_sym(type) , name.to_sym) }
|
||||
rule(:type => simple(:type), :name => simple(:name)) {
|
||||
s(:field_def , type_sym(type) , s(:name , name.to_sym)) }
|
||||
rule(:type => simple(:type), :name => simple(:name) , :value => simple(:value)) {
|
||||
s(:field_def , type_sym(type) , name.to_sym , value ) }
|
||||
s(:field_def , type_sym(type) , s(:name , name.to_sym) , value ) }
|
||||
# class field
|
||||
rule(:field => simple(:field) , :type => simple(:type), :name => simple(:name)) {
|
||||
s(:class_field , type_sym(type) , name.to_sym) }
|
||||
@ -88,7 +89,7 @@ module Parser
|
||||
s(:return , return_statement)
|
||||
end
|
||||
|
||||
rule(:parameter => simple(:parameter)) { s(:parameter , *parameter) }
|
||||
rule(:parameter => simple(:parameter)) { s(:parameter , parameter.children[0] , parameter.children[1].children[0]) }
|
||||
|
||||
# Also two rules for function definitions, unqualified and qualified
|
||||
rule(:type => simple(:type) ,
|
||||
|
@ -14,7 +14,8 @@ s(:statements,
|
||||
s(:parameters,
|
||||
s(:parameter, :Integer, :x)),
|
||||
s(:statements,
|
||||
s(:field_def, :Integer, :abba,
|
||||
s(:field_def, :Integer,
|
||||
s(:name, :abba),
|
||||
s(:int, 5)),
|
||||
s(:return,
|
||||
s(:operator_value, :+,
|
||||
|
@ -9,7 +9,8 @@ s(:statements,
|
||||
s(:parameters,
|
||||
s(:parameter, :Integer, :x)),
|
||||
s(:statements,
|
||||
s(:field_def, :Integer, :a,
|
||||
s(:field_def, :Integer,
|
||||
s(:name, :a),
|
||||
s(:int, 5)),
|
||||
s(:return,
|
||||
s(:name, :a)))))
|
||||
|
@ -9,7 +9,8 @@ s(:statements,
|
||||
s(:parameters,
|
||||
s(:parameter, :Integer, :x)),
|
||||
s(:statements,
|
||||
s(:field_def, :Integer, :abba,
|
||||
s(:field_def, :Integer,
|
||||
s(:name, :abba),
|
||||
s(:int, 5)),
|
||||
s(:assignment,
|
||||
s(:name, :abba),
|
||||
|
@ -9,7 +9,8 @@ s(:statements,
|
||||
s(:parameters,
|
||||
s(:parameter, :Object, :n)),
|
||||
s(:statements,
|
||||
s(:field_def, :Integer, :i,
|
||||
s(:field_def, :Integer,
|
||||
s(:name, :i),
|
||||
s(:field_access,
|
||||
s(:receiver,
|
||||
s(:name, :n)),
|
||||
|
Loading…
Reference in New Issue
Block a user