From 15a2b29e48f134bc93cfd0a3d8512001e9242f3d Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 3 Jun 2024 17:33:53 -0400 Subject: Rename package to new domain Rename the package to the new domain --- .../java/com/ashardalon/pratt/ParserContext.java | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 JPratt/src/main/java/com/ashardalon/pratt/ParserContext.java (limited to 'JPratt/src/main/java/com/ashardalon/pratt/ParserContext.java') diff --git a/JPratt/src/main/java/com/ashardalon/pratt/ParserContext.java b/JPratt/src/main/java/com/ashardalon/pratt/ParserContext.java new file mode 100644 index 0000000..cd6fcc2 --- /dev/null +++ b/JPratt/src/main/java/com/ashardalon/pratt/ParserContext.java @@ -0,0 +1,56 @@ +package com.ashardalon.pratt; + +import com.ashardalon.pratt.tokens.TokenStream; + +/** + * Represents the contextual state passed to a command. + * + * @author EVE + * + * @param + * The key type of the tokens. + * @param + * The value type of the tokens. + * + * @param + * The state type of the parser. + */ +public class ParserContext { + /** + * The source of tokens. + */ + public TokenStream tokens; + + /** + * The parser for sub-expressions. + */ + public PrattParser parse; + + /** + * The state of the parser. + */ + public C state; + + /** + * The initial command for the current expression. + */ + public K initial; + + /** + * Create a new parser context. + * + * @param tokns + * The source of tokens. + * + * @param prse + * The parser to call for sub expressions. + * + * @param stte + * Any state needing to be kept during parsing. + */ + public ParserContext(final TokenStream tokns, final PrattParser prse, final C stte) { + tokens = tokns; + parse = prse; + state = stte; + } +} \ No newline at end of file -- cgit v1.2.3