Class: AsciiChem::Grammar
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- AsciiChem::Grammar
- Defined in:
- lib/asciichem/grammar.rb
Overview
Parslet grammar for AsciiChem v1.
Design notes:
- Leaf rules return strings;
.as(:name)is applied at the combination site so the parse tree is a flat hash of named strings wherever practical. - The prefix-isotope binding (
^14C) is enforced structurally: theprefixed_atomproduction consumes^digits elementas a unit. A bare^digitswithout an element is rejected. - Marker rules (
subscript_marker,superscript_marker) capture ONLY the value, not the leading_or^. The literal prefix is consumed by the rule but not included in the named capture.