Class: NCPP::Parser
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- NCPP::Parser
- Defined in:
- lib/ncpp/parser.rb
Overview
Parses raw text into a tree
Instance Method Summary collapse
-
#initialize(cmd_prefix: 'ncpp_') ⇒ Parser
constructor
A new instance of Parser.
- #parse(str, root: :line) ⇒ Object
- #spaced(atom) ⇒ Object
Constructor Details
#initialize(cmd_prefix: 'ncpp_') ⇒ Parser
Returns a new instance of Parser.
10 11 12 |
# File 'lib/ncpp/parser.rb', line 10 def initialize(cmd_prefix: 'ncpp_') @COMMAND_PREFIX = cmd_prefix end |
Instance Method Details
#parse(str, root: :line) ⇒ Object
14 15 16 |
# File 'lib/ncpp/parser.rb', line 14 def parse(str, root: :line) send(root).parse(str) end |
#spaced(atom) ⇒ Object
116 117 118 |
# File 'lib/ncpp/parser.rb', line 116 def spaced(atom) space? >> atom >> space? end |