soml-parser/lib/parser/operators.rb

16 lines
475 B
Ruby

module Parser
module Operators
include Parslet
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) }
end
end