2014-06-04 18:55:04 +02:00
|
|
|
module Parser
|
|
|
|
module Operators
|
|
|
|
include Parslet
|
2015-09-15 17:57:31 +02:00
|
|
|
|
2015-10-09 16:25:09 +02:00
|
|
|
rule(:operator_sym) {
|
|
|
|
str('**') | str('*') | str('/') | str('/') | str('%') |
|
|
|
|
str('+') | str('-') | str('<<')| str('>>') |
|
|
|
|
str('|') | str('&') |
|
|
|
|
str('>=') | str('<=') | str('>') | str('<') |
|
|
|
|
str('==') | str('!=') }
|
|
|
|
|
|
|
|
rule(:operator_value) { (field_access|basic_type).as(:left) >>
|
|
|
|
operator_sym.as(:operator) >> space? >> (field_access|basic_type).as(:right) }
|
2014-06-04 18:55:04 +02:00
|
|
|
end
|
|
|
|
end
|