Sha256: 01e6593292bf471daff50c17025cd0862dedb2126e9a3628ddb7694e4583afa4

Contents?: true

Size: 1.06 KB

Versions: 31

Compression:

Stored size: 1.06 KB

Contents

# @SugarCube
module Opulent
  # @Parser
  module Parser
    # @Text
    module Evaluate
      # Match one line or multiline, escaped or unescaped text
      #
      def evaluate(parent)
        indent = indent || accept_unstripped(:indent) || ""

        # Accept eval or multiline eval syntax and return a new node,
        if (evaluate = accept_unstripped(:eval))
          eval_node = @create.evaluate(evaluate.strip, parent, indent.size)
          accept_unstripped :newline
        elsif (evaluate = accept_unstripped(:eval_multiline))
          # Get all the lines which are more indented than the current one
          eval_node = @create.evaluate(evaluate.strip, parent, indent.size)
          eval_node.value += accept_unstripped(:newline) || ""
          eval_node.value += get_indented_lines(indent.size)
        end

        if eval_node
          # Return the found eval node
          return eval_node
        else
          # Undo by adding the found intentation back
          return undo indent
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
opulent-1.5.5 .libold/opulent/parser/eval.rb
opulent-1.5.4 .libold/opulent/parser/eval.rb
opulent-1.5.3 .libold/opulent/parser/eval.rb
opulent-1.5.2 .libold/opulent/parser/eval.rb
opulent-1.5.1 .libold/opulent/parser/eval.rb
opulent-1.5.0 .libold/opulent/parser/eval.rb
opulent-1.4.8 .libold/opulent/parser/eval.rb
opulent-1.4.7 .libold/opulent/parser/eval.rb
opulent-1.4.6 .libold/opulent/parser/eval.rb
opulent-1.4.5 .libold/opulent/parser/eval.rb
opulent-1.4.3 .libold/opulent/parser/eval.rb
opulent-1.4.2 .libold/opulent/parser/eval.rb
opulent-1.4.1 .libold/opulent/parser/eval.rb
opulent-1.4.0 .libold/opulent/parser/eval.rb
opulent-1.3.3 .libold/opulent/parser/eval.rb
opulent-1.3.2 .libold/opulent/parser/eval.rb
opulent-1.3.1 .libold/opulent/parser/eval.rb
opulent-1.3.0 .libold/opulent/parser/eval.rb
opulent-1.2.1 .libold/opulent/parser/eval.rb
opulent-1.2.0 .libold/opulent/parser/eval.rb