Sha256: c7fc1a244b5b28c77432aa1715d69c08316dea5f5c0c1a8e99f06deacc6cb50e
Contents?: true
Size: 1.03 KB
Versions: 31
Compression:
Stored size: 1.03 KB
Contents
# @Opulent module Opulent # @Parser module Parser # @Define module Define # Match a definition node with its parameters and body # # def node_name[ parameters ] # body nodes # # @param parent [Node] Parent node to which we append the definition # def define(parent) if lookahead :def_lookahead # Get current line's indentation indent = accept_unstripped(:indent) || "" if accept :def # Get definition name def_name = accept :identifier, :* # Get element attributes atts = attributes({}) || {} # Create a new node node = @create.definition def_name.to_sym, atts, parent, indent.size # Consume the newline from the end of the element error :define unless accept_unstripped(:line_feed).strip.empty? accept_unstripped :newline return node end end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems