diff options
| author | bjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu> | 2017-04-12 10:45:46 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu> | 2017-04-12 10:45:46 -0400 |
| commit | 694bed833470393ee00eae0a85bff0c6c90e692a (patch) | |
| tree | 345ddcc9c03c5850ca74051d3c0d49420f508d3d /JPratt/src/main/java/bjc/pratt/ParserContext.java | |
| parent | 6b881e8833596d669fdee9525e064aea0c8946dc (diff) | |
Add support for meta-commands
Meta-commands allow you to implement meta-operators, whose behavior
changes based off of tokens that follow.
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/ParserContext.java')
| -rw-r--r-- | JPratt/src/main/java/bjc/pratt/ParserContext.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/ParserContext.java b/JPratt/src/main/java/bjc/pratt/ParserContext.java index 162c5cf..9007f79 100644 --- a/JPratt/src/main/java/bjc/pratt/ParserContext.java +++ b/JPratt/src/main/java/bjc/pratt/ParserContext.java @@ -17,15 +17,22 @@ public class ParserContext<K, V, C> { /** * The source of tokens. */ - public TokenStream<K, V> tokens; + public TokenStream<K, V> tokens; + /** * The parser for sub-expressions. */ - public PrattParser<K, V, C> parse; + public PrattParser<K, V, C> parse; + /** * The state of the parser. */ - public C state; + public C state; + + /** + * The initial command for the current expression. + */ + public K initial; /** * Create a new parser context. @@ -40,8 +47,8 @@ public class ParserContext<K, V, C> { * Any state needing to be kept during parsing. */ public ParserContext(final TokenStream<K, V> tokns, final PrattParser<K, V, C> prse, final C stte) { - this.tokens = tokns; - this.parse = prse; - this.state = stte; + tokens = tokns; + parse = prse; + state = stte; } }
\ No newline at end of file |
