Sha256: f68f2e1f13178cbdd3f7f715fcb60e49893938c8c54bbd64991ce02fed74f708
Contents?: true
Size: 904 Bytes
Versions: 29
Compression:
Stored size: 904 Bytes
Contents
# Author:: Eric Crane (mailto:eric.crane@mac.com) # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved. # # An Operator; part of an expression. # A static helper class. # module GlooLang module Core class Op # # Is the token an operator? # def self.op?( token ) return [ '+', '-', '*', '/' ].include?( token.strip ) end # # Create the operator for the given token. # def self.create_op( token ) return GlooLang::Expr::OpMinus.new if token == '-' return GlooLang::Expr::OpMult.new if token == '*' return GlooLang::Expr::OpDiv.new if token == '/' return GlooLang::Expr::OpPlus.new if token == '+' return default_op end # # Get the default operator (+). # def self.default_op return GlooLang::Expr::OpPlus.new end end end end
Version data entries
29 entries across 29 versions & 1 rubygems