Class: Textpow::SyntaxNode
- Inherits:
-
Object
- Object
- Textpow::SyntaxNode
- Defined in:
- lib/textpow/syntax.rb
Constant Summary collapse
- @@syntaxes =
{}
Instance Attribute Summary collapse
-
#begin ⇒ Object
Returns the value of attribute begin.
-
#beginCaptures ⇒ Object
Returns the value of attribute beginCaptures.
-
#captures ⇒ Object
Returns the value of attribute captures.
-
#content ⇒ Object
Returns the value of attribute content.
-
#contentName ⇒ Object
Returns the value of attribute contentName.
-
#end ⇒ Object
Returns the value of attribute end.
-
#endCaptures ⇒ Object
Returns the value of attribute endCaptures.
-
#fileTypes ⇒ Object
Returns the value of attribute fileTypes.
-
#firstLineMatch ⇒ Object
Returns the value of attribute firstLineMatch.
-
#foldingStartMarker ⇒ Object
Returns the value of attribute foldingStartMarker.
-
#foldingStopMarker ⇒ Object
Returns the value of attribute foldingStopMarker.
-
#keyEquivalent ⇒ Object
Returns the value of attribute keyEquivalent.
-
#match ⇒ Object
Returns the value of attribute match.
-
#name ⇒ Object
Returns the value of attribute name.
-
#patterns ⇒ Object
Returns the value of attribute patterns.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#scopeName ⇒ Object
Returns the value of attribute scopeName.
-
#syntax ⇒ Object
Returns the value of attribute syntax.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(table, options = {}) ⇒ SyntaxNode
constructor
A new instance of SyntaxNode.
- #parse(string, processor = RecordingProcessor.new) ⇒ Object
- #syntaxes ⇒ Object
Constructor Details
#initialize(table, options = {}) ⇒ SyntaxNode
Returns a new instance of SyntaxNode.
64 65 66 67 68 69 70 |
# File 'lib/textpow/syntax.rb', line 64 def initialize(table, ={}) @syntax = [:syntax] || self @name_space = [:name_space] register_in_syntaxes(table["scopeName"]) parse_and_store_syntax_info(table) end |
Instance Attribute Details
#begin ⇒ Object
Returns the value of attribute begin.
45 46 47 |
# File 'lib/textpow/syntax.rb', line 45 def begin @begin end |
#beginCaptures ⇒ Object
Returns the value of attribute beginCaptures.
54 55 56 |
# File 'lib/textpow/syntax.rb', line 54 def beginCaptures @beginCaptures end |
#captures ⇒ Object
Returns the value of attribute captures.
53 54 55 |
# File 'lib/textpow/syntax.rb', line 53 def captures @captures end |
#content ⇒ Object
Returns the value of attribute content.
46 47 48 |
# File 'lib/textpow/syntax.rb', line 46 def content @content end |
#contentName ⇒ Object
Returns the value of attribute contentName.
49 50 51 |
# File 'lib/textpow/syntax.rb', line 49 def contentName @contentName end |
#end ⇒ Object
Returns the value of attribute end.
50 51 52 |
# File 'lib/textpow/syntax.rb', line 50 def end @end end |
#endCaptures ⇒ Object
Returns the value of attribute endCaptures.
55 56 57 |
# File 'lib/textpow/syntax.rb', line 55 def endCaptures @endCaptures end |
#fileTypes ⇒ Object
Returns the value of attribute fileTypes.
47 48 49 |
# File 'lib/textpow/syntax.rb', line 47 def fileTypes @fileTypes end |
#firstLineMatch ⇒ Object
Returns the value of attribute firstLineMatch.
41 42 43 |
# File 'lib/textpow/syntax.rb', line 41 def firstLineMatch @firstLineMatch end |
#foldingStartMarker ⇒ Object
Returns the value of attribute foldingStartMarker.
42 43 44 |
# File 'lib/textpow/syntax.rb', line 42 def foldingStartMarker @foldingStartMarker end |
#foldingStopMarker ⇒ Object
Returns the value of attribute foldingStopMarker.
43 44 45 |
# File 'lib/textpow/syntax.rb', line 43 def foldingStopMarker @foldingStopMarker end |
#keyEquivalent ⇒ Object
Returns the value of attribute keyEquivalent.
52 53 54 |
# File 'lib/textpow/syntax.rb', line 52 def keyEquivalent @keyEquivalent end |
#match ⇒ Object
Returns the value of attribute match.
44 45 46 |
# File 'lib/textpow/syntax.rb', line 44 def match @match end |
#name ⇒ Object
Returns the value of attribute name.
48 49 50 |
# File 'lib/textpow/syntax.rb', line 48 def name @name end |
#patterns ⇒ Object
Returns the value of attribute patterns.
57 58 59 |
# File 'lib/textpow/syntax.rb', line 57 def patterns @patterns end |
#repository ⇒ Object
Returns the value of attribute repository.
56 57 58 |
# File 'lib/textpow/syntax.rb', line 56 def repository @repository end |
#scopeName ⇒ Object
Returns the value of attribute scopeName.
51 52 53 |
# File 'lib/textpow/syntax.rb', line 51 def scopeName @scopeName end |
#syntax ⇒ Object
Returns the value of attribute syntax.
40 41 42 |
# File 'lib/textpow/syntax.rb', line 40 def syntax @syntax end |
Class Method Details
.load(file, options = {}) ⇒ Object
59 60 61 62 |
# File 'lib/textpow/syntax.rb', line 59 def self.load(file, ={}) table = convert_file_to_table(file) SyntaxNode.new(table, ) end |
Instance Method Details
#parse(string, processor = RecordingProcessor.new) ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/textpow/syntax.rb', line 76 def parse(string, processor = RecordingProcessor.new) processor.start_parsing scopeName stack = [[self, nil]] string.each_line do |line| parse_line stack, line, processor end processor.end_parsing scopeName processor end |
#syntaxes ⇒ Object
72 73 74 |
# File 'lib/textpow/syntax.rb', line 72 def syntaxes @@syntaxes[@name_space] end |