Sha256: 01e3618e2d933eca2ad3bf8b72b089b4d34a22218a573c3379fc3f2d35ce7bab

Contents?: true

Size: 753 Bytes

Versions: 7

Compression:

Stored size: 753 Bytes

Contents

# @Opulent
module Opulent
  # @Parser
  class Parser
    # Match one line or multiline comments
    #
    def comment(parent, indent)
      if (accept :comment)
        multiline = true if (accept :comment)

        buffer = accept(:line_feed)
        buffer += accept(:newline) || ""
        buffer += get_indented_lines indent if multiline


        # If we have a comment which is visible in the output, we will
        # create a new comment element. Otherwise, we ignore the current
        # gathered text and we simply begin the root parsing again
        if buffer[0] == '!'
          parent[@children] << [:comment, buffer[1..-1].strip, {}, nil, indent]
        end

        return parent
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opulent-1.1.0 lib/opulent/parser/comment.rb
opulent-1.0.9 lib/opulent/parser/comment.rb
opulent-1.0.8 lib/opulent/parser/comment.rb
opulent-1.0.7 lib/opulent/parser/comment.rb
opulent-1.0.4 lib/opulent/parser/comment.rb
opulent-1.0.3 lib/opulent/parser/comment.rb
opulent-1.0.2 lib/opulent/parser/comment.rb