From 694bed833470393ee00eae0a85bff0c6c90e692a Mon Sep 17 00:00:00 2001 From: bjculkin Date: Wed, 12 Apr 2017 10:45:46 -0400 Subject: Add support for meta-commands Meta-commands allow you to implement meta-operators, whose behavior changes based off of tokens that follow. --- JPratt/src/main/java/bjc/pratt/ParserContext.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'JPratt/src/main/java/bjc/pratt/ParserContext.java') 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 { /** * The source of tokens. */ - public TokenStream tokens; + public TokenStream tokens; + /** * The parser for sub-expressions. */ - public PrattParser parse; + public PrattParser 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 { * Any state needing to be kept during parsing. */ public ParserContext(final TokenStream tokns, final PrattParser 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 -- cgit v1.2.3