Class: Stockade::Parser
- Inherits:
-
Object
- Object
- Stockade::Parser
- Extended by:
- Memoist
- Defined in:
- lib/stockade/parser.rb
Overview
Parser
Takes a raw list (a set really) of lexemes returned by Lexer and further processes them. Currently this means:
-
Deduping - >1 ambiguous lexemes matching exactly same fragment are deduped according to their priority. Only the highest priority lexeme kept.
-
Removing covered lexems - lexeme that matches a string that is a
substring of another matched string is removed.
Instance Attribute Summary collapse
-
#lexemes ⇒ Object
readonly
Returns the value of attribute lexemes.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(lexemes) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(lexemes) ⇒ Parser
Returns a new instance of Parser.
19 20 21 |
# File 'lib/stockade/parser.rb', line 19 def initialize(lexemes) @lexemes = lexemes end |
Instance Attribute Details
#lexemes ⇒ Object (readonly)
Returns the value of attribute lexemes.
17 18 19 |
# File 'lib/stockade/parser.rb', line 17 def lexemes @lexemes end |
Class Method Details
.call(lexemes) ⇒ Object
23 24 25 |
# File 'lib/stockade/parser.rb', line 23 def self.call(lexemes) new(lexemes).call end |
Instance Method Details
#call ⇒ Object
27 28 29 |
# File 'lib/stockade/parser.rb', line 27 def call non_covered_lexemes end |