Class: Decode::Language::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/decode/language/generic.rb

Overview

The Ruby language.

Direct Known Subclasses

Ruby::Generic

Constant Summary collapse

EXTENSIONS =
[]
TAGS =
Comment::Tags.build do |tags|
	tags['attribute'] = Comment::Attribute
	tags['parameter'] = Comment::Parameter
	tags['yields'] = Comment::Yields
	tags['returns'] = Comment::Returns
	tags['raises'] = Comment::Raises
	tags['throws'] = Comment::Throws
	
	tags['deprecated'] = Comment::Pragma
	
	tags['asynchronous'] = Comment::Pragma
	
	tags['public'] = Comment::Pragma
	tags['private'] = Comment::Pragma
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS) ⇒ Generic

Returns a new instance of Generic.



31
32
33
34
35
# File 'lib/decode/language/generic.rb', line 31

def initialize(name, extensions: self.class::EXTENSIONS, tags: self.class::TAGS)
	@name = name
	@extensions = extensions
	@tags = tags
end

Instance Attribute Details

#extensionsObject (readonly)

Returns the value of attribute extensions.



43
44
45
# File 'lib/decode/language/generic.rb', line 43

def extensions
  @extensions
end

#nameObject (readonly)

Returns the value of attribute name.



37
38
39
# File 'lib/decode/language/generic.rb', line 37

def name
  @name
end

#tagsObject (readonly)

Returns the value of attribute tags.



45
46
47
# File 'lib/decode/language/generic.rb', line 45

def tags
  @tags
end

Instance Method Details

#definitions_for(source, &block) ⇒ Object

Parse the input yielding definitions.



62
63
64
65
66
# File 'lib/decode/language/generic.rb', line 62

def definitions_for(source, &block)
	if parser = self.parser
		parser.definitions_for(source, &block)
	end
end

#namesObject



39
40
41
# File 'lib/decode/language/generic.rb', line 39

def names
	[@name]
end

#parserObject



53
54
55
# File 'lib/decode/language/generic.rb', line 53

def parser
	nil
end

#reference_for(identifier) ⇒ Object

Generate a language-specific reference.



49
50
51
# File 'lib/decode/language/generic.rb', line 49

def reference_for(identifier)
	Reference.new(identifier, self)
end

#segments_for(source, &block) ⇒ Object

Parse the input yielding segments. Segments are constructed from a block of top level comments followed by a block of code.



74
75
76
77
78
# File 'lib/decode/language/generic.rb', line 74

def segments_for(source, &block)
	if parser = self.parser
		parser.segments_for(source, &block)
	end
end