DecodeSourceDecodeCommentTag

class Tag

Represents a documentation tag parsed from a comment directive.

Definitions

def self.match(text)

Match text against the tag pattern.

Signature

parameter text String

The text to match.

Implementation

def self.match(text)
	self::PATTERN.match(text)
end

def self.parse(directive, text, lines, tags, level = 0)

Parse a tag from a directive and text.

Signature

parameter directive String

The directive name.

parameter text String

The directive text.

parameter lines Array(String)

The remaining lines.

parameter tags Tags

The tags parser.

parameter level Integer

The indentation level.

Implementation

def self.parse(directive, text, lines, tags, level = 0)
	if match = self.match(text)
		node = self.build(directive, match)
		
		tags.parse(lines, level + 1) do |child|
			node.add(child)
		end
		
		return node
	else
		# Consume all nested nodes:
		tags.ignore(lines, level + 1)
	end
end

def initialize(directive)

Initialize a new tag.

Signature

parameter directive String

The directive that generated the tag.

Implementation

def initialize(directive)
	@directive = directive
end

attr :directive

Signature

attribute String

The directive that generated the tag.