Pegmatite
 All Classes Functions Variables Enumerations
Static Public Member Functions | Public Attributes | List of all members
Parser::CellAtomGrammar Struct Reference

Singleton class encapsulating the grammar for the CellAtom language. More...

#include <parser.hh>

Collaboration diagram for Parser::CellAtomGrammar:
Collaboration graph
[legend]

Static Public Member Functions

static const CellAtomGrammarget ()
 Returns a singleton instance of this grammar.
 

Public Attributes

Rule whitespace = ' '_E | '\t' | nl('\n')
 Whitespace: spaces, tabs, newlines.
 
Rule comment
 Comments, including tracking newlines inside comments via the whitespace rule. More...
 
Rule ignored = *(comment | whitespace)
 Rule for treating both comments and whitespace as ignored tokens.
 
Rule digit = '0'_E - '9'
 Decimal digits.
 
Rule literal = +digit
 Literal values are one or more digits.
 
Rule v_reg = 'v'_E
 The current-value register v.
 
Rule local_reg = 'a' >> digit
 Local registers, l0 to l9.
 
Rule global_reg = 'g' >> digit
 Global registers, g0 to g9.
 
Rule reg = v_reg | local_reg | global_reg
 Any register.
 
Rule op = '+'_E | '=' |'-' | '*' | '/' | "min" | "max"
 Operation keywords.
 
Rule arithmetic = op >> reg >> expression
 Arithmetic statements are an operation, a target register, and an expression.
 
Rule neighbours = "neighbours"_E >> '(' >> statements >> ')'
 Neighbours expressions are simple a keyword and then a statement list in brackets.
 
Rule range = literal | ('('_E >> literal >> ',' >> literal >> ')')
 The range part of a range expression (either a single value or an inclusive range).
 
Rule range_expr = range >> "=>" >> expression
 A single entry in a range map: the source range and the target expression.
 
Rule range_map
 A range map, evaluating to a different expression depending on the value in the register argument. More...
 
Rule expression = literal | reg | range_map
 Valid expressions in this language are.
 
Rule statement = neighbours | arithmetic
 Valid statements in this language are the arithmetic statements or neighbours statements.
 
Rule statements = *statement
 List of zero or more statements.
 

Detailed Description

Singleton class encapsulating the grammar for the CellAtom language.

Definition at line 35 of file parser.hh.

Member Data Documentation

Rule Parser::CellAtomGrammar::comment
Initial value:
= '"' >>
(*(!ExprPtr('"'_E) >> (nl('\n') | any()))) >>
'"'

Comments, including tracking newlines inside comments via the whitespace rule.

Definition at line 45 of file parser.hh.

Rule Parser::CellAtomGrammar::range_map
Initial value:
= '['_E >> reg >> '|' >>
+range_expr >> *(','_E >> range_expr) >>']'

A range map, evaluating to a different expression depending on the value in the register argument.

Definition at line 104 of file parser.hh.


The documentation for this struct was generated from the following file: