def expression(allow_assignments = true, wrapped = true, whitespace = true)
      buffer = ''

      # Build a ruby expression out of accepted literals
      while (term = (whitespace ? accept(:whitespace) : nil) ||
                    modifier ||
                    identifier ||
                    method_call ||
                    paranthesis ||
                    array ||
                    hash ||
                    symbol ||
                    percent ||
                    primary_term)
        buffer += term

        # Accept operations which have a right term and raise an error if
        # we have an unfinished expression such as "a +", "b - 1 >" and other
        # expressions following the same pattern
        if wrapped && (op = operation ||
          (allow_assignments ? accept_stripped(:exp_assignment) : nil))

          buffer += op
          if (right_term = expression(allow_assignments, wrapped)).nil?
            Logger.error :parse, @code, @i, @j, :expression
          else
            buffer += right_term[@value]
          end
        elsif (op = array || op = method_call || op = ternary_operator(allow_assignments, wrapped))
          buffer += op
        end

        # Do not continue if the expression has whitespace method calls in
        # an unwrapped context because this will confuse the parser
        unless buffer.strip.empty?
          break if lookahead(:exp_identifier_lookahead).nil?
        end
      end

      if buffer.strip.empty?
        undo buffer
      else
        [:expression, buffer.strip, {}]
      end
    end
def expression(allow_assignments = true, wrapped = true, whitespace = true)
      buffer = ''

      # Build a ruby expression out of accepted literals
      while (term = (whitespace ? accept(:whitespace) : nil) ||
                    modifier ||
                    identifier ||
                    method_call ||
                    paranthesis ||
                    array ||
                    hash ||
                    symbol ||
                    percent ||
                    primary_term)
        buffer += term

        # Accept operations which have a right term and raise an error if
        # we have an unfinished expression such as "a +", "b - 1 >" and other
        # expressions following the same pattern
        if wrapped && (op = operation ||
          (allow_assignments ? accept_stripped(:exp_assignment) : nil))

          buffer += op
          if (right_term = expression(allow_assignments, wrapped)).nil?
            Logger.error :parse, @code, @i, @j, :expression
          else
            buffer += right_term[@value]
          end
        elsif (op = array || op = method_call || op = ternary_operator(allow_assignments, wrapped))
          buffer += op
        end

        # Do not continue if the expression has whitespace method calls in
        # an unwrapped context because this will confuse the parser
        unless buffer.strip.empty?
          break if lookahead(:exp_identifier_lookahead).nil?
        end
      end

      if buffer.strip.empty?
        undo buffer
      else
        [:expression, buffer.strip, {}]
      end
    end
Check if the parser matches an expression node