From db9b9e90f5f6e22c8548d795a4eaea6ff0c0c31c Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 12:06:53 +0200 Subject: [PATCH 1/8] updated depedency to antlr 4.11.1 --- .github/workflows/unittest.yaml | 25 +++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/unittest.yaml diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml new file mode 100644 index 0000000..0acb9f3 --- /dev/null +++ b/.github/workflows/unittest.yaml @@ -0,0 +1,25 @@ +name: Run unit tests +run-name: Testing ${{ github.actor }}'s changes +on: [pull_request] +jobs: + unit-test: + runs-on: ubuntu-latest + + services: + age: + image: apache/age + env: + POSTGRES_PASSWORD: agnes + POSTGRES_USER: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - run: pip install antlr4-python3-runtime==4.9.2 psycopg2 + - name: Run tests + run: python -m unittest -v test_age_py test_agtypes.py diff --git a/setup.py b/setup.py index bf22613..be431b4 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ url = 'https://github.com/rhizome-ai/apache-age-python', download_url = 'https://github.com/rhizome-ai/apache-age-python/releases/' , license = 'Apache2.0', - install_requires = [ 'psycopg2', 'antlr4-python3-runtime==4.9.2' ], + install_requires = [ 'psycopg2', 'antlr4-tools' ], packages = ['age', 'age.gen'], keywords = ['Graph Database', 'Apache AGE', 'PostgreSQL'], python_requires = '>=3.9', From a60bbc457148a229758326d5a3317e97a635d2ab Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 14:58:52 +0200 Subject: [PATCH 2/8] updated antlr parser generator --- .github/workflows/unittest.yaml | 2 +- age/gen/AgtypeBaseListener.java | 219 ++++++++ age/gen/AgtypeBaseVisitor.java | 119 +++++ age/gen/AgtypeLexer.java | 237 +++++++++ age/gen/AgtypeLexer.py | 145 ------ age/gen/AgtypeListener.java | 175 +++++++ age/gen/AgtypeListener.py | 147 ------ age/gen/AgtypeParser.java | 862 ++++++++++++++++++++++++++++++++ age/gen/AgtypeParser.py | 850 ------------------------------- age/gen/AgtypeVisitor.java | 110 ++++ age/gen/AgtypeVisitor.py | 88 ---- age/gen/__init__.py | 0 12 files changed, 1723 insertions(+), 1231 deletions(-) create mode 100644 age/gen/AgtypeBaseListener.java create mode 100644 age/gen/AgtypeBaseVisitor.java create mode 100644 age/gen/AgtypeLexer.java delete mode 100644 age/gen/AgtypeLexer.py create mode 100644 age/gen/AgtypeListener.java delete mode 100644 age/gen/AgtypeListener.py create mode 100644 age/gen/AgtypeParser.java delete mode 100644 age/gen/AgtypeParser.py create mode 100644 age/gen/AgtypeVisitor.java delete mode 100644 age/gen/AgtypeVisitor.py delete mode 100644 age/gen/__init__.py diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 0acb9f3..02060fa 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -20,6 +20,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.11" - - run: pip install antlr4-python3-runtime==4.9.2 psycopg2 + - run: pip install antlr4-python3-runtime psycopg2 - name: Run tests run: python -m unittest -v test_age_py test_agtypes.py diff --git a/age/gen/AgtypeBaseListener.java b/age/gen/AgtypeBaseListener.java new file mode 100644 index 0000000..a1ae8d2 --- /dev/null +++ b/age/gen/AgtypeBaseListener.java @@ -0,0 +1,219 @@ +// Generated from java-escape by ANTLR 4.11.1 + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link AgtypeListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +@SuppressWarnings("CheckReturnValue") +public class AgtypeBaseListener implements AgtypeListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAgType(AgtypeParser.AgTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAgType(AgtypeParser.AgTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAgValue(AgtypeParser.AgValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAgValue(AgtypeParser.AgValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStringValue(AgtypeParser.StringValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStringValue(AgtypeParser.StringValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIntegerValue(AgtypeParser.IntegerValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIntegerValue(AgtypeParser.IntegerValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFloatValue(AgtypeParser.FloatValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFloatValue(AgtypeParser.FloatValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNullValue(AgtypeParser.NullValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNullValue(AgtypeParser.NullValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterObjectValue(AgtypeParser.ObjectValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitObjectValue(AgtypeParser.ObjectValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayValue(AgtypeParser.ArrayValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayValue(AgtypeParser.ArrayValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterObj(AgtypeParser.ObjContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitObj(AgtypeParser.ObjContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPair(AgtypeParser.PairContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPair(AgtypeParser.PairContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArray(AgtypeParser.ArrayContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArray(AgtypeParser.ArrayContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/age/gen/AgtypeBaseVisitor.java b/age/gen/AgtypeBaseVisitor.java new file mode 100644 index 0000000..3a620e9 --- /dev/null +++ b/age/gen/AgtypeBaseVisitor.java @@ -0,0 +1,119 @@ +// Generated from java-escape by ANTLR 4.11.1 +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link AgtypeVisitor}, + * which can be extended to create a visitor which only needs to handle a subset + * of the available methods. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +@SuppressWarnings("CheckReturnValue") +public class AgtypeBaseVisitor extends AbstractParseTreeVisitor implements AgtypeVisitor { + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAgType(AgtypeParser.AgTypeContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAgValue(AgtypeParser.AgValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStringValue(AgtypeParser.StringValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIntegerValue(AgtypeParser.IntegerValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFloatValue(AgtypeParser.FloatValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitNullValue(AgtypeParser.NullValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitObjectValue(AgtypeParser.ObjectValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitArrayValue(AgtypeParser.ArrayValueContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitObj(AgtypeParser.ObjContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitPair(AgtypeParser.PairContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitArray(AgtypeParser.ArrayContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/age/gen/AgtypeLexer.java b/age/gen/AgtypeLexer.java new file mode 100644 index 0000000..a7079d4 --- /dev/null +++ b/age/gen/AgtypeLexer.java @@ -0,0 +1,237 @@ +// Generated from java-escape by ANTLR 4.11.1 +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) +public class AgtypeLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, T__10=11, T__11=12, T__12=13, IDENT=14, STRING=15, INTEGER=16, + RegularFloat=17, ExponentFloat=18, WS=19; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", + "T__9", "T__10", "T__11", "T__12", "IDENT", "STRING", "ESC", "UNICODE", + "HEX", "SAFECODEPOINT", "INTEGER", "INT", "RegularFloat", "ExponentFloat", + "DECIMAL", "SCIENTIFIC", "WS" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", + "']'", "'::'", "'-'", "'Infinity'", "'NaN'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", + "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public AgtypeLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "Agtype.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\u0004\u0000\u0013\u00b7\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+ + "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+ + "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+ + "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+ + "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"+ + "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"+ + "\u0002\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014"+ + "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"+ + "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0001\u0000\u0001\u0000"+ + "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+ + "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+ + "\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+ + "\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001"+ + "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ + "\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0005"+ + "\rf\b\r\n\r\f\ri\t\r\u0001\u000e\u0001\u000e\u0001\u000e\u0005\u000en"+ + "\b\u000e\n\u000e\f\u000eq\t\u000e\u0001\u000e\u0001\u000e\u0001\u000f"+ + "\u0001\u000f\u0001\u000f\u0003\u000fx\b\u000f\u0001\u0010\u0001\u0010"+ + "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+ + "\u0001\u0012\u0001\u0012\u0001\u0013\u0003\u0013\u0085\b\u0013\u0001\u0013"+ + "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0005\u0014\u008c\b\u0014"+ + "\n\u0014\f\u0014\u008f\t\u0014\u0003\u0014\u0091\b\u0014\u0001\u0015\u0003"+ + "\u0015\u0094\b\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0003"+ + "\u0016\u009a\b\u0016\u0001\u0016\u0001\u0016\u0003\u0016\u009e\b\u0016"+ + "\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0004\u0017\u00a4\b\u0017"+ + "\u000b\u0017\f\u0017\u00a5\u0001\u0018\u0001\u0018\u0003\u0018\u00aa\b"+ + "\u0018\u0001\u0018\u0004\u0018\u00ad\b\u0018\u000b\u0018\f\u0018\u00ae"+ + "\u0001\u0019\u0004\u0019\u00b2\b\u0019\u000b\u0019\f\u0019\u00b3\u0001"+ + "\u0019\u0001\u0019\u0000\u0000\u001a\u0001\u0001\u0003\u0002\u0005\u0003"+ + "\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015"+ + "\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0000!\u0000#\u0000"+ + "%\u0000\'\u0010)\u0000+\u0011-\u0012/\u00001\u00003\u0013\u0001\u0000"+ + "\n\u0003\u0000AZ__az\u0005\u0000$$09AZ__az\b\u0000\"\"//\\\\bbffnnrrt"+ + "t\u0003\u000009AFaf\u0003\u0000\u0000\u001f\"\"\\\\\u0001\u000019\u0001"+ + "\u000009\u0002\u0000EEee\u0002\u0000++--\u0003\u0000\t\n\r\r \u00bd\u0000"+ + "\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000"+ + "\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000"+ + "\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r"+ + "\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011"+ + "\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015"+ + "\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019"+ + "\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d"+ + "\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000+\u0001"+ + "\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000"+ + "\u0000\u00015\u0001\u0000\u0000\u0000\u0003:\u0001\u0000\u0000\u0000\u0005"+ + "@\u0001\u0000\u0000\u0000\u0007E\u0001\u0000\u0000\u0000\tG\u0001\u0000"+ + "\u0000\u0000\u000bI\u0001\u0000\u0000\u0000\rK\u0001\u0000\u0000\u0000"+ + "\u000fM\u0001\u0000\u0000\u0000\u0011O\u0001\u0000\u0000\u0000\u0013Q"+ + "\u0001\u0000\u0000\u0000\u0015T\u0001\u0000\u0000\u0000\u0017V\u0001\u0000"+ + "\u0000\u0000\u0019_\u0001\u0000\u0000\u0000\u001bc\u0001\u0000\u0000\u0000"+ + "\u001dj\u0001\u0000\u0000\u0000\u001ft\u0001\u0000\u0000\u0000!y\u0001"+ + "\u0000\u0000\u0000#\u007f\u0001\u0000\u0000\u0000%\u0081\u0001\u0000\u0000"+ + "\u0000\'\u0084\u0001\u0000\u0000\u0000)\u0090\u0001\u0000\u0000\u0000"+ + "+\u0093\u0001\u0000\u0000\u0000-\u0099\u0001\u0000\u0000\u0000/\u00a1"+ + "\u0001\u0000\u0000\u00001\u00a7\u0001\u0000\u0000\u00003\u00b1\u0001\u0000"+ + "\u0000\u000056\u0005t\u0000\u000067\u0005r\u0000\u000078\u0005u\u0000"+ + "\u000089\u0005e\u0000\u00009\u0002\u0001\u0000\u0000\u0000:;\u0005f\u0000"+ + "\u0000;<\u0005a\u0000\u0000<=\u0005l\u0000\u0000=>\u0005s\u0000\u0000"+ + ">?\u0005e\u0000\u0000?\u0004\u0001\u0000\u0000\u0000@A\u0005n\u0000\u0000"+ + "AB\u0005u\u0000\u0000BC\u0005l\u0000\u0000CD\u0005l\u0000\u0000D\u0006"+ + "\u0001\u0000\u0000\u0000EF\u0005{\u0000\u0000F\b\u0001\u0000\u0000\u0000"+ + "GH\u0005,\u0000\u0000H\n\u0001\u0000\u0000\u0000IJ\u0005}\u0000\u0000"+ + "J\f\u0001\u0000\u0000\u0000KL\u0005:\u0000\u0000L\u000e\u0001\u0000\u0000"+ + "\u0000MN\u0005[\u0000\u0000N\u0010\u0001\u0000\u0000\u0000OP\u0005]\u0000"+ + "\u0000P\u0012\u0001\u0000\u0000\u0000QR\u0005:\u0000\u0000RS\u0005:\u0000"+ + "\u0000S\u0014\u0001\u0000\u0000\u0000TU\u0005-\u0000\u0000U\u0016\u0001"+ + "\u0000\u0000\u0000VW\u0005I\u0000\u0000WX\u0005n\u0000\u0000XY\u0005f"+ + "\u0000\u0000YZ\u0005i\u0000\u0000Z[\u0005n\u0000\u0000[\\\u0005i\u0000"+ + "\u0000\\]\u0005t\u0000\u0000]^\u0005y\u0000\u0000^\u0018\u0001\u0000\u0000"+ + "\u0000_`\u0005N\u0000\u0000`a\u0005a\u0000\u0000ab\u0005N\u0000\u0000"+ + "b\u001a\u0001\u0000\u0000\u0000cg\u0007\u0000\u0000\u0000df\u0007\u0001"+ + "\u0000\u0000ed\u0001\u0000\u0000\u0000fi\u0001\u0000\u0000\u0000ge\u0001"+ + "\u0000\u0000\u0000gh\u0001\u0000\u0000\u0000h\u001c\u0001\u0000\u0000"+ + "\u0000ig\u0001\u0000\u0000\u0000jo\u0005\"\u0000\u0000kn\u0003\u001f\u000f"+ + "\u0000ln\u0003%\u0012\u0000mk\u0001\u0000\u0000\u0000ml\u0001\u0000\u0000"+ + "\u0000nq\u0001\u0000\u0000\u0000om\u0001\u0000\u0000\u0000op\u0001\u0000"+ + "\u0000\u0000pr\u0001\u0000\u0000\u0000qo\u0001\u0000\u0000\u0000rs\u0005"+ + "\"\u0000\u0000s\u001e\u0001\u0000\u0000\u0000tw\u0005\\\u0000\u0000ux"+ + "\u0007\u0002\u0000\u0000vx\u0003!\u0010\u0000wu\u0001\u0000\u0000\u0000"+ + "wv\u0001\u0000\u0000\u0000x \u0001\u0000\u0000\u0000yz\u0005u\u0000\u0000"+ + "z{\u0003#\u0011\u0000{|\u0003#\u0011\u0000|}\u0003#\u0011\u0000}~\u0003"+ + "#\u0011\u0000~\"\u0001\u0000\u0000\u0000\u007f\u0080\u0007\u0003\u0000"+ + "\u0000\u0080$\u0001\u0000\u0000\u0000\u0081\u0082\b\u0004\u0000\u0000"+ + "\u0082&\u0001\u0000\u0000\u0000\u0083\u0085\u0005-\u0000\u0000\u0084\u0083"+ + "\u0001\u0000\u0000\u0000\u0084\u0085\u0001\u0000\u0000\u0000\u0085\u0086"+ + "\u0001\u0000\u0000\u0000\u0086\u0087\u0003)\u0014\u0000\u0087(\u0001\u0000"+ + "\u0000\u0000\u0088\u0091\u00050\u0000\u0000\u0089\u008d\u0007\u0005\u0000"+ + "\u0000\u008a\u008c\u0007\u0006\u0000\u0000\u008b\u008a\u0001\u0000\u0000"+ + "\u0000\u008c\u008f\u0001\u0000\u0000\u0000\u008d\u008b\u0001\u0000\u0000"+ + "\u0000\u008d\u008e\u0001\u0000\u0000\u0000\u008e\u0091\u0001\u0000\u0000"+ + "\u0000\u008f\u008d\u0001\u0000\u0000\u0000\u0090\u0088\u0001\u0000\u0000"+ + "\u0000\u0090\u0089\u0001\u0000\u0000\u0000\u0091*\u0001\u0000\u0000\u0000"+ + "\u0092\u0094\u0005-\u0000\u0000\u0093\u0092\u0001\u0000\u0000\u0000\u0093"+ + "\u0094\u0001\u0000\u0000\u0000\u0094\u0095\u0001\u0000\u0000\u0000\u0095"+ + "\u0096\u0003)\u0014\u0000\u0096\u0097\u0003/\u0017\u0000\u0097,\u0001"+ + "\u0000\u0000\u0000\u0098\u009a\u0005-\u0000\u0000\u0099\u0098\u0001\u0000"+ + "\u0000\u0000\u0099\u009a\u0001\u0000\u0000\u0000\u009a\u009b\u0001\u0000"+ + "\u0000\u0000\u009b\u009d\u0003)\u0014\u0000\u009c\u009e\u0003/\u0017\u0000"+ + "\u009d\u009c\u0001\u0000\u0000\u0000\u009d\u009e\u0001\u0000\u0000\u0000"+ + "\u009e\u009f\u0001\u0000\u0000\u0000\u009f\u00a0\u00031\u0018\u0000\u00a0"+ + ".\u0001\u0000\u0000\u0000\u00a1\u00a3\u0005.\u0000\u0000\u00a2\u00a4\u0007"+ + "\u0006\u0000\u0000\u00a3\u00a2\u0001\u0000\u0000\u0000\u00a4\u00a5\u0001"+ + "\u0000\u0000\u0000\u00a5\u00a3\u0001\u0000\u0000\u0000\u00a5\u00a6\u0001"+ + "\u0000\u0000\u0000\u00a60\u0001\u0000\u0000\u0000\u00a7\u00a9\u0007\u0007"+ + "\u0000\u0000\u00a8\u00aa\u0007\b\u0000\u0000\u00a9\u00a8\u0001\u0000\u0000"+ + "\u0000\u00a9\u00aa\u0001\u0000\u0000\u0000\u00aa\u00ac\u0001\u0000\u0000"+ + "\u0000\u00ab\u00ad\u0007\u0006\u0000\u0000\u00ac\u00ab\u0001\u0000\u0000"+ + "\u0000\u00ad\u00ae\u0001\u0000\u0000\u0000\u00ae\u00ac\u0001\u0000\u0000"+ + "\u0000\u00ae\u00af\u0001\u0000\u0000\u0000\u00af2\u0001\u0000\u0000\u0000"+ + "\u00b0\u00b2\u0007\t\u0000\u0000\u00b1\u00b0\u0001\u0000\u0000\u0000\u00b2"+ + "\u00b3\u0001\u0000\u0000\u0000\u00b3\u00b1\u0001\u0000\u0000\u0000\u00b3"+ + "\u00b4\u0001\u0000\u0000\u0000\u00b4\u00b5\u0001\u0000\u0000\u0000\u00b5"+ + "\u00b6\u0006\u0019\u0000\u0000\u00b64\u0001\u0000\u0000\u0000\u000f\u0000"+ + "gmow\u0084\u008d\u0090\u0093\u0099\u009d\u00a5\u00a9\u00ae\u00b3\u0001"+ + "\u0006\u0000\u0000"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/age/gen/AgtypeLexer.py b/age/gen/AgtypeLexer.py deleted file mode 100644 index 3b59334..0000000 --- a/age/gen/AgtypeLexer.py +++ /dev/null @@ -1,145 +0,0 @@ -# Generated from Agtype.g4 by ANTLR 4.9.2 -from antlr4 import * -from io import StringIO -import sys -if sys.version_info[1] > 5: - from typing import TextIO -else: - from typing.io import TextIO - - - -def serializedATN(): - with StringIO() as buf: - buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\25") - buf.write("\u00b9\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7") - buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r") - buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23") - buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30") - buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\3\2\3\2\3\2\3\2\3\2\3\3") - buf.write("\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\6\3") - buf.write("\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\13\3\f") - buf.write("\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16") - buf.write("\3\16\3\17\3\17\7\17h\n\17\f\17\16\17k\13\17\3\20\3\20") - buf.write("\3\20\7\20p\n\20\f\20\16\20s\13\20\3\20\3\20\3\21\3\21") - buf.write("\3\21\5\21z\n\21\3\22\3\22\3\22\3\22\3\22\3\22\3\23\3") - buf.write("\23\3\24\3\24\3\25\5\25\u0087\n\25\3\25\3\25\3\26\3\26") - buf.write("\3\26\7\26\u008e\n\26\f\26\16\26\u0091\13\26\5\26\u0093") - buf.write("\n\26\3\27\5\27\u0096\n\27\3\27\3\27\3\27\3\30\5\30\u009c") - buf.write("\n\30\3\30\3\30\5\30\u00a0\n\30\3\30\3\30\3\31\3\31\6") - buf.write("\31\u00a6\n\31\r\31\16\31\u00a7\3\32\3\32\5\32\u00ac\n") - buf.write("\32\3\32\6\32\u00af\n\32\r\32\16\32\u00b0\3\33\6\33\u00b4") - buf.write("\n\33\r\33\16\33\u00b5\3\33\3\33\2\2\34\3\3\5\4\7\5\t") - buf.write("\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20") - buf.write("\37\21!\2#\2%\2\'\2)\22+\2-\23/\24\61\2\63\2\65\25\3\2") - buf.write("\f\5\2C\\aac|\7\2&&\62;C\\aac|\n\2$$\61\61^^ddhhppttv") - buf.write("v\5\2\62;CHch\5\2\2!$$^^\3\2\63;\3\2\62;\4\2GGgg\4\2-") - buf.write("-//\5\2\13\f\17\17\"\"\2\u00bf\2\3\3\2\2\2\2\5\3\2\2\2") - buf.write("\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17") - buf.write("\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3") - buf.write("\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2") - buf.write("\2\2\2)\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\65\3\2\2\2\3\67") - buf.write("\3\2\2\2\5<\3\2\2\2\7B\3\2\2\2\tG\3\2\2\2\13I\3\2\2\2") - buf.write("\rK\3\2\2\2\17M\3\2\2\2\21O\3\2\2\2\23Q\3\2\2\2\25S\3") - buf.write("\2\2\2\27V\3\2\2\2\31X\3\2\2\2\33a\3\2\2\2\35e\3\2\2\2") - buf.write("\37l\3\2\2\2!v\3\2\2\2#{\3\2\2\2%\u0081\3\2\2\2\'\u0083") - buf.write("\3\2\2\2)\u0086\3\2\2\2+\u0092\3\2\2\2-\u0095\3\2\2\2") - buf.write("/\u009b\3\2\2\2\61\u00a3\3\2\2\2\63\u00a9\3\2\2\2\65\u00b3") - buf.write("\3\2\2\2\678\7v\2\289\7t\2\29:\7w\2\2:;\7g\2\2;\4\3\2") - buf.write("\2\2<=\7h\2\2=>\7c\2\2>?\7n\2\2?@\7u\2\2@A\7g\2\2A\6\3") - buf.write("\2\2\2BC\7p\2\2CD\7w\2\2DE\7n\2\2EF\7n\2\2F\b\3\2\2\2") - buf.write("GH\7}\2\2H\n\3\2\2\2IJ\7.\2\2J\f\3\2\2\2KL\7\177\2\2L") - buf.write("\16\3\2\2\2MN\7<\2\2N\20\3\2\2\2OP\7]\2\2P\22\3\2\2\2") - buf.write("QR\7_\2\2R\24\3\2\2\2ST\7<\2\2TU\7<\2\2U\26\3\2\2\2VW") - buf.write("\7/\2\2W\30\3\2\2\2XY\7K\2\2YZ\7p\2\2Z[\7h\2\2[\\\7k\2") - buf.write("\2\\]\7p\2\2]^\7k\2\2^_\7v\2\2_`\7{\2\2`\32\3\2\2\2ab") - buf.write("\7P\2\2bc\7c\2\2cd\7P\2\2d\34\3\2\2\2ei\t\2\2\2fh\t\3") - buf.write("\2\2gf\3\2\2\2hk\3\2\2\2ig\3\2\2\2ij\3\2\2\2j\36\3\2\2") - buf.write("\2ki\3\2\2\2lq\7$\2\2mp\5!\21\2np\5\'\24\2om\3\2\2\2o") - buf.write("n\3\2\2\2ps\3\2\2\2qo\3\2\2\2qr\3\2\2\2rt\3\2\2\2sq\3") - buf.write("\2\2\2tu\7$\2\2u \3\2\2\2vy\7^\2\2wz\t\4\2\2xz\5#\22\2") - buf.write("yw\3\2\2\2yx\3\2\2\2z\"\3\2\2\2{|\7w\2\2|}\5%\23\2}~\5") - buf.write("%\23\2~\177\5%\23\2\177\u0080\5%\23\2\u0080$\3\2\2\2\u0081") - buf.write("\u0082\t\5\2\2\u0082&\3\2\2\2\u0083\u0084\n\6\2\2\u0084") - buf.write("(\3\2\2\2\u0085\u0087\7/\2\2\u0086\u0085\3\2\2\2\u0086") - buf.write("\u0087\3\2\2\2\u0087\u0088\3\2\2\2\u0088\u0089\5+\26\2") - buf.write("\u0089*\3\2\2\2\u008a\u0093\7\62\2\2\u008b\u008f\t\7\2") - buf.write("\2\u008c\u008e\t\b\2\2\u008d\u008c\3\2\2\2\u008e\u0091") - buf.write("\3\2\2\2\u008f\u008d\3\2\2\2\u008f\u0090\3\2\2\2\u0090") - buf.write("\u0093\3\2\2\2\u0091\u008f\3\2\2\2\u0092\u008a\3\2\2\2") - buf.write("\u0092\u008b\3\2\2\2\u0093,\3\2\2\2\u0094\u0096\7/\2\2") - buf.write("\u0095\u0094\3\2\2\2\u0095\u0096\3\2\2\2\u0096\u0097\3") - buf.write("\2\2\2\u0097\u0098\5+\26\2\u0098\u0099\5\61\31\2\u0099") - buf.write(".\3\2\2\2\u009a\u009c\7/\2\2\u009b\u009a\3\2\2\2\u009b") - buf.write("\u009c\3\2\2\2\u009c\u009d\3\2\2\2\u009d\u009f\5+\26\2") - buf.write("\u009e\u00a0\5\61\31\2\u009f\u009e\3\2\2\2\u009f\u00a0") - buf.write("\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a2\5\63\32\2\u00a2") - buf.write("\60\3\2\2\2\u00a3\u00a5\7\60\2\2\u00a4\u00a6\t\b\2\2\u00a5") - buf.write("\u00a4\3\2\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a5\3\2\2\2") - buf.write("\u00a7\u00a8\3\2\2\2\u00a8\62\3\2\2\2\u00a9\u00ab\t\t") - buf.write("\2\2\u00aa\u00ac\t\n\2\2\u00ab\u00aa\3\2\2\2\u00ab\u00ac") - buf.write("\3\2\2\2\u00ac\u00ae\3\2\2\2\u00ad\u00af\t\b\2\2\u00ae") - buf.write("\u00ad\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\u00ae\3\2\2\2") - buf.write("\u00b0\u00b1\3\2\2\2\u00b1\64\3\2\2\2\u00b2\u00b4\t\13") - buf.write("\2\2\u00b3\u00b2\3\2\2\2\u00b4\u00b5\3\2\2\2\u00b5\u00b3") - buf.write("\3\2\2\2\u00b5\u00b6\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7") - buf.write("\u00b8\b\33\2\2\u00b8\66\3\2\2\2\21\2ioqy\u0086\u008f") - buf.write("\u0092\u0095\u009b\u009f\u00a7\u00ab\u00b0\u00b5\3\b\2") - buf.write("\2") - return buf.getvalue() - - -class AgtypeLexer(Lexer): - - atn = ATNDeserializer().deserialize(serializedATN()) - - decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] - - T__0 = 1 - T__1 = 2 - T__2 = 3 - T__3 = 4 - T__4 = 5 - T__5 = 6 - T__6 = 7 - T__7 = 8 - T__8 = 9 - T__9 = 10 - T__10 = 11 - T__11 = 12 - T__12 = 13 - IDENT = 14 - STRING = 15 - INTEGER = 16 - RegularFloat = 17 - ExponentFloat = 18 - WS = 19 - - channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] - - modeNames = [ "DEFAULT_MODE" ] - - literalNames = [ "", - "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", - "']'", "'::'", "'-'", "'Infinity'", "'NaN'" ] - - symbolicNames = [ "", - "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", - "WS" ] - - ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", - "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "IDENT", - "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINT", "INTEGER", - "INT", "RegularFloat", "ExponentFloat", "DECIMAL", "SCIENTIFIC", - "WS" ] - - grammarFileName = "Agtype.g4" - - def __init__(self, input=None, output:TextIO = sys.stdout): - super().__init__(input, output) - self.checkVersion("4.9.2") - self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) - self._actions = None - self._predicates = None - - diff --git a/age/gen/AgtypeListener.java b/age/gen/AgtypeListener.java new file mode 100644 index 0000000..e153444 --- /dev/null +++ b/age/gen/AgtypeListener.java @@ -0,0 +1,175 @@ +// Generated from java-escape by ANTLR 4.11.1 +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link AgtypeParser}. + */ +public interface AgtypeListener extends ParseTreeListener { + /** + * Enter a parse tree produced by {@link AgtypeParser#agType}. + * @param ctx the parse tree + */ + void enterAgType(AgtypeParser.AgTypeContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#agType}. + * @param ctx the parse tree + */ + void exitAgType(AgtypeParser.AgTypeContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#agValue}. + * @param ctx the parse tree + */ + void enterAgValue(AgtypeParser.AgValueContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#agValue}. + * @param ctx the parse tree + */ + void exitAgValue(AgtypeParser.AgValueContext ctx); + /** + * Enter a parse tree produced by the {@code StringValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterStringValue(AgtypeParser.StringValueContext ctx); + /** + * Exit a parse tree produced by the {@code StringValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitStringValue(AgtypeParser.StringValueContext ctx); + /** + * Enter a parse tree produced by the {@code IntegerValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterIntegerValue(AgtypeParser.IntegerValueContext ctx); + /** + * Exit a parse tree produced by the {@code IntegerValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitIntegerValue(AgtypeParser.IntegerValueContext ctx); + /** + * Enter a parse tree produced by the {@code FloatValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterFloatValue(AgtypeParser.FloatValueContext ctx); + /** + * Exit a parse tree produced by the {@code FloatValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitFloatValue(AgtypeParser.FloatValueContext ctx); + /** + * Enter a parse tree produced by the {@code TrueBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterTrueBoolean(AgtypeParser.TrueBooleanContext ctx); + /** + * Exit a parse tree produced by the {@code TrueBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitTrueBoolean(AgtypeParser.TrueBooleanContext ctx); + /** + * Enter a parse tree produced by the {@code FalseBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterFalseBoolean(AgtypeParser.FalseBooleanContext ctx); + /** + * Exit a parse tree produced by the {@code FalseBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitFalseBoolean(AgtypeParser.FalseBooleanContext ctx); + /** + * Enter a parse tree produced by the {@code NullValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterNullValue(AgtypeParser.NullValueContext ctx); + /** + * Exit a parse tree produced by the {@code NullValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitNullValue(AgtypeParser.NullValueContext ctx); + /** + * Enter a parse tree produced by the {@code ObjectValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterObjectValue(AgtypeParser.ObjectValueContext ctx); + /** + * Exit a parse tree produced by the {@code ObjectValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitObjectValue(AgtypeParser.ObjectValueContext ctx); + /** + * Enter a parse tree produced by the {@code ArrayValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void enterArrayValue(AgtypeParser.ArrayValueContext ctx); + /** + * Exit a parse tree produced by the {@code ArrayValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + */ + void exitArrayValue(AgtypeParser.ArrayValueContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#obj}. + * @param ctx the parse tree + */ + void enterObj(AgtypeParser.ObjContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#obj}. + * @param ctx the parse tree + */ + void exitObj(AgtypeParser.ObjContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#pair}. + * @param ctx the parse tree + */ + void enterPair(AgtypeParser.PairContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#pair}. + * @param ctx the parse tree + */ + void exitPair(AgtypeParser.PairContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#array}. + * @param ctx the parse tree + */ + void enterArray(AgtypeParser.ArrayContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#array}. + * @param ctx the parse tree + */ + void exitArray(AgtypeParser.ArrayContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#typeAnnotation}. + * @param ctx the parse tree + */ + void enterTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#typeAnnotation}. + * @param ctx the parse tree + */ + void exitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); + /** + * Enter a parse tree produced by {@link AgtypeParser#floatLiteral}. + * @param ctx the parse tree + */ + void enterFloatLiteral(AgtypeParser.FloatLiteralContext ctx); + /** + * Exit a parse tree produced by {@link AgtypeParser#floatLiteral}. + * @param ctx the parse tree + */ + void exitFloatLiteral(AgtypeParser.FloatLiteralContext ctx); +} \ No newline at end of file diff --git a/age/gen/AgtypeListener.py b/age/gen/AgtypeListener.py deleted file mode 100644 index f0fd8a3..0000000 --- a/age/gen/AgtypeListener.py +++ /dev/null @@ -1,147 +0,0 @@ -# Generated from Agtype.g4 by ANTLR 4.9.2 -from antlr4 import * -if __name__ is not None and "." in __name__: - from .AgtypeParser import AgtypeParser -else: - from AgtypeParser import AgtypeParser - -# This class defines a complete listener for a parse tree produced by AgtypeParser. -class AgtypeListener(ParseTreeListener): - - # Enter a parse tree produced by AgtypeParser#agType. - def enterAgType(self, ctx:AgtypeParser.AgTypeContext): - pass - - # Exit a parse tree produced by AgtypeParser#agType. - def exitAgType(self, ctx:AgtypeParser.AgTypeContext): - pass - - - # Enter a parse tree produced by AgtypeParser#agValue. - def enterAgValue(self, ctx:AgtypeParser.AgValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#agValue. - def exitAgValue(self, ctx:AgtypeParser.AgValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#StringValue. - def enterStringValue(self, ctx:AgtypeParser.StringValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#StringValue. - def exitStringValue(self, ctx:AgtypeParser.StringValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#IntegerValue. - def enterIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#IntegerValue. - def exitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#FloatValue. - def enterFloatValue(self, ctx:AgtypeParser.FloatValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#FloatValue. - def exitFloatValue(self, ctx:AgtypeParser.FloatValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#TrueBoolean. - def enterTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): - pass - - # Exit a parse tree produced by AgtypeParser#TrueBoolean. - def exitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): - pass - - - # Enter a parse tree produced by AgtypeParser#FalseBoolean. - def enterFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): - pass - - # Exit a parse tree produced by AgtypeParser#FalseBoolean. - def exitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): - pass - - - # Enter a parse tree produced by AgtypeParser#NullValue. - def enterNullValue(self, ctx:AgtypeParser.NullValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#NullValue. - def exitNullValue(self, ctx:AgtypeParser.NullValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#ObjectValue. - def enterObjectValue(self, ctx:AgtypeParser.ObjectValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#ObjectValue. - def exitObjectValue(self, ctx:AgtypeParser.ObjectValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#ArrayValue. - def enterArrayValue(self, ctx:AgtypeParser.ArrayValueContext): - pass - - # Exit a parse tree produced by AgtypeParser#ArrayValue. - def exitArrayValue(self, ctx:AgtypeParser.ArrayValueContext): - pass - - - # Enter a parse tree produced by AgtypeParser#obj. - def enterObj(self, ctx:AgtypeParser.ObjContext): - pass - - # Exit a parse tree produced by AgtypeParser#obj. - def exitObj(self, ctx:AgtypeParser.ObjContext): - pass - - - # Enter a parse tree produced by AgtypeParser#pair. - def enterPair(self, ctx:AgtypeParser.PairContext): - pass - - # Exit a parse tree produced by AgtypeParser#pair. - def exitPair(self, ctx:AgtypeParser.PairContext): - pass - - - # Enter a parse tree produced by AgtypeParser#array. - def enterArray(self, ctx:AgtypeParser.ArrayContext): - pass - - # Exit a parse tree produced by AgtypeParser#array. - def exitArray(self, ctx:AgtypeParser.ArrayContext): - pass - - - # Enter a parse tree produced by AgtypeParser#typeAnnotation. - def enterTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): - pass - - # Exit a parse tree produced by AgtypeParser#typeAnnotation. - def exitTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): - pass - - - # Enter a parse tree produced by AgtypeParser#floatLiteral. - def enterFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): - pass - - # Exit a parse tree produced by AgtypeParser#floatLiteral. - def exitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): - pass - - - -del AgtypeParser \ No newline at end of file diff --git a/age/gen/AgtypeParser.java b/age/gen/AgtypeParser.java new file mode 100644 index 0000000..2c23c22 --- /dev/null +++ b/age/gen/AgtypeParser.java @@ -0,0 +1,862 @@ +// Generated from java-escape by ANTLR 4.11.1 +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; +import java.util.List; +import java.util.Iterator; +import java.util.ArrayList; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) +public class AgtypeParser extends Parser { + static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, T__10=11, T__11=12, T__12=13, IDENT=14, STRING=15, INTEGER=16, + RegularFloat=17, ExponentFloat=18, WS=19; + public static final int + RULE_agType = 0, RULE_agValue = 1, RULE_value = 2, RULE_obj = 3, RULE_pair = 4, + RULE_array = 5, RULE_typeAnnotation = 6, RULE_floatLiteral = 7; + private static String[] makeRuleNames() { + return new String[] { + "agType", "agValue", "value", "obj", "pair", "array", "typeAnnotation", + "floatLiteral" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", + "']'", "'::'", "'-'", "'Infinity'", "'NaN'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", + "WS" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "java-escape"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public AgtypeParser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @SuppressWarnings("CheckReturnValue") + public static class AgTypeContext extends ParserRuleContext { + public AgValueContext agValue() { + return getRuleContext(AgValueContext.class,0); + } + public TerminalNode EOF() { return getToken(AgtypeParser.EOF, 0); } + public AgTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_agType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterAgType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitAgType(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitAgType(this); + else return visitor.visitChildren(this); + } + } + + public final AgTypeContext agType() throws RecognitionException { + AgTypeContext _localctx = new AgTypeContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_agType); + try { + enterOuterAlt(_localctx, 1); + { + setState(16); + agValue(); + setState(17); + match(EOF); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AgValueContext extends ParserRuleContext { + public ValueContext value() { + return getRuleContext(ValueContext.class,0); + } + public TypeAnnotationContext typeAnnotation() { + return getRuleContext(TypeAnnotationContext.class,0); + } + public AgValueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_agValue; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterAgValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitAgValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitAgValue(this); + else return visitor.visitChildren(this); + } + } + + public final AgValueContext agValue() throws RecognitionException { + AgValueContext _localctx = new AgValueContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_agValue); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(19); + value(); + setState(21); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==T__9) { + { + setState(20); + typeAnnotation(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ValueContext extends ParserRuleContext { + public ValueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_value; } + + public ValueContext() { } + public void copyFrom(ValueContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class NullValueContext extends ValueContext { + public NullValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterNullValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitNullValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitNullValue(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ObjectValueContext extends ValueContext { + public ObjContext obj() { + return getRuleContext(ObjContext.class,0); + } + public ObjectValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterObjectValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitObjectValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitObjectValue(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class IntegerValueContext extends ValueContext { + public TerminalNode INTEGER() { return getToken(AgtypeParser.INTEGER, 0); } + public IntegerValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterIntegerValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitIntegerValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitIntegerValue(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class TrueBooleanContext extends ValueContext { + public TrueBooleanContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterTrueBoolean(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitTrueBoolean(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitTrueBoolean(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class FalseBooleanContext extends ValueContext { + public FalseBooleanContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFalseBoolean(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFalseBoolean(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFalseBoolean(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class FloatValueContext extends ValueContext { + public FloatLiteralContext floatLiteral() { + return getRuleContext(FloatLiteralContext.class,0); + } + public FloatValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFloatValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFloatValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFloatValue(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class StringValueContext extends ValueContext { + public TerminalNode STRING() { return getToken(AgtypeParser.STRING, 0); } + public StringValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterStringValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitStringValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitStringValue(this); + else return visitor.visitChildren(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ArrayValueContext extends ValueContext { + public ArrayContext array() { + return getRuleContext(ArrayContext.class,0); + } + public ArrayValueContext(ValueContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterArrayValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitArrayValue(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitArrayValue(this); + else return visitor.visitChildren(this); + } + } + + public final ValueContext value() throws RecognitionException { + ValueContext _localctx = new ValueContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_value); + try { + setState(31); + _errHandler.sync(this); + switch (_input.LA(1)) { + case STRING: + _localctx = new StringValueContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(23); + match(STRING); + } + break; + case INTEGER: + _localctx = new IntegerValueContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(24); + match(INTEGER); + } + break; + case T__10: + case T__11: + case T__12: + case RegularFloat: + case ExponentFloat: + _localctx = new FloatValueContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(25); + floatLiteral(); + } + break; + case T__0: + _localctx = new TrueBooleanContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(26); + match(T__0); + } + break; + case T__1: + _localctx = new FalseBooleanContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(27); + match(T__1); + } + break; + case T__2: + _localctx = new NullValueContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(28); + match(T__2); + } + break; + case T__3: + _localctx = new ObjectValueContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(29); + obj(); + } + break; + case T__7: + _localctx = new ArrayValueContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(30); + array(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ObjContext extends ParserRuleContext { + public List pair() { + return getRuleContexts(PairContext.class); + } + public PairContext pair(int i) { + return getRuleContext(PairContext.class,i); + } + public ObjContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_obj; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterObj(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitObj(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitObj(this); + else return visitor.visitChildren(this); + } + } + + public final ObjContext obj() throws RecognitionException { + ObjContext _localctx = new ObjContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_obj); + int _la; + try { + setState(46); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(33); + match(T__3); + setState(34); + pair(); + setState(39); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==T__4) { + { + { + setState(35); + match(T__4); + setState(36); + pair(); + } + } + setState(41); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(42); + match(T__5); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(44); + match(T__3); + setState(45); + match(T__5); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PairContext extends ParserRuleContext { + public TerminalNode STRING() { return getToken(AgtypeParser.STRING, 0); } + public AgValueContext agValue() { + return getRuleContext(AgValueContext.class,0); + } + public PairContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_pair; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterPair(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitPair(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitPair(this); + else return visitor.visitChildren(this); + } + } + + public final PairContext pair() throws RecognitionException { + PairContext _localctx = new PairContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_pair); + try { + enterOuterAlt(_localctx, 1); + { + setState(48); + match(STRING); + setState(49); + match(T__6); + setState(50); + agValue(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArrayContext extends ParserRuleContext { + public List agValue() { + return getRuleContexts(AgValueContext.class); + } + public AgValueContext agValue(int i) { + return getRuleContext(AgValueContext.class,i); + } + public ArrayContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_array; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterArray(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitArray(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitArray(this); + else return visitor.visitChildren(this); + } + } + + public final ArrayContext array() throws RecognitionException { + ArrayContext _localctx = new ArrayContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_array); + int _la; + try { + setState(65); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(52); + match(T__7); + setState(53); + agValue(); + setState(58); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==T__4) { + { + { + setState(54); + match(T__4); + setState(55); + agValue(); + } + } + setState(60); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(61); + match(T__8); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(63); + match(T__7); + setState(64); + match(T__8); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeAnnotationContext extends ParserRuleContext { + public TerminalNode IDENT() { return getToken(AgtypeParser.IDENT, 0); } + public TypeAnnotationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeAnnotation; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterTypeAnnotation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitTypeAnnotation(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitTypeAnnotation(this); + else return visitor.visitChildren(this); + } + } + + public final TypeAnnotationContext typeAnnotation() throws RecognitionException { + TypeAnnotationContext _localctx = new TypeAnnotationContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_typeAnnotation); + try { + enterOuterAlt(_localctx, 1); + { + setState(67); + match(T__9); + setState(68); + match(IDENT); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FloatLiteralContext extends ParserRuleContext { + public TerminalNode RegularFloat() { return getToken(AgtypeParser.RegularFloat, 0); } + public TerminalNode ExponentFloat() { return getToken(AgtypeParser.ExponentFloat, 0); } + public FloatLiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_floatLiteral; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFloatLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFloatLiteral(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFloatLiteral(this); + else return visitor.visitChildren(this); + } + } + + public final FloatLiteralContext floatLiteral() throws RecognitionException { + FloatLiteralContext _localctx = new FloatLiteralContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_floatLiteral); + int _la; + try { + setState(77); + _errHandler.sync(this); + switch (_input.LA(1)) { + case RegularFloat: + enterOuterAlt(_localctx, 1); + { + setState(70); + match(RegularFloat); + } + break; + case ExponentFloat: + enterOuterAlt(_localctx, 2); + { + setState(71); + match(ExponentFloat); + } + break; + case T__10: + case T__11: + enterOuterAlt(_localctx, 3); + { + setState(73); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==T__10) { + { + setState(72); + match(T__10); + } + } + + setState(75); + match(T__11); + } + break; + case T__12: + enterOuterAlt(_localctx, 4); + { + setState(76); + match(T__12); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static final String _serializedATN = + "\u0004\u0001\u0013P\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ + "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0001"+ + "\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0003\u0001\u0016"+ + "\b\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001"+ + "\u0002\u0001\u0002\u0001\u0002\u0003\u0002 \b\u0002\u0001\u0003\u0001"+ + "\u0003\u0001\u0003\u0001\u0003\u0005\u0003&\b\u0003\n\u0003\f\u0003)\t"+ + "\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0003\u0003/\b"+ + "\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001"+ + "\u0005\u0001\u0005\u0001\u0005\u0005\u00059\b\u0005\n\u0005\f\u0005<\t"+ + "\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0003\u0005B\b"+ + "\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001"+ + "\u0007\u0003\u0007J\b\u0007\u0001\u0007\u0001\u0007\u0003\u0007N\b\u0007"+ + "\u0001\u0007\u0000\u0000\b\u0000\u0002\u0004\u0006\b\n\f\u000e\u0000\u0000"+ + "W\u0000\u0010\u0001\u0000\u0000\u0000\u0002\u0013\u0001\u0000\u0000\u0000"+ + "\u0004\u001f\u0001\u0000\u0000\u0000\u0006.\u0001\u0000\u0000\u0000\b"+ + "0\u0001\u0000\u0000\u0000\nA\u0001\u0000\u0000\u0000\fC\u0001\u0000\u0000"+ + "\u0000\u000eM\u0001\u0000\u0000\u0000\u0010\u0011\u0003\u0002\u0001\u0000"+ + "\u0011\u0012\u0005\u0000\u0000\u0001\u0012\u0001\u0001\u0000\u0000\u0000"+ + "\u0013\u0015\u0003\u0004\u0002\u0000\u0014\u0016\u0003\f\u0006\u0000\u0015"+ + "\u0014\u0001\u0000\u0000\u0000\u0015\u0016\u0001\u0000\u0000\u0000\u0016"+ + "\u0003\u0001\u0000\u0000\u0000\u0017 \u0005\u000f\u0000\u0000\u0018 \u0005"+ + "\u0010\u0000\u0000\u0019 \u0003\u000e\u0007\u0000\u001a \u0005\u0001\u0000"+ + "\u0000\u001b \u0005\u0002\u0000\u0000\u001c \u0005\u0003\u0000\u0000\u001d"+ + " \u0003\u0006\u0003\u0000\u001e \u0003\n\u0005\u0000\u001f\u0017\u0001"+ + "\u0000\u0000\u0000\u001f\u0018\u0001\u0000\u0000\u0000\u001f\u0019\u0001"+ + "\u0000\u0000\u0000\u001f\u001a\u0001\u0000\u0000\u0000\u001f\u001b\u0001"+ + "\u0000\u0000\u0000\u001f\u001c\u0001\u0000\u0000\u0000\u001f\u001d\u0001"+ + "\u0000\u0000\u0000\u001f\u001e\u0001\u0000\u0000\u0000 \u0005\u0001\u0000"+ + "\u0000\u0000!\"\u0005\u0004\u0000\u0000\"\'\u0003\b\u0004\u0000#$\u0005"+ + "\u0005\u0000\u0000$&\u0003\b\u0004\u0000%#\u0001\u0000\u0000\u0000&)\u0001"+ + "\u0000\u0000\u0000\'%\u0001\u0000\u0000\u0000\'(\u0001\u0000\u0000\u0000"+ + "(*\u0001\u0000\u0000\u0000)\'\u0001\u0000\u0000\u0000*+\u0005\u0006\u0000"+ + "\u0000+/\u0001\u0000\u0000\u0000,-\u0005\u0004\u0000\u0000-/\u0005\u0006"+ + "\u0000\u0000.!\u0001\u0000\u0000\u0000.,\u0001\u0000\u0000\u0000/\u0007"+ + "\u0001\u0000\u0000\u000001\u0005\u000f\u0000\u000012\u0005\u0007\u0000"+ + "\u000023\u0003\u0002\u0001\u00003\t\u0001\u0000\u0000\u000045\u0005\b"+ + "\u0000\u00005:\u0003\u0002\u0001\u000067\u0005\u0005\u0000\u000079\u0003"+ + "\u0002\u0001\u000086\u0001\u0000\u0000\u00009<\u0001\u0000\u0000\u0000"+ + ":8\u0001\u0000\u0000\u0000:;\u0001\u0000\u0000\u0000;=\u0001\u0000\u0000"+ + "\u0000<:\u0001\u0000\u0000\u0000=>\u0005\t\u0000\u0000>B\u0001\u0000\u0000"+ + "\u0000?@\u0005\b\u0000\u0000@B\u0005\t\u0000\u0000A4\u0001\u0000\u0000"+ + "\u0000A?\u0001\u0000\u0000\u0000B\u000b\u0001\u0000\u0000\u0000CD\u0005"+ + "\n\u0000\u0000DE\u0005\u000e\u0000\u0000E\r\u0001\u0000\u0000\u0000FN"+ + "\u0005\u0011\u0000\u0000GN\u0005\u0012\u0000\u0000HJ\u0005\u000b\u0000"+ + "\u0000IH\u0001\u0000\u0000\u0000IJ\u0001\u0000\u0000\u0000JK\u0001\u0000"+ + "\u0000\u0000KN\u0005\f\u0000\u0000LN\u0005\r\u0000\u0000MF\u0001\u0000"+ + "\u0000\u0000MG\u0001\u0000\u0000\u0000MI\u0001\u0000\u0000\u0000ML\u0001"+ + "\u0000\u0000\u0000N\u000f\u0001\u0000\u0000\u0000\b\u0015\u001f\'.:AI"+ + "M"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/age/gen/AgtypeParser.py b/age/gen/AgtypeParser.py deleted file mode 100644 index 73539df..0000000 --- a/age/gen/AgtypeParser.py +++ /dev/null @@ -1,850 +0,0 @@ -# Generated from Agtype.g4 by ANTLR 4.9.2 -# encoding: utf-8 -from antlr4 import * -from io import StringIO -import sys -if sys.version_info[1] > 5: - from typing import TextIO -else: - from typing.io import TextIO - - -def serializedATN(): - with StringIO() as buf: - buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\25") - buf.write("R\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b") - buf.write("\t\b\4\t\t\t\3\2\3\2\3\2\3\3\3\3\5\3\30\n\3\3\4\3\4\3") - buf.write("\4\3\4\3\4\3\4\3\4\3\4\5\4\"\n\4\3\5\3\5\3\5\3\5\7\5(") - buf.write("\n\5\f\5\16\5+\13\5\3\5\3\5\3\5\3\5\5\5\61\n\5\3\6\3\6") - buf.write("\3\6\3\6\3\7\3\7\3\7\3\7\7\7;\n\7\f\7\16\7>\13\7\3\7\3") - buf.write("\7\3\7\3\7\5\7D\n\7\3\b\3\b\3\b\3\t\3\t\3\t\5\tL\n\t\3") - buf.write("\t\3\t\5\tP\n\t\3\t\2\2\n\2\4\6\b\n\f\16\20\2\2\2Y\2\22") - buf.write("\3\2\2\2\4\25\3\2\2\2\6!\3\2\2\2\b\60\3\2\2\2\n\62\3\2") - buf.write("\2\2\fC\3\2\2\2\16E\3\2\2\2\20O\3\2\2\2\22\23\5\4\3\2") - buf.write("\23\24\7\2\2\3\24\3\3\2\2\2\25\27\5\6\4\2\26\30\5\16\b") - buf.write("\2\27\26\3\2\2\2\27\30\3\2\2\2\30\5\3\2\2\2\31\"\7\21") - buf.write("\2\2\32\"\7\22\2\2\33\"\5\20\t\2\34\"\7\3\2\2\35\"\7\4") - buf.write("\2\2\36\"\7\5\2\2\37\"\5\b\5\2 \"\5\f\7\2!\31\3\2\2\2") - buf.write("!\32\3\2\2\2!\33\3\2\2\2!\34\3\2\2\2!\35\3\2\2\2!\36\3") - buf.write("\2\2\2!\37\3\2\2\2! \3\2\2\2\"\7\3\2\2\2#$\7\6\2\2$)\5") - buf.write("\n\6\2%&\7\7\2\2&(\5\n\6\2\'%\3\2\2\2(+\3\2\2\2)\'\3\2") - buf.write("\2\2)*\3\2\2\2*,\3\2\2\2+)\3\2\2\2,-\7\b\2\2-\61\3\2\2") - buf.write("\2./\7\6\2\2/\61\7\b\2\2\60#\3\2\2\2\60.\3\2\2\2\61\t") - buf.write("\3\2\2\2\62\63\7\21\2\2\63\64\7\t\2\2\64\65\5\4\3\2\65") - buf.write("\13\3\2\2\2\66\67\7\n\2\2\67<\5\4\3\289\7\7\2\29;\5\4") - buf.write("\3\2:8\3\2\2\2;>\3\2\2\2<:\3\2\2\2<=\3\2\2\2=?\3\2\2\2") - buf.write("><\3\2\2\2?@\7\13\2\2@D\3\2\2\2AB\7\n\2\2BD\7\13\2\2C") - buf.write("\66\3\2\2\2CA\3\2\2\2D\r\3\2\2\2EF\7\f\2\2FG\7\20\2\2") - buf.write("G\17\3\2\2\2HP\7\23\2\2IP\7\24\2\2JL\7\r\2\2KJ\3\2\2\2") - buf.write("KL\3\2\2\2LM\3\2\2\2MP\7\16\2\2NP\7\17\2\2OH\3\2\2\2O") - buf.write("I\3\2\2\2OK\3\2\2\2ON\3\2\2\2P\21\3\2\2\2\n\27!)\60", "'true'", "'false'", "'null'", "'{'", - "','", "'}'", "':'", "'['", "']'", "'::'", "'-'", "'Infinity'", - "'NaN'" ] - - symbolicNames = [ "", "", "", "", - "", "", "", "", - "", "", "", "", - "", "", "IDENT", "STRING", "INTEGER", - "RegularFloat", "ExponentFloat", "WS" ] - - RULE_agType = 0 - RULE_agValue = 1 - RULE_value = 2 - RULE_obj = 3 - RULE_pair = 4 - RULE_array = 5 - RULE_typeAnnotation = 6 - RULE_floatLiteral = 7 - - ruleNames = [ "agType", "agValue", "value", "obj", "pair", "array", - "typeAnnotation", "floatLiteral" ] - - EOF = Token.EOF - T__0=1 - T__1=2 - T__2=3 - T__3=4 - T__4=5 - T__5=6 - T__6=7 - T__7=8 - T__8=9 - T__9=10 - T__10=11 - T__11=12 - T__12=13 - IDENT=14 - STRING=15 - INTEGER=16 - RegularFloat=17 - ExponentFloat=18 - WS=19 - - def __init__(self, input:TokenStream, output:TextIO = sys.stdout): - super().__init__(input, output) - self.checkVersion("4.9.2") - self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) - self._predicates = None - - - - - class AgTypeContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def agValue(self): - return self.getTypedRuleContext(AgtypeParser.AgValueContext,0) - - - def EOF(self): - return self.getToken(AgtypeParser.EOF, 0) - - def getRuleIndex(self): - return AgtypeParser.RULE_agType - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterAgType" ): - listener.enterAgType(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitAgType" ): - listener.exitAgType(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitAgType" ): - return visitor.visitAgType(self) - else: - return visitor.visitChildren(self) - - - - - def agType(self): - - localctx = AgtypeParser.AgTypeContext(self, self._ctx, self.state) - self.enterRule(localctx, 0, self.RULE_agType) - try: - self.enterOuterAlt(localctx, 1) - self.state = 16 - self.agValue() - self.state = 17 - self.match(AgtypeParser.EOF) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class AgValueContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def value(self): - return self.getTypedRuleContext(AgtypeParser.ValueContext,0) - - - def typeAnnotation(self): - return self.getTypedRuleContext(AgtypeParser.TypeAnnotationContext,0) - - - def getRuleIndex(self): - return AgtypeParser.RULE_agValue - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterAgValue" ): - listener.enterAgValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitAgValue" ): - listener.exitAgValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitAgValue" ): - return visitor.visitAgValue(self) - else: - return visitor.visitChildren(self) - - - - - def agValue(self): - - localctx = AgtypeParser.AgValueContext(self, self._ctx, self.state) - self.enterRule(localctx, 2, self.RULE_agValue) - self._la = 0 # Token type - try: - self.enterOuterAlt(localctx, 1) - self.state = 19 - self.value() - self.state = 21 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==AgtypeParser.T__9: - self.state = 20 - self.typeAnnotation() - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class ValueContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - - def getRuleIndex(self): - return AgtypeParser.RULE_value - - - def copyFrom(self, ctx:ParserRuleContext): - super().copyFrom(ctx) - - - - class NullValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterNullValue" ): - listener.enterNullValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitNullValue" ): - listener.exitNullValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitNullValue" ): - return visitor.visitNullValue(self) - else: - return visitor.visitChildren(self) - - - class ObjectValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - def obj(self): - return self.getTypedRuleContext(AgtypeParser.ObjContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterObjectValue" ): - listener.enterObjectValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitObjectValue" ): - listener.exitObjectValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitObjectValue" ): - return visitor.visitObjectValue(self) - else: - return visitor.visitChildren(self) - - - class IntegerValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - def INTEGER(self): - return self.getToken(AgtypeParser.INTEGER, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterIntegerValue" ): - listener.enterIntegerValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitIntegerValue" ): - listener.exitIntegerValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitIntegerValue" ): - return visitor.visitIntegerValue(self) - else: - return visitor.visitChildren(self) - - - class TrueBooleanContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterTrueBoolean" ): - listener.enterTrueBoolean(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitTrueBoolean" ): - listener.exitTrueBoolean(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitTrueBoolean" ): - return visitor.visitTrueBoolean(self) - else: - return visitor.visitChildren(self) - - - class FalseBooleanContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFalseBoolean" ): - listener.enterFalseBoolean(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFalseBoolean" ): - listener.exitFalseBoolean(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFalseBoolean" ): - return visitor.visitFalseBoolean(self) - else: - return visitor.visitChildren(self) - - - class FloatValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - def floatLiteral(self): - return self.getTypedRuleContext(AgtypeParser.FloatLiteralContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFloatValue" ): - listener.enterFloatValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFloatValue" ): - listener.exitFloatValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFloatValue" ): - return visitor.visitFloatValue(self) - else: - return visitor.visitChildren(self) - - - class StringValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - def STRING(self): - return self.getToken(AgtypeParser.STRING, 0) - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStringValue" ): - listener.enterStringValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStringValue" ): - listener.exitStringValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitStringValue" ): - return visitor.visitStringValue(self) - else: - return visitor.visitChildren(self) - - - class ArrayValueContext(ValueContext): - - def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext - super().__init__(parser) - self.copyFrom(ctx) - - def array(self): - return self.getTypedRuleContext(AgtypeParser.ArrayContext,0) - - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterArrayValue" ): - listener.enterArrayValue(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitArrayValue" ): - listener.exitArrayValue(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitArrayValue" ): - return visitor.visitArrayValue(self) - else: - return visitor.visitChildren(self) - - - - def value(self): - - localctx = AgtypeParser.ValueContext(self, self._ctx, self.state) - self.enterRule(localctx, 4, self.RULE_value) - try: - self.state = 31 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [AgtypeParser.STRING]: - localctx = AgtypeParser.StringValueContext(self, localctx) - self.enterOuterAlt(localctx, 1) - self.state = 23 - self.match(AgtypeParser.STRING) - pass - elif token in [AgtypeParser.INTEGER]: - localctx = AgtypeParser.IntegerValueContext(self, localctx) - self.enterOuterAlt(localctx, 2) - self.state = 24 - self.match(AgtypeParser.INTEGER) - pass - elif token in [AgtypeParser.T__10, AgtypeParser.T__11, AgtypeParser.T__12, AgtypeParser.RegularFloat, AgtypeParser.ExponentFloat]: - localctx = AgtypeParser.FloatValueContext(self, localctx) - self.enterOuterAlt(localctx, 3) - self.state = 25 - self.floatLiteral() - pass - elif token in [AgtypeParser.T__0]: - localctx = AgtypeParser.TrueBooleanContext(self, localctx) - self.enterOuterAlt(localctx, 4) - self.state = 26 - self.match(AgtypeParser.T__0) - pass - elif token in [AgtypeParser.T__1]: - localctx = AgtypeParser.FalseBooleanContext(self, localctx) - self.enterOuterAlt(localctx, 5) - self.state = 27 - self.match(AgtypeParser.T__1) - pass - elif token in [AgtypeParser.T__2]: - localctx = AgtypeParser.NullValueContext(self, localctx) - self.enterOuterAlt(localctx, 6) - self.state = 28 - self.match(AgtypeParser.T__2) - pass - elif token in [AgtypeParser.T__3]: - localctx = AgtypeParser.ObjectValueContext(self, localctx) - self.enterOuterAlt(localctx, 7) - self.state = 29 - self.obj() - pass - elif token in [AgtypeParser.T__7]: - localctx = AgtypeParser.ArrayValueContext(self, localctx) - self.enterOuterAlt(localctx, 8) - self.state = 30 - self.array() - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class ObjContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def pair(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(AgtypeParser.PairContext) - else: - return self.getTypedRuleContext(AgtypeParser.PairContext,i) - - - def getRuleIndex(self): - return AgtypeParser.RULE_obj - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterObj" ): - listener.enterObj(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitObj" ): - listener.exitObj(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitObj" ): - return visitor.visitObj(self) - else: - return visitor.visitChildren(self) - - - - - def obj(self): - - localctx = AgtypeParser.ObjContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_obj) - self._la = 0 # Token type - try: - self.state = 46 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,3,self._ctx) - if la_ == 1: - self.enterOuterAlt(localctx, 1) - self.state = 33 - self.match(AgtypeParser.T__3) - self.state = 34 - self.pair() - self.state = 39 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==AgtypeParser.T__4: - self.state = 35 - self.match(AgtypeParser.T__4) - self.state = 36 - self.pair() - self.state = 41 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 42 - self.match(AgtypeParser.T__5) - pass - - elif la_ == 2: - self.enterOuterAlt(localctx, 2) - self.state = 44 - self.match(AgtypeParser.T__3) - self.state = 45 - self.match(AgtypeParser.T__5) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class PairContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def STRING(self): - return self.getToken(AgtypeParser.STRING, 0) - - def agValue(self): - return self.getTypedRuleContext(AgtypeParser.AgValueContext,0) - - - def getRuleIndex(self): - return AgtypeParser.RULE_pair - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPair" ): - listener.enterPair(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPair" ): - listener.exitPair(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPair" ): - return visitor.visitPair(self) - else: - return visitor.visitChildren(self) - - - - - def pair(self): - - localctx = AgtypeParser.PairContext(self, self._ctx, self.state) - self.enterRule(localctx, 8, self.RULE_pair) - try: - self.enterOuterAlt(localctx, 1) - self.state = 48 - self.match(AgtypeParser.STRING) - self.state = 49 - self.match(AgtypeParser.T__6) - self.state = 50 - self.agValue() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class ArrayContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def agValue(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(AgtypeParser.AgValueContext) - else: - return self.getTypedRuleContext(AgtypeParser.AgValueContext,i) - - - def getRuleIndex(self): - return AgtypeParser.RULE_array - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterArray" ): - listener.enterArray(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitArray" ): - listener.exitArray(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitArray" ): - return visitor.visitArray(self) - else: - return visitor.visitChildren(self) - - - - - def array(self): - - localctx = AgtypeParser.ArrayContext(self, self._ctx, self.state) - self.enterRule(localctx, 10, self.RULE_array) - self._la = 0 # Token type - try: - self.state = 65 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,5,self._ctx) - if la_ == 1: - self.enterOuterAlt(localctx, 1) - self.state = 52 - self.match(AgtypeParser.T__7) - self.state = 53 - self.agValue() - self.state = 58 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==AgtypeParser.T__4: - self.state = 54 - self.match(AgtypeParser.T__4) - self.state = 55 - self.agValue() - self.state = 60 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 61 - self.match(AgtypeParser.T__8) - pass - - elif la_ == 2: - self.enterOuterAlt(localctx, 2) - self.state = 63 - self.match(AgtypeParser.T__7) - self.state = 64 - self.match(AgtypeParser.T__8) - pass - - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class TypeAnnotationContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def IDENT(self): - return self.getToken(AgtypeParser.IDENT, 0) - - def getRuleIndex(self): - return AgtypeParser.RULE_typeAnnotation - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterTypeAnnotation" ): - listener.enterTypeAnnotation(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitTypeAnnotation" ): - listener.exitTypeAnnotation(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitTypeAnnotation" ): - return visitor.visitTypeAnnotation(self) - else: - return visitor.visitChildren(self) - - - - - def typeAnnotation(self): - - localctx = AgtypeParser.TypeAnnotationContext(self, self._ctx, self.state) - self.enterRule(localctx, 12, self.RULE_typeAnnotation) - try: - self.enterOuterAlt(localctx, 1) - self.state = 67 - self.match(AgtypeParser.T__9) - self.state = 68 - self.match(AgtypeParser.IDENT) - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - class FloatLiteralContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def RegularFloat(self): - return self.getToken(AgtypeParser.RegularFloat, 0) - - def ExponentFloat(self): - return self.getToken(AgtypeParser.ExponentFloat, 0) - - def getRuleIndex(self): - return AgtypeParser.RULE_floatLiteral - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFloatLiteral" ): - listener.enterFloatLiteral(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFloatLiteral" ): - listener.exitFloatLiteral(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitFloatLiteral" ): - return visitor.visitFloatLiteral(self) - else: - return visitor.visitChildren(self) - - - - - def floatLiteral(self): - - localctx = AgtypeParser.FloatLiteralContext(self, self._ctx, self.state) - self.enterRule(localctx, 14, self.RULE_floatLiteral) - self._la = 0 # Token type - try: - self.state = 77 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [AgtypeParser.RegularFloat]: - self.enterOuterAlt(localctx, 1) - self.state = 70 - self.match(AgtypeParser.RegularFloat) - pass - elif token in [AgtypeParser.ExponentFloat]: - self.enterOuterAlt(localctx, 2) - self.state = 71 - self.match(AgtypeParser.ExponentFloat) - pass - elif token in [AgtypeParser.T__10, AgtypeParser.T__11]: - self.enterOuterAlt(localctx, 3) - self.state = 73 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==AgtypeParser.T__10: - self.state = 72 - self.match(AgtypeParser.T__10) - - - self.state = 75 - self.match(AgtypeParser.T__11) - pass - elif token in [AgtypeParser.T__12]: - self.enterOuterAlt(localctx, 4) - self.state = 76 - self.match(AgtypeParser.T__12) - pass - else: - raise NoViableAltException(self) - - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - - - - diff --git a/age/gen/AgtypeVisitor.java b/age/gen/AgtypeVisitor.java new file mode 100644 index 0000000..016e4c4 --- /dev/null +++ b/age/gen/AgtypeVisitor.java @@ -0,0 +1,110 @@ +// Generated from java-escape by ANTLR 4.11.1 +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by {@link AgtypeParser}. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public interface AgtypeVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by {@link AgtypeParser#agType}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAgType(AgtypeParser.AgTypeContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#agValue}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAgValue(AgtypeParser.AgValueContext ctx); + /** + * Visit a parse tree produced by the {@code StringValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStringValue(AgtypeParser.StringValueContext ctx); + /** + * Visit a parse tree produced by the {@code IntegerValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIntegerValue(AgtypeParser.IntegerValueContext ctx); + /** + * Visit a parse tree produced by the {@code FloatValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFloatValue(AgtypeParser.FloatValueContext ctx); + /** + * Visit a parse tree produced by the {@code TrueBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitTrueBoolean(AgtypeParser.TrueBooleanContext ctx); + /** + * Visit a parse tree produced by the {@code FalseBoolean} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFalseBoolean(AgtypeParser.FalseBooleanContext ctx); + /** + * Visit a parse tree produced by the {@code NullValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNullValue(AgtypeParser.NullValueContext ctx); + /** + * Visit a parse tree produced by the {@code ObjectValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitObjectValue(AgtypeParser.ObjectValueContext ctx); + /** + * Visit a parse tree produced by the {@code ArrayValue} + * labeled alternative in {@link AgtypeParser#value}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitArrayValue(AgtypeParser.ArrayValueContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#obj}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitObj(AgtypeParser.ObjContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#pair}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitPair(AgtypeParser.PairContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#array}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitArray(AgtypeParser.ArrayContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#typeAnnotation}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); + /** + * Visit a parse tree produced by {@link AgtypeParser#floatLiteral}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFloatLiteral(AgtypeParser.FloatLiteralContext ctx); +} \ No newline at end of file diff --git a/age/gen/AgtypeVisitor.py b/age/gen/AgtypeVisitor.py deleted file mode 100644 index eeb2b35..0000000 --- a/age/gen/AgtypeVisitor.py +++ /dev/null @@ -1,88 +0,0 @@ -# Generated from Agtype.g4 by ANTLR 4.9.2 -from antlr4 import * -if __name__ is not None and "." in __name__: - from .AgtypeParser import AgtypeParser -else: - from AgtypeParser import AgtypeParser - -# This class defines a complete generic visitor for a parse tree produced by AgtypeParser. - -class AgtypeVisitor(ParseTreeVisitor): - - # Visit a parse tree produced by AgtypeParser#agType. - def visitAgType(self, ctx:AgtypeParser.AgTypeContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#agValue. - def visitAgValue(self, ctx:AgtypeParser.AgValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#StringValue. - def visitStringValue(self, ctx:AgtypeParser.StringValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#IntegerValue. - def visitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#FloatValue. - def visitFloatValue(self, ctx:AgtypeParser.FloatValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#TrueBoolean. - def visitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#FalseBoolean. - def visitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#NullValue. - def visitNullValue(self, ctx:AgtypeParser.NullValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#ObjectValue. - def visitObjectValue(self, ctx:AgtypeParser.ObjectValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#ArrayValue. - def visitArrayValue(self, ctx:AgtypeParser.ArrayValueContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#obj. - def visitObj(self, ctx:AgtypeParser.ObjContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#pair. - def visitPair(self, ctx:AgtypeParser.PairContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#array. - def visitArray(self, ctx:AgtypeParser.ArrayContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#typeAnnotation. - def visitTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): - return self.visitChildren(ctx) - - - # Visit a parse tree produced by AgtypeParser#floatLiteral. - def visitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): - return self.visitChildren(ctx) - - - -del AgtypeParser \ No newline at end of file diff --git a/age/gen/__init__.py b/age/gen/__init__.py deleted file mode 100644 index e69de29..0000000 From 23764d695b615e15c62b0a9b2771a836ae37e094 Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:06:00 +0200 Subject: [PATCH 3/8] parser generator --- age/gen/AgtypeBaseListener.java | 219 -------- age/gen/AgtypeBaseVisitor.java | 119 ----- age/gen/AgtypeLexer.java | 237 --------- age/gen/AgtypeLexer.py | 135 +++++ age/gen/AgtypeListener.java | 175 ------- age/gen/AgtypeListener.py | 147 ++++++ age/gen/AgtypeParser.java | 862 -------------------------------- age/gen/AgtypeParser.py | 846 +++++++++++++++++++++++++++++++ age/gen/AgtypeVisitor.java | 110 ---- age/gen/AgtypeVisitor.py | 88 ++++ age/gen/__init__.py | 0 11 files changed, 1216 insertions(+), 1722 deletions(-) delete mode 100644 age/gen/AgtypeBaseListener.java delete mode 100644 age/gen/AgtypeBaseVisitor.java delete mode 100644 age/gen/AgtypeLexer.java create mode 100644 age/gen/AgtypeLexer.py delete mode 100644 age/gen/AgtypeListener.java create mode 100644 age/gen/AgtypeListener.py delete mode 100644 age/gen/AgtypeParser.java create mode 100644 age/gen/AgtypeParser.py delete mode 100644 age/gen/AgtypeVisitor.java create mode 100644 age/gen/AgtypeVisitor.py create mode 100644 age/gen/__init__.py diff --git a/age/gen/AgtypeBaseListener.java b/age/gen/AgtypeBaseListener.java deleted file mode 100644 index a1ae8d2..0000000 --- a/age/gen/AgtypeBaseListener.java +++ /dev/null @@ -1,219 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 - -import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.tree.ErrorNode; -import org.antlr.v4.runtime.tree.TerminalNode; - -/** - * This class provides an empty implementation of {@link AgtypeListener}, - * which can be extended to create a listener which only needs to handle a subset - * of the available methods. - */ -@SuppressWarnings("CheckReturnValue") -public class AgtypeBaseListener implements AgtypeListener { - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAgType(AgtypeParser.AgTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAgType(AgtypeParser.AgTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAgValue(AgtypeParser.AgValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAgValue(AgtypeParser.AgValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStringValue(AgtypeParser.StringValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStringValue(AgtypeParser.StringValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIntegerValue(AgtypeParser.IntegerValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIntegerValue(AgtypeParser.IntegerValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFloatValue(AgtypeParser.FloatValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFloatValue(AgtypeParser.FloatValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNullValue(AgtypeParser.NullValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNullValue(AgtypeParser.NullValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObjectValue(AgtypeParser.ObjectValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObjectValue(AgtypeParser.ObjectValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArrayValue(AgtypeParser.ArrayValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArrayValue(AgtypeParser.ArrayValueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObj(AgtypeParser.ObjContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObj(AgtypeParser.ObjContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPair(AgtypeParser.PairContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPair(AgtypeParser.PairContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArray(AgtypeParser.ArrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArray(AgtypeParser.ArrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { } - - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitTerminal(TerminalNode node) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitErrorNode(ErrorNode node) { } -} \ No newline at end of file diff --git a/age/gen/AgtypeBaseVisitor.java b/age/gen/AgtypeBaseVisitor.java deleted file mode 100644 index 3a620e9..0000000 --- a/age/gen/AgtypeBaseVisitor.java +++ /dev/null @@ -1,119 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 -import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; - -/** - * This class provides an empty implementation of {@link AgtypeVisitor}, - * which can be extended to create a visitor which only needs to handle a subset - * of the available methods. - * - * @param The return type of the visit operation. Use {@link Void} for - * operations with no return type. - */ -@SuppressWarnings("CheckReturnValue") -public class AgtypeBaseVisitor extends AbstractParseTreeVisitor implements AgtypeVisitor { - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitAgType(AgtypeParser.AgTypeContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitAgValue(AgtypeParser.AgValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitStringValue(AgtypeParser.StringValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitIntegerValue(AgtypeParser.IntegerValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitFloatValue(AgtypeParser.FloatValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitTrueBoolean(AgtypeParser.TrueBooleanContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitFalseBoolean(AgtypeParser.FalseBooleanContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitNullValue(AgtypeParser.NullValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitObjectValue(AgtypeParser.ObjectValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitArrayValue(AgtypeParser.ArrayValueContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitObj(AgtypeParser.ObjContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitPair(AgtypeParser.PairContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitArray(AgtypeParser.ArrayContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx) { return visitChildren(ctx); } - /** - * {@inheritDoc} - * - *

The default implementation returns the result of calling - * {@link #visitChildren} on {@code ctx}.

- */ - @Override public T visitFloatLiteral(AgtypeParser.FloatLiteralContext ctx) { return visitChildren(ctx); } -} \ No newline at end of file diff --git a/age/gen/AgtypeLexer.java b/age/gen/AgtypeLexer.java deleted file mode 100644 index a7079d4..0000000 --- a/age/gen/AgtypeLexer.java +++ /dev/null @@ -1,237 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 -import org.antlr.v4.runtime.Lexer; -import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.Token; -import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.atn.*; -import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.misc.*; - -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) -public class AgtypeLexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, IDENT=14, STRING=15, INTEGER=16, - RegularFloat=17, ExponentFloat=18, WS=19; - public static String[] channelNames = { - "DEFAULT_TOKEN_CHANNEL", "HIDDEN" - }; - - public static String[] modeNames = { - "DEFAULT_MODE" - }; - - private static String[] makeRuleNames() { - return new String[] { - "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", - "T__9", "T__10", "T__11", "T__12", "IDENT", "STRING", "ESC", "UNICODE", - "HEX", "SAFECODEPOINT", "INTEGER", "INT", "RegularFloat", "ExponentFloat", - "DECIMAL", "SCIENTIFIC", "WS" - }; - } - public static final String[] ruleNames = makeRuleNames(); - - private static String[] makeLiteralNames() { - return new String[] { - null, "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", - "']'", "'::'", "'-'", "'Infinity'", "'NaN'" - }; - } - private static final String[] _LITERAL_NAMES = makeLiteralNames(); - private static String[] makeSymbolicNames() { - return new String[] { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", - "WS" - }; - } - private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - - public AgtypeLexer(CharStream input) { - super(input); - _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - @Override - public String getGrammarFileName() { return "Agtype.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public String[] getChannelNames() { return channelNames; } - - @Override - public String[] getModeNames() { return modeNames; } - - @Override - public ATN getATN() { return _ATN; } - - public static final String _serializedATN = - "\u0004\u0000\u0013\u00b7\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+ - "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+ - "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+ - "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+ - "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"+ - "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"+ - "\u0002\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014"+ - "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"+ - "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0001\u0000\u0001\u0000"+ - "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001"+ - "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002"+ - "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+ - "\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+ - "\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001"+ - "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ - "\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0005"+ - "\rf\b\r\n\r\f\ri\t\r\u0001\u000e\u0001\u000e\u0001\u000e\u0005\u000en"+ - "\b\u000e\n\u000e\f\u000eq\t\u000e\u0001\u000e\u0001\u000e\u0001\u000f"+ - "\u0001\u000f\u0001\u000f\u0003\u000fx\b\u000f\u0001\u0010\u0001\u0010"+ - "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+ - "\u0001\u0012\u0001\u0012\u0001\u0013\u0003\u0013\u0085\b\u0013\u0001\u0013"+ - "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0005\u0014\u008c\b\u0014"+ - "\n\u0014\f\u0014\u008f\t\u0014\u0003\u0014\u0091\b\u0014\u0001\u0015\u0003"+ - "\u0015\u0094\b\u0015\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0003"+ - "\u0016\u009a\b\u0016\u0001\u0016\u0001\u0016\u0003\u0016\u009e\b\u0016"+ - "\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0004\u0017\u00a4\b\u0017"+ - "\u000b\u0017\f\u0017\u00a5\u0001\u0018\u0001\u0018\u0003\u0018\u00aa\b"+ - "\u0018\u0001\u0018\u0004\u0018\u00ad\b\u0018\u000b\u0018\f\u0018\u00ae"+ - "\u0001\u0019\u0004\u0019\u00b2\b\u0019\u000b\u0019\f\u0019\u00b3\u0001"+ - "\u0019\u0001\u0019\u0000\u0000\u001a\u0001\u0001\u0003\u0002\u0005\u0003"+ - "\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015"+ - "\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0000!\u0000#\u0000"+ - "%\u0000\'\u0010)\u0000+\u0011-\u0012/\u00001\u00003\u0013\u0001\u0000"+ - "\n\u0003\u0000AZ__az\u0005\u0000$$09AZ__az\b\u0000\"\"//\\\\bbffnnrrt"+ - "t\u0003\u000009AFaf\u0003\u0000\u0000\u001f\"\"\\\\\u0001\u000019\u0001"+ - "\u000009\u0002\u0000EEee\u0002\u0000++--\u0003\u0000\t\n\r\r \u00bd\u0000"+ - "\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000"+ - "\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000"+ - "\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r"+ - "\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011"+ - "\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015"+ - "\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019"+ - "\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d"+ - "\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000+\u0001"+ - "\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000"+ - "\u0000\u00015\u0001\u0000\u0000\u0000\u0003:\u0001\u0000\u0000\u0000\u0005"+ - "@\u0001\u0000\u0000\u0000\u0007E\u0001\u0000\u0000\u0000\tG\u0001\u0000"+ - "\u0000\u0000\u000bI\u0001\u0000\u0000\u0000\rK\u0001\u0000\u0000\u0000"+ - "\u000fM\u0001\u0000\u0000\u0000\u0011O\u0001\u0000\u0000\u0000\u0013Q"+ - "\u0001\u0000\u0000\u0000\u0015T\u0001\u0000\u0000\u0000\u0017V\u0001\u0000"+ - "\u0000\u0000\u0019_\u0001\u0000\u0000\u0000\u001bc\u0001\u0000\u0000\u0000"+ - "\u001dj\u0001\u0000\u0000\u0000\u001ft\u0001\u0000\u0000\u0000!y\u0001"+ - "\u0000\u0000\u0000#\u007f\u0001\u0000\u0000\u0000%\u0081\u0001\u0000\u0000"+ - "\u0000\'\u0084\u0001\u0000\u0000\u0000)\u0090\u0001\u0000\u0000\u0000"+ - "+\u0093\u0001\u0000\u0000\u0000-\u0099\u0001\u0000\u0000\u0000/\u00a1"+ - "\u0001\u0000\u0000\u00001\u00a7\u0001\u0000\u0000\u00003\u00b1\u0001\u0000"+ - "\u0000\u000056\u0005t\u0000\u000067\u0005r\u0000\u000078\u0005u\u0000"+ - "\u000089\u0005e\u0000\u00009\u0002\u0001\u0000\u0000\u0000:;\u0005f\u0000"+ - "\u0000;<\u0005a\u0000\u0000<=\u0005l\u0000\u0000=>\u0005s\u0000\u0000"+ - ">?\u0005e\u0000\u0000?\u0004\u0001\u0000\u0000\u0000@A\u0005n\u0000\u0000"+ - "AB\u0005u\u0000\u0000BC\u0005l\u0000\u0000CD\u0005l\u0000\u0000D\u0006"+ - "\u0001\u0000\u0000\u0000EF\u0005{\u0000\u0000F\b\u0001\u0000\u0000\u0000"+ - "GH\u0005,\u0000\u0000H\n\u0001\u0000\u0000\u0000IJ\u0005}\u0000\u0000"+ - "J\f\u0001\u0000\u0000\u0000KL\u0005:\u0000\u0000L\u000e\u0001\u0000\u0000"+ - "\u0000MN\u0005[\u0000\u0000N\u0010\u0001\u0000\u0000\u0000OP\u0005]\u0000"+ - "\u0000P\u0012\u0001\u0000\u0000\u0000QR\u0005:\u0000\u0000RS\u0005:\u0000"+ - "\u0000S\u0014\u0001\u0000\u0000\u0000TU\u0005-\u0000\u0000U\u0016\u0001"+ - "\u0000\u0000\u0000VW\u0005I\u0000\u0000WX\u0005n\u0000\u0000XY\u0005f"+ - "\u0000\u0000YZ\u0005i\u0000\u0000Z[\u0005n\u0000\u0000[\\\u0005i\u0000"+ - "\u0000\\]\u0005t\u0000\u0000]^\u0005y\u0000\u0000^\u0018\u0001\u0000\u0000"+ - "\u0000_`\u0005N\u0000\u0000`a\u0005a\u0000\u0000ab\u0005N\u0000\u0000"+ - "b\u001a\u0001\u0000\u0000\u0000cg\u0007\u0000\u0000\u0000df\u0007\u0001"+ - "\u0000\u0000ed\u0001\u0000\u0000\u0000fi\u0001\u0000\u0000\u0000ge\u0001"+ - "\u0000\u0000\u0000gh\u0001\u0000\u0000\u0000h\u001c\u0001\u0000\u0000"+ - "\u0000ig\u0001\u0000\u0000\u0000jo\u0005\"\u0000\u0000kn\u0003\u001f\u000f"+ - "\u0000ln\u0003%\u0012\u0000mk\u0001\u0000\u0000\u0000ml\u0001\u0000\u0000"+ - "\u0000nq\u0001\u0000\u0000\u0000om\u0001\u0000\u0000\u0000op\u0001\u0000"+ - "\u0000\u0000pr\u0001\u0000\u0000\u0000qo\u0001\u0000\u0000\u0000rs\u0005"+ - "\"\u0000\u0000s\u001e\u0001\u0000\u0000\u0000tw\u0005\\\u0000\u0000ux"+ - "\u0007\u0002\u0000\u0000vx\u0003!\u0010\u0000wu\u0001\u0000\u0000\u0000"+ - "wv\u0001\u0000\u0000\u0000x \u0001\u0000\u0000\u0000yz\u0005u\u0000\u0000"+ - "z{\u0003#\u0011\u0000{|\u0003#\u0011\u0000|}\u0003#\u0011\u0000}~\u0003"+ - "#\u0011\u0000~\"\u0001\u0000\u0000\u0000\u007f\u0080\u0007\u0003\u0000"+ - "\u0000\u0080$\u0001\u0000\u0000\u0000\u0081\u0082\b\u0004\u0000\u0000"+ - "\u0082&\u0001\u0000\u0000\u0000\u0083\u0085\u0005-\u0000\u0000\u0084\u0083"+ - "\u0001\u0000\u0000\u0000\u0084\u0085\u0001\u0000\u0000\u0000\u0085\u0086"+ - "\u0001\u0000\u0000\u0000\u0086\u0087\u0003)\u0014\u0000\u0087(\u0001\u0000"+ - "\u0000\u0000\u0088\u0091\u00050\u0000\u0000\u0089\u008d\u0007\u0005\u0000"+ - "\u0000\u008a\u008c\u0007\u0006\u0000\u0000\u008b\u008a\u0001\u0000\u0000"+ - "\u0000\u008c\u008f\u0001\u0000\u0000\u0000\u008d\u008b\u0001\u0000\u0000"+ - "\u0000\u008d\u008e\u0001\u0000\u0000\u0000\u008e\u0091\u0001\u0000\u0000"+ - "\u0000\u008f\u008d\u0001\u0000\u0000\u0000\u0090\u0088\u0001\u0000\u0000"+ - "\u0000\u0090\u0089\u0001\u0000\u0000\u0000\u0091*\u0001\u0000\u0000\u0000"+ - "\u0092\u0094\u0005-\u0000\u0000\u0093\u0092\u0001\u0000\u0000\u0000\u0093"+ - "\u0094\u0001\u0000\u0000\u0000\u0094\u0095\u0001\u0000\u0000\u0000\u0095"+ - "\u0096\u0003)\u0014\u0000\u0096\u0097\u0003/\u0017\u0000\u0097,\u0001"+ - "\u0000\u0000\u0000\u0098\u009a\u0005-\u0000\u0000\u0099\u0098\u0001\u0000"+ - "\u0000\u0000\u0099\u009a\u0001\u0000\u0000\u0000\u009a\u009b\u0001\u0000"+ - "\u0000\u0000\u009b\u009d\u0003)\u0014\u0000\u009c\u009e\u0003/\u0017\u0000"+ - "\u009d\u009c\u0001\u0000\u0000\u0000\u009d\u009e\u0001\u0000\u0000\u0000"+ - "\u009e\u009f\u0001\u0000\u0000\u0000\u009f\u00a0\u00031\u0018\u0000\u00a0"+ - ".\u0001\u0000\u0000\u0000\u00a1\u00a3\u0005.\u0000\u0000\u00a2\u00a4\u0007"+ - "\u0006\u0000\u0000\u00a3\u00a2\u0001\u0000\u0000\u0000\u00a4\u00a5\u0001"+ - "\u0000\u0000\u0000\u00a5\u00a3\u0001\u0000\u0000\u0000\u00a5\u00a6\u0001"+ - "\u0000\u0000\u0000\u00a60\u0001\u0000\u0000\u0000\u00a7\u00a9\u0007\u0007"+ - "\u0000\u0000\u00a8\u00aa\u0007\b\u0000\u0000\u00a9\u00a8\u0001\u0000\u0000"+ - "\u0000\u00a9\u00aa\u0001\u0000\u0000\u0000\u00aa\u00ac\u0001\u0000\u0000"+ - "\u0000\u00ab\u00ad\u0007\u0006\u0000\u0000\u00ac\u00ab\u0001\u0000\u0000"+ - "\u0000\u00ad\u00ae\u0001\u0000\u0000\u0000\u00ae\u00ac\u0001\u0000\u0000"+ - "\u0000\u00ae\u00af\u0001\u0000\u0000\u0000\u00af2\u0001\u0000\u0000\u0000"+ - "\u00b0\u00b2\u0007\t\u0000\u0000\u00b1\u00b0\u0001\u0000\u0000\u0000\u00b2"+ - "\u00b3\u0001\u0000\u0000\u0000\u00b3\u00b1\u0001\u0000\u0000\u0000\u00b3"+ - "\u00b4\u0001\u0000\u0000\u0000\u00b4\u00b5\u0001\u0000\u0000\u0000\u00b5"+ - "\u00b6\u0006\u0019\u0000\u0000\u00b64\u0001\u0000\u0000\u0000\u000f\u0000"+ - "gmow\u0084\u008d\u0090\u0093\u0099\u009d\u00a5\u00a9\u00ae\u00b3\u0001"+ - "\u0006\u0000\u0000"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/age/gen/AgtypeLexer.py b/age/gen/AgtypeLexer.py new file mode 100644 index 0000000..b286b83 --- /dev/null +++ b/age/gen/AgtypeLexer.py @@ -0,0 +1,135 @@ +# Generated from antlr/Agtype.g4 by ANTLR 4.11.1 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,19,183,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, + 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, + 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,1, + 0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1, + 3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,10,1, + 10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1, + 12,1,13,1,13,5,13,102,8,13,10,13,12,13,105,9,13,1,14,1,14,1,14,5, + 14,110,8,14,10,14,12,14,113,9,14,1,14,1,14,1,15,1,15,1,15,3,15,120, + 8,15,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,18,1,18,1,19,3,19, + 133,8,19,1,19,1,19,1,20,1,20,1,20,5,20,140,8,20,10,20,12,20,143, + 9,20,3,20,145,8,20,1,21,3,21,148,8,21,1,21,1,21,1,21,1,22,3,22,154, + 8,22,1,22,1,22,3,22,158,8,22,1,22,1,22,1,23,1,23,4,23,164,8,23,11, + 23,12,23,165,1,24,1,24,3,24,170,8,24,1,24,4,24,173,8,24,11,24,12, + 24,174,1,25,4,25,178,8,25,11,25,12,25,179,1,25,1,25,0,0,26,1,1,3, + 2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14, + 29,15,31,0,33,0,35,0,37,0,39,16,41,0,43,17,45,18,47,0,49,0,51,19, + 1,0,10,3,0,65,90,95,95,97,122,5,0,36,36,48,57,65,90,95,95,97,122, + 8,0,34,34,47,47,92,92,98,98,102,102,110,110,114,114,116,116,3,0, + 48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0,49,57,1,0,48,57,2,0, + 69,69,101,101,2,0,43,43,45,45,3,0,9,10,13,13,32,32,189,0,1,1,0,0, + 0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0, + 13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0, + 23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,39,1,0,0,0,0, + 43,1,0,0,0,0,45,1,0,0,0,0,51,1,0,0,0,1,53,1,0,0,0,3,58,1,0,0,0,5, + 64,1,0,0,0,7,69,1,0,0,0,9,71,1,0,0,0,11,73,1,0,0,0,13,75,1,0,0,0, + 15,77,1,0,0,0,17,79,1,0,0,0,19,81,1,0,0,0,21,84,1,0,0,0,23,86,1, + 0,0,0,25,95,1,0,0,0,27,99,1,0,0,0,29,106,1,0,0,0,31,116,1,0,0,0, + 33,121,1,0,0,0,35,127,1,0,0,0,37,129,1,0,0,0,39,132,1,0,0,0,41,144, + 1,0,0,0,43,147,1,0,0,0,45,153,1,0,0,0,47,161,1,0,0,0,49,167,1,0, + 0,0,51,177,1,0,0,0,53,54,5,116,0,0,54,55,5,114,0,0,55,56,5,117,0, + 0,56,57,5,101,0,0,57,2,1,0,0,0,58,59,5,102,0,0,59,60,5,97,0,0,60, + 61,5,108,0,0,61,62,5,115,0,0,62,63,5,101,0,0,63,4,1,0,0,0,64,65, + 5,110,0,0,65,66,5,117,0,0,66,67,5,108,0,0,67,68,5,108,0,0,68,6,1, + 0,0,0,69,70,5,123,0,0,70,8,1,0,0,0,71,72,5,44,0,0,72,10,1,0,0,0, + 73,74,5,125,0,0,74,12,1,0,0,0,75,76,5,58,0,0,76,14,1,0,0,0,77,78, + 5,91,0,0,78,16,1,0,0,0,79,80,5,93,0,0,80,18,1,0,0,0,81,82,5,58,0, + 0,82,83,5,58,0,0,83,20,1,0,0,0,84,85,5,45,0,0,85,22,1,0,0,0,86,87, + 5,73,0,0,87,88,5,110,0,0,88,89,5,102,0,0,89,90,5,105,0,0,90,91,5, + 110,0,0,91,92,5,105,0,0,92,93,5,116,0,0,93,94,5,121,0,0,94,24,1, + 0,0,0,95,96,5,78,0,0,96,97,5,97,0,0,97,98,5,78,0,0,98,26,1,0,0,0, + 99,103,7,0,0,0,100,102,7,1,0,0,101,100,1,0,0,0,102,105,1,0,0,0,103, + 101,1,0,0,0,103,104,1,0,0,0,104,28,1,0,0,0,105,103,1,0,0,0,106,111, + 5,34,0,0,107,110,3,31,15,0,108,110,3,37,18,0,109,107,1,0,0,0,109, + 108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112, + 114,1,0,0,0,113,111,1,0,0,0,114,115,5,34,0,0,115,30,1,0,0,0,116, + 119,5,92,0,0,117,120,7,2,0,0,118,120,3,33,16,0,119,117,1,0,0,0,119, + 118,1,0,0,0,120,32,1,0,0,0,121,122,5,117,0,0,122,123,3,35,17,0,123, + 124,3,35,17,0,124,125,3,35,17,0,125,126,3,35,17,0,126,34,1,0,0,0, + 127,128,7,3,0,0,128,36,1,0,0,0,129,130,8,4,0,0,130,38,1,0,0,0,131, + 133,5,45,0,0,132,131,1,0,0,0,132,133,1,0,0,0,133,134,1,0,0,0,134, + 135,3,41,20,0,135,40,1,0,0,0,136,145,5,48,0,0,137,141,7,5,0,0,138, + 140,7,6,0,0,139,138,1,0,0,0,140,143,1,0,0,0,141,139,1,0,0,0,141, + 142,1,0,0,0,142,145,1,0,0,0,143,141,1,0,0,0,144,136,1,0,0,0,144, + 137,1,0,0,0,145,42,1,0,0,0,146,148,5,45,0,0,147,146,1,0,0,0,147, + 148,1,0,0,0,148,149,1,0,0,0,149,150,3,41,20,0,150,151,3,47,23,0, + 151,44,1,0,0,0,152,154,5,45,0,0,153,152,1,0,0,0,153,154,1,0,0,0, + 154,155,1,0,0,0,155,157,3,41,20,0,156,158,3,47,23,0,157,156,1,0, + 0,0,157,158,1,0,0,0,158,159,1,0,0,0,159,160,3,49,24,0,160,46,1,0, + 0,0,161,163,5,46,0,0,162,164,7,6,0,0,163,162,1,0,0,0,164,165,1,0, + 0,0,165,163,1,0,0,0,165,166,1,0,0,0,166,48,1,0,0,0,167,169,7,7,0, + 0,168,170,7,8,0,0,169,168,1,0,0,0,169,170,1,0,0,0,170,172,1,0,0, + 0,171,173,7,6,0,0,172,171,1,0,0,0,173,174,1,0,0,0,174,172,1,0,0, + 0,174,175,1,0,0,0,175,50,1,0,0,0,176,178,7,9,0,0,177,176,1,0,0,0, + 178,179,1,0,0,0,179,177,1,0,0,0,179,180,1,0,0,0,180,181,1,0,0,0, + 181,182,6,25,0,0,182,52,1,0,0,0,15,0,103,109,111,119,132,141,144, + 147,153,157,165,169,174,179,1,6,0,0 + ] + +class AgtypeLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + T__0 = 1 + T__1 = 2 + T__2 = 3 + T__3 = 4 + T__4 = 5 + T__5 = 6 + T__6 = 7 + T__7 = 8 + T__8 = 9 + T__9 = 10 + T__10 = 11 + T__11 = 12 + T__12 = 13 + IDENT = 14 + STRING = 15 + INTEGER = 16 + RegularFloat = 17 + ExponentFloat = 18 + WS = 19 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", + "']'", "'::'", "'-'", "'Infinity'", "'NaN'" ] + + symbolicNames = [ "", + "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", + "WS" ] + + ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", + "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "IDENT", + "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINT", "INTEGER", + "INT", "RegularFloat", "ExponentFloat", "DECIMAL", "SCIENTIFIC", + "WS" ] + + grammarFileName = "Agtype.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.11.1") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/age/gen/AgtypeListener.java b/age/gen/AgtypeListener.java deleted file mode 100644 index e153444..0000000 --- a/age/gen/AgtypeListener.java +++ /dev/null @@ -1,175 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 -import org.antlr.v4.runtime.tree.ParseTreeListener; - -/** - * This interface defines a complete listener for a parse tree produced by - * {@link AgtypeParser}. - */ -public interface AgtypeListener extends ParseTreeListener { - /** - * Enter a parse tree produced by {@link AgtypeParser#agType}. - * @param ctx the parse tree - */ - void enterAgType(AgtypeParser.AgTypeContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#agType}. - * @param ctx the parse tree - */ - void exitAgType(AgtypeParser.AgTypeContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#agValue}. - * @param ctx the parse tree - */ - void enterAgValue(AgtypeParser.AgValueContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#agValue}. - * @param ctx the parse tree - */ - void exitAgValue(AgtypeParser.AgValueContext ctx); - /** - * Enter a parse tree produced by the {@code StringValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterStringValue(AgtypeParser.StringValueContext ctx); - /** - * Exit a parse tree produced by the {@code StringValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitStringValue(AgtypeParser.StringValueContext ctx); - /** - * Enter a parse tree produced by the {@code IntegerValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterIntegerValue(AgtypeParser.IntegerValueContext ctx); - /** - * Exit a parse tree produced by the {@code IntegerValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitIntegerValue(AgtypeParser.IntegerValueContext ctx); - /** - * Enter a parse tree produced by the {@code FloatValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterFloatValue(AgtypeParser.FloatValueContext ctx); - /** - * Exit a parse tree produced by the {@code FloatValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitFloatValue(AgtypeParser.FloatValueContext ctx); - /** - * Enter a parse tree produced by the {@code TrueBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterTrueBoolean(AgtypeParser.TrueBooleanContext ctx); - /** - * Exit a parse tree produced by the {@code TrueBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitTrueBoolean(AgtypeParser.TrueBooleanContext ctx); - /** - * Enter a parse tree produced by the {@code FalseBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterFalseBoolean(AgtypeParser.FalseBooleanContext ctx); - /** - * Exit a parse tree produced by the {@code FalseBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitFalseBoolean(AgtypeParser.FalseBooleanContext ctx); - /** - * Enter a parse tree produced by the {@code NullValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterNullValue(AgtypeParser.NullValueContext ctx); - /** - * Exit a parse tree produced by the {@code NullValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitNullValue(AgtypeParser.NullValueContext ctx); - /** - * Enter a parse tree produced by the {@code ObjectValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterObjectValue(AgtypeParser.ObjectValueContext ctx); - /** - * Exit a parse tree produced by the {@code ObjectValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitObjectValue(AgtypeParser.ObjectValueContext ctx); - /** - * Enter a parse tree produced by the {@code ArrayValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void enterArrayValue(AgtypeParser.ArrayValueContext ctx); - /** - * Exit a parse tree produced by the {@code ArrayValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - */ - void exitArrayValue(AgtypeParser.ArrayValueContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#obj}. - * @param ctx the parse tree - */ - void enterObj(AgtypeParser.ObjContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#obj}. - * @param ctx the parse tree - */ - void exitObj(AgtypeParser.ObjContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#pair}. - * @param ctx the parse tree - */ - void enterPair(AgtypeParser.PairContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#pair}. - * @param ctx the parse tree - */ - void exitPair(AgtypeParser.PairContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#array}. - * @param ctx the parse tree - */ - void enterArray(AgtypeParser.ArrayContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#array}. - * @param ctx the parse tree - */ - void exitArray(AgtypeParser.ArrayContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#typeAnnotation}. - * @param ctx the parse tree - */ - void enterTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#typeAnnotation}. - * @param ctx the parse tree - */ - void exitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); - /** - * Enter a parse tree produced by {@link AgtypeParser#floatLiteral}. - * @param ctx the parse tree - */ - void enterFloatLiteral(AgtypeParser.FloatLiteralContext ctx); - /** - * Exit a parse tree produced by {@link AgtypeParser#floatLiteral}. - * @param ctx the parse tree - */ - void exitFloatLiteral(AgtypeParser.FloatLiteralContext ctx); -} \ No newline at end of file diff --git a/age/gen/AgtypeListener.py b/age/gen/AgtypeListener.py new file mode 100644 index 0000000..1f239f5 --- /dev/null +++ b/age/gen/AgtypeListener.py @@ -0,0 +1,147 @@ +# Generated from antlr/Agtype.g4 by ANTLR 4.11.1 +from antlr4 import * +if __name__ is not None and "." in __name__: + from .AgtypeParser import AgtypeParser +else: + from AgtypeParser import AgtypeParser + +# This class defines a complete listener for a parse tree produced by AgtypeParser. +class AgtypeListener(ParseTreeListener): + + # Enter a parse tree produced by AgtypeParser#agType. + def enterAgType(self, ctx:AgtypeParser.AgTypeContext): + pass + + # Exit a parse tree produced by AgtypeParser#agType. + def exitAgType(self, ctx:AgtypeParser.AgTypeContext): + pass + + + # Enter a parse tree produced by AgtypeParser#agValue. + def enterAgValue(self, ctx:AgtypeParser.AgValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#agValue. + def exitAgValue(self, ctx:AgtypeParser.AgValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#StringValue. + def enterStringValue(self, ctx:AgtypeParser.StringValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#StringValue. + def exitStringValue(self, ctx:AgtypeParser.StringValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#IntegerValue. + def enterIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#IntegerValue. + def exitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#FloatValue. + def enterFloatValue(self, ctx:AgtypeParser.FloatValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#FloatValue. + def exitFloatValue(self, ctx:AgtypeParser.FloatValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#TrueBoolean. + def enterTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): + pass + + # Exit a parse tree produced by AgtypeParser#TrueBoolean. + def exitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): + pass + + + # Enter a parse tree produced by AgtypeParser#FalseBoolean. + def enterFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): + pass + + # Exit a parse tree produced by AgtypeParser#FalseBoolean. + def exitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): + pass + + + # Enter a parse tree produced by AgtypeParser#NullValue. + def enterNullValue(self, ctx:AgtypeParser.NullValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#NullValue. + def exitNullValue(self, ctx:AgtypeParser.NullValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#ObjectValue. + def enterObjectValue(self, ctx:AgtypeParser.ObjectValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#ObjectValue. + def exitObjectValue(self, ctx:AgtypeParser.ObjectValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#ArrayValue. + def enterArrayValue(self, ctx:AgtypeParser.ArrayValueContext): + pass + + # Exit a parse tree produced by AgtypeParser#ArrayValue. + def exitArrayValue(self, ctx:AgtypeParser.ArrayValueContext): + pass + + + # Enter a parse tree produced by AgtypeParser#obj. + def enterObj(self, ctx:AgtypeParser.ObjContext): + pass + + # Exit a parse tree produced by AgtypeParser#obj. + def exitObj(self, ctx:AgtypeParser.ObjContext): + pass + + + # Enter a parse tree produced by AgtypeParser#pair. + def enterPair(self, ctx:AgtypeParser.PairContext): + pass + + # Exit a parse tree produced by AgtypeParser#pair. + def exitPair(self, ctx:AgtypeParser.PairContext): + pass + + + # Enter a parse tree produced by AgtypeParser#array. + def enterArray(self, ctx:AgtypeParser.ArrayContext): + pass + + # Exit a parse tree produced by AgtypeParser#array. + def exitArray(self, ctx:AgtypeParser.ArrayContext): + pass + + + # Enter a parse tree produced by AgtypeParser#typeAnnotation. + def enterTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): + pass + + # Exit a parse tree produced by AgtypeParser#typeAnnotation. + def exitTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): + pass + + + # Enter a parse tree produced by AgtypeParser#floatLiteral. + def enterFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): + pass + + # Exit a parse tree produced by AgtypeParser#floatLiteral. + def exitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): + pass + + + +del AgtypeParser \ No newline at end of file diff --git a/age/gen/AgtypeParser.java b/age/gen/AgtypeParser.java deleted file mode 100644 index 2c23c22..0000000 --- a/age/gen/AgtypeParser.java +++ /dev/null @@ -1,862 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 -import org.antlr.v4.runtime.atn.*; -import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; -import org.antlr.v4.runtime.tree.*; -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; - -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) -public class AgtypeParser extends Parser { - static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, IDENT=14, STRING=15, INTEGER=16, - RegularFloat=17, ExponentFloat=18, WS=19; - public static final int - RULE_agType = 0, RULE_agValue = 1, RULE_value = 2, RULE_obj = 3, RULE_pair = 4, - RULE_array = 5, RULE_typeAnnotation = 6, RULE_floatLiteral = 7; - private static String[] makeRuleNames() { - return new String[] { - "agType", "agValue", "value", "obj", "pair", "array", "typeAnnotation", - "floatLiteral" - }; - } - public static final String[] ruleNames = makeRuleNames(); - - private static String[] makeLiteralNames() { - return new String[] { - null, "'true'", "'false'", "'null'", "'{'", "','", "'}'", "':'", "'['", - "']'", "'::'", "'-'", "'Infinity'", "'NaN'" - }; - } - private static final String[] _LITERAL_NAMES = makeLiteralNames(); - private static String[] makeSymbolicNames() { - return new String[] { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, "IDENT", "STRING", "INTEGER", "RegularFloat", "ExponentFloat", - "WS" - }; - } - private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - @Override - public String getGrammarFileName() { return "java-escape"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public ATN getATN() { return _ATN; } - - public AgtypeParser(TokenStream input) { - super(input); - _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - @SuppressWarnings("CheckReturnValue") - public static class AgTypeContext extends ParserRuleContext { - public AgValueContext agValue() { - return getRuleContext(AgValueContext.class,0); - } - public TerminalNode EOF() { return getToken(AgtypeParser.EOF, 0); } - public AgTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_agType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterAgType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitAgType(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitAgType(this); - else return visitor.visitChildren(this); - } - } - - public final AgTypeContext agType() throws RecognitionException { - AgTypeContext _localctx = new AgTypeContext(_ctx, getState()); - enterRule(_localctx, 0, RULE_agType); - try { - enterOuterAlt(_localctx, 1); - { - setState(16); - agValue(); - setState(17); - match(EOF); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class AgValueContext extends ParserRuleContext { - public ValueContext value() { - return getRuleContext(ValueContext.class,0); - } - public TypeAnnotationContext typeAnnotation() { - return getRuleContext(TypeAnnotationContext.class,0); - } - public AgValueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_agValue; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterAgValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitAgValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitAgValue(this); - else return visitor.visitChildren(this); - } - } - - public final AgValueContext agValue() throws RecognitionException { - AgValueContext _localctx = new AgValueContext(_ctx, getState()); - enterRule(_localctx, 2, RULE_agValue); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(19); - value(); - setState(21); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==T__9) { - { - setState(20); - typeAnnotation(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ValueContext extends ParserRuleContext { - public ValueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_value; } - - public ValueContext() { } - public void copyFrom(ValueContext ctx) { - super.copyFrom(ctx); - } - } - @SuppressWarnings("CheckReturnValue") - public static class NullValueContext extends ValueContext { - public NullValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterNullValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitNullValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitNullValue(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class ObjectValueContext extends ValueContext { - public ObjContext obj() { - return getRuleContext(ObjContext.class,0); - } - public ObjectValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterObjectValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitObjectValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitObjectValue(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class IntegerValueContext extends ValueContext { - public TerminalNode INTEGER() { return getToken(AgtypeParser.INTEGER, 0); } - public IntegerValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterIntegerValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitIntegerValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitIntegerValue(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class TrueBooleanContext extends ValueContext { - public TrueBooleanContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterTrueBoolean(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitTrueBoolean(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitTrueBoolean(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class FalseBooleanContext extends ValueContext { - public FalseBooleanContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFalseBoolean(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFalseBoolean(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFalseBoolean(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class FloatValueContext extends ValueContext { - public FloatLiteralContext floatLiteral() { - return getRuleContext(FloatLiteralContext.class,0); - } - public FloatValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFloatValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFloatValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFloatValue(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class StringValueContext extends ValueContext { - public TerminalNode STRING() { return getToken(AgtypeParser.STRING, 0); } - public StringValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterStringValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitStringValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitStringValue(this); - else return visitor.visitChildren(this); - } - } - @SuppressWarnings("CheckReturnValue") - public static class ArrayValueContext extends ValueContext { - public ArrayContext array() { - return getRuleContext(ArrayContext.class,0); - } - public ArrayValueContext(ValueContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterArrayValue(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitArrayValue(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitArrayValue(this); - else return visitor.visitChildren(this); - } - } - - public final ValueContext value() throws RecognitionException { - ValueContext _localctx = new ValueContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_value); - try { - setState(31); - _errHandler.sync(this); - switch (_input.LA(1)) { - case STRING: - _localctx = new StringValueContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(23); - match(STRING); - } - break; - case INTEGER: - _localctx = new IntegerValueContext(_localctx); - enterOuterAlt(_localctx, 2); - { - setState(24); - match(INTEGER); - } - break; - case T__10: - case T__11: - case T__12: - case RegularFloat: - case ExponentFloat: - _localctx = new FloatValueContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(25); - floatLiteral(); - } - break; - case T__0: - _localctx = new TrueBooleanContext(_localctx); - enterOuterAlt(_localctx, 4); - { - setState(26); - match(T__0); - } - break; - case T__1: - _localctx = new FalseBooleanContext(_localctx); - enterOuterAlt(_localctx, 5); - { - setState(27); - match(T__1); - } - break; - case T__2: - _localctx = new NullValueContext(_localctx); - enterOuterAlt(_localctx, 6); - { - setState(28); - match(T__2); - } - break; - case T__3: - _localctx = new ObjectValueContext(_localctx); - enterOuterAlt(_localctx, 7); - { - setState(29); - obj(); - } - break; - case T__7: - _localctx = new ArrayValueContext(_localctx); - enterOuterAlt(_localctx, 8); - { - setState(30); - array(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ObjContext extends ParserRuleContext { - public List pair() { - return getRuleContexts(PairContext.class); - } - public PairContext pair(int i) { - return getRuleContext(PairContext.class,i); - } - public ObjContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_obj; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterObj(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitObj(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitObj(this); - else return visitor.visitChildren(this); - } - } - - public final ObjContext obj() throws RecognitionException { - ObjContext _localctx = new ObjContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_obj); - int _la; - try { - setState(46); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(33); - match(T__3); - setState(34); - pair(); - setState(39); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==T__4) { - { - { - setState(35); - match(T__4); - setState(36); - pair(); - } - } - setState(41); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(42); - match(T__5); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(44); - match(T__3); - setState(45); - match(T__5); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class PairContext extends ParserRuleContext { - public TerminalNode STRING() { return getToken(AgtypeParser.STRING, 0); } - public AgValueContext agValue() { - return getRuleContext(AgValueContext.class,0); - } - public PairContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_pair; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterPair(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitPair(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitPair(this); - else return visitor.visitChildren(this); - } - } - - public final PairContext pair() throws RecognitionException { - PairContext _localctx = new PairContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_pair); - try { - enterOuterAlt(_localctx, 1); - { - setState(48); - match(STRING); - setState(49); - match(T__6); - setState(50); - agValue(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class ArrayContext extends ParserRuleContext { - public List agValue() { - return getRuleContexts(AgValueContext.class); - } - public AgValueContext agValue(int i) { - return getRuleContext(AgValueContext.class,i); - } - public ArrayContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_array; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterArray(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitArray(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitArray(this); - else return visitor.visitChildren(this); - } - } - - public final ArrayContext array() throws RecognitionException { - ArrayContext _localctx = new ArrayContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_array); - int _la; - try { - setState(65); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(52); - match(T__7); - setState(53); - agValue(); - setState(58); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==T__4) { - { - { - setState(54); - match(T__4); - setState(55); - agValue(); - } - } - setState(60); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(61); - match(T__8); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(63); - match(T__7); - setState(64); - match(T__8); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class TypeAnnotationContext extends ParserRuleContext { - public TerminalNode IDENT() { return getToken(AgtypeParser.IDENT, 0); } - public TypeAnnotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typeAnnotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterTypeAnnotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitTypeAnnotation(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitTypeAnnotation(this); - else return visitor.visitChildren(this); - } - } - - public final TypeAnnotationContext typeAnnotation() throws RecognitionException { - TypeAnnotationContext _localctx = new TypeAnnotationContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_typeAnnotation); - try { - enterOuterAlt(_localctx, 1); - { - setState(67); - match(T__9); - setState(68); - match(IDENT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - @SuppressWarnings("CheckReturnValue") - public static class FloatLiteralContext extends ParserRuleContext { - public TerminalNode RegularFloat() { return getToken(AgtypeParser.RegularFloat, 0); } - public TerminalNode ExponentFloat() { return getToken(AgtypeParser.ExponentFloat, 0); } - public FloatLiteralContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_floatLiteral; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).enterFloatLiteral(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof AgtypeListener ) ((AgtypeListener)listener).exitFloatLiteral(this); - } - @Override - public T accept(ParseTreeVisitor visitor) { - if ( visitor instanceof AgtypeVisitor ) return ((AgtypeVisitor)visitor).visitFloatLiteral(this); - else return visitor.visitChildren(this); - } - } - - public final FloatLiteralContext floatLiteral() throws RecognitionException { - FloatLiteralContext _localctx = new FloatLiteralContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_floatLiteral); - int _la; - try { - setState(77); - _errHandler.sync(this); - switch (_input.LA(1)) { - case RegularFloat: - enterOuterAlt(_localctx, 1); - { - setState(70); - match(RegularFloat); - } - break; - case ExponentFloat: - enterOuterAlt(_localctx, 2); - { - setState(71); - match(ExponentFloat); - } - break; - case T__10: - case T__11: - enterOuterAlt(_localctx, 3); - { - setState(73); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==T__10) { - { - setState(72); - match(T__10); - } - } - - setState(75); - match(T__11); - } - break; - case T__12: - enterOuterAlt(_localctx, 4); - { - setState(76); - match(T__12); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static final String _serializedATN = - "\u0004\u0001\u0013P\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ - "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ - "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0001"+ - "\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0003\u0001\u0016"+ - "\b\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001"+ - "\u0002\u0001\u0002\u0001\u0002\u0003\u0002 \b\u0002\u0001\u0003\u0001"+ - "\u0003\u0001\u0003\u0001\u0003\u0005\u0003&\b\u0003\n\u0003\f\u0003)\t"+ - "\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0003\u0003/\b"+ - "\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001"+ - "\u0005\u0001\u0005\u0001\u0005\u0005\u00059\b\u0005\n\u0005\f\u0005<\t"+ - "\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0003\u0005B\b"+ - "\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001"+ - "\u0007\u0003\u0007J\b\u0007\u0001\u0007\u0001\u0007\u0003\u0007N\b\u0007"+ - "\u0001\u0007\u0000\u0000\b\u0000\u0002\u0004\u0006\b\n\f\u000e\u0000\u0000"+ - "W\u0000\u0010\u0001\u0000\u0000\u0000\u0002\u0013\u0001\u0000\u0000\u0000"+ - "\u0004\u001f\u0001\u0000\u0000\u0000\u0006.\u0001\u0000\u0000\u0000\b"+ - "0\u0001\u0000\u0000\u0000\nA\u0001\u0000\u0000\u0000\fC\u0001\u0000\u0000"+ - "\u0000\u000eM\u0001\u0000\u0000\u0000\u0010\u0011\u0003\u0002\u0001\u0000"+ - "\u0011\u0012\u0005\u0000\u0000\u0001\u0012\u0001\u0001\u0000\u0000\u0000"+ - "\u0013\u0015\u0003\u0004\u0002\u0000\u0014\u0016\u0003\f\u0006\u0000\u0015"+ - "\u0014\u0001\u0000\u0000\u0000\u0015\u0016\u0001\u0000\u0000\u0000\u0016"+ - "\u0003\u0001\u0000\u0000\u0000\u0017 \u0005\u000f\u0000\u0000\u0018 \u0005"+ - "\u0010\u0000\u0000\u0019 \u0003\u000e\u0007\u0000\u001a \u0005\u0001\u0000"+ - "\u0000\u001b \u0005\u0002\u0000\u0000\u001c \u0005\u0003\u0000\u0000\u001d"+ - " \u0003\u0006\u0003\u0000\u001e \u0003\n\u0005\u0000\u001f\u0017\u0001"+ - "\u0000\u0000\u0000\u001f\u0018\u0001\u0000\u0000\u0000\u001f\u0019\u0001"+ - "\u0000\u0000\u0000\u001f\u001a\u0001\u0000\u0000\u0000\u001f\u001b\u0001"+ - "\u0000\u0000\u0000\u001f\u001c\u0001\u0000\u0000\u0000\u001f\u001d\u0001"+ - "\u0000\u0000\u0000\u001f\u001e\u0001\u0000\u0000\u0000 \u0005\u0001\u0000"+ - "\u0000\u0000!\"\u0005\u0004\u0000\u0000\"\'\u0003\b\u0004\u0000#$\u0005"+ - "\u0005\u0000\u0000$&\u0003\b\u0004\u0000%#\u0001\u0000\u0000\u0000&)\u0001"+ - "\u0000\u0000\u0000\'%\u0001\u0000\u0000\u0000\'(\u0001\u0000\u0000\u0000"+ - "(*\u0001\u0000\u0000\u0000)\'\u0001\u0000\u0000\u0000*+\u0005\u0006\u0000"+ - "\u0000+/\u0001\u0000\u0000\u0000,-\u0005\u0004\u0000\u0000-/\u0005\u0006"+ - "\u0000\u0000.!\u0001\u0000\u0000\u0000.,\u0001\u0000\u0000\u0000/\u0007"+ - "\u0001\u0000\u0000\u000001\u0005\u000f\u0000\u000012\u0005\u0007\u0000"+ - "\u000023\u0003\u0002\u0001\u00003\t\u0001\u0000\u0000\u000045\u0005\b"+ - "\u0000\u00005:\u0003\u0002\u0001\u000067\u0005\u0005\u0000\u000079\u0003"+ - "\u0002\u0001\u000086\u0001\u0000\u0000\u00009<\u0001\u0000\u0000\u0000"+ - ":8\u0001\u0000\u0000\u0000:;\u0001\u0000\u0000\u0000;=\u0001\u0000\u0000"+ - "\u0000<:\u0001\u0000\u0000\u0000=>\u0005\t\u0000\u0000>B\u0001\u0000\u0000"+ - "\u0000?@\u0005\b\u0000\u0000@B\u0005\t\u0000\u0000A4\u0001\u0000\u0000"+ - "\u0000A?\u0001\u0000\u0000\u0000B\u000b\u0001\u0000\u0000\u0000CD\u0005"+ - "\n\u0000\u0000DE\u0005\u000e\u0000\u0000E\r\u0001\u0000\u0000\u0000FN"+ - "\u0005\u0011\u0000\u0000GN\u0005\u0012\u0000\u0000HJ\u0005\u000b\u0000"+ - "\u0000IH\u0001\u0000\u0000\u0000IJ\u0001\u0000\u0000\u0000JK\u0001\u0000"+ - "\u0000\u0000KN\u0005\f\u0000\u0000LN\u0005\r\u0000\u0000MF\u0001\u0000"+ - "\u0000\u0000MG\u0001\u0000\u0000\u0000MI\u0001\u0000\u0000\u0000ML\u0001"+ - "\u0000\u0000\u0000N\u000f\u0001\u0000\u0000\u0000\b\u0015\u001f\'.:AI"+ - "M"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/age/gen/AgtypeParser.py b/age/gen/AgtypeParser.py new file mode 100644 index 0000000..5251c93 --- /dev/null +++ b/age/gen/AgtypeParser.py @@ -0,0 +1,846 @@ +# Generated from antlr/Agtype.g4 by ANTLR 4.11.1 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,19,80,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,1,0,1,0,1,0,1,1,1,1,3,1,22,8,1,1,2,1,2,1,2,1,2,1,2,1,2, + 1,2,1,2,3,2,32,8,2,1,3,1,3,1,3,1,3,5,3,38,8,3,10,3,12,3,41,9,3,1, + 3,1,3,1,3,1,3,3,3,47,8,3,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,5,5,57, + 8,5,10,5,12,5,60,9,5,1,5,1,5,1,5,1,5,3,5,66,8,5,1,6,1,6,1,6,1,7, + 1,7,1,7,3,7,74,8,7,1,7,1,7,3,7,78,8,7,1,7,0,0,8,0,2,4,6,8,10,12, + 14,0,0,87,0,16,1,0,0,0,2,19,1,0,0,0,4,31,1,0,0,0,6,46,1,0,0,0,8, + 48,1,0,0,0,10,65,1,0,0,0,12,67,1,0,0,0,14,77,1,0,0,0,16,17,3,2,1, + 0,17,18,5,0,0,1,18,1,1,0,0,0,19,21,3,4,2,0,20,22,3,12,6,0,21,20, + 1,0,0,0,21,22,1,0,0,0,22,3,1,0,0,0,23,32,5,15,0,0,24,32,5,16,0,0, + 25,32,3,14,7,0,26,32,5,1,0,0,27,32,5,2,0,0,28,32,5,3,0,0,29,32,3, + 6,3,0,30,32,3,10,5,0,31,23,1,0,0,0,31,24,1,0,0,0,31,25,1,0,0,0,31, + 26,1,0,0,0,31,27,1,0,0,0,31,28,1,0,0,0,31,29,1,0,0,0,31,30,1,0,0, + 0,32,5,1,0,0,0,33,34,5,4,0,0,34,39,3,8,4,0,35,36,5,5,0,0,36,38,3, + 8,4,0,37,35,1,0,0,0,38,41,1,0,0,0,39,37,1,0,0,0,39,40,1,0,0,0,40, + 42,1,0,0,0,41,39,1,0,0,0,42,43,5,6,0,0,43,47,1,0,0,0,44,45,5,4,0, + 0,45,47,5,6,0,0,46,33,1,0,0,0,46,44,1,0,0,0,47,7,1,0,0,0,48,49,5, + 15,0,0,49,50,5,7,0,0,50,51,3,2,1,0,51,9,1,0,0,0,52,53,5,8,0,0,53, + 58,3,2,1,0,54,55,5,5,0,0,55,57,3,2,1,0,56,54,1,0,0,0,57,60,1,0,0, + 0,58,56,1,0,0,0,58,59,1,0,0,0,59,61,1,0,0,0,60,58,1,0,0,0,61,62, + 5,9,0,0,62,66,1,0,0,0,63,64,5,8,0,0,64,66,5,9,0,0,65,52,1,0,0,0, + 65,63,1,0,0,0,66,11,1,0,0,0,67,68,5,10,0,0,68,69,5,14,0,0,69,13, + 1,0,0,0,70,78,5,17,0,0,71,78,5,18,0,0,72,74,5,11,0,0,73,72,1,0,0, + 0,73,74,1,0,0,0,74,75,1,0,0,0,75,78,5,12,0,0,76,78,5,13,0,0,77,70, + 1,0,0,0,77,71,1,0,0,0,77,73,1,0,0,0,77,76,1,0,0,0,78,15,1,0,0,0, + 8,21,31,39,46,58,65,73,77 + ] + +class AgtypeParser ( Parser ): + + grammarFileName = "Agtype.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "'true'", "'false'", "'null'", "'{'", + "','", "'}'", "':'", "'['", "']'", "'::'", "'-'", "'Infinity'", + "'NaN'" ] + + symbolicNames = [ "", "", "", "", + "", "", "", "", + "", "", "", "", + "", "", "IDENT", "STRING", "INTEGER", + "RegularFloat", "ExponentFloat", "WS" ] + + RULE_agType = 0 + RULE_agValue = 1 + RULE_value = 2 + RULE_obj = 3 + RULE_pair = 4 + RULE_array = 5 + RULE_typeAnnotation = 6 + RULE_floatLiteral = 7 + + ruleNames = [ "agType", "agValue", "value", "obj", "pair", "array", + "typeAnnotation", "floatLiteral" ] + + EOF = Token.EOF + T__0=1 + T__1=2 + T__2=3 + T__3=4 + T__4=5 + T__5=6 + T__6=7 + T__7=8 + T__8=9 + T__9=10 + T__10=11 + T__11=12 + T__12=13 + IDENT=14 + STRING=15 + INTEGER=16 + RegularFloat=17 + ExponentFloat=18 + WS=19 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.11.1") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class AgTypeContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def agValue(self): + return self.getTypedRuleContext(AgtypeParser.AgValueContext,0) + + + def EOF(self): + return self.getToken(AgtypeParser.EOF, 0) + + def getRuleIndex(self): + return AgtypeParser.RULE_agType + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAgType" ): + listener.enterAgType(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAgType" ): + listener.exitAgType(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAgType" ): + return visitor.visitAgType(self) + else: + return visitor.visitChildren(self) + + + + + def agType(self): + + localctx = AgtypeParser.AgTypeContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_agType) + try: + self.enterOuterAlt(localctx, 1) + self.state = 16 + self.agValue() + self.state = 17 + self.match(AgtypeParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class AgValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def value(self): + return self.getTypedRuleContext(AgtypeParser.ValueContext,0) + + + def typeAnnotation(self): + return self.getTypedRuleContext(AgtypeParser.TypeAnnotationContext,0) + + + def getRuleIndex(self): + return AgtypeParser.RULE_agValue + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAgValue" ): + listener.enterAgValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAgValue" ): + listener.exitAgValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAgValue" ): + return visitor.visitAgValue(self) + else: + return visitor.visitChildren(self) + + + + + def agValue(self): + + localctx = AgtypeParser.AgValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_agValue) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 19 + self.value() + self.state = 21 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==10: + self.state = 20 + self.typeAnnotation() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ValueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return AgtypeParser.RULE_value + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class NullValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNullValue" ): + listener.enterNullValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNullValue" ): + listener.exitNullValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitNullValue" ): + return visitor.visitNullValue(self) + else: + return visitor.visitChildren(self) + + + class ObjectValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + def obj(self): + return self.getTypedRuleContext(AgtypeParser.ObjContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterObjectValue" ): + listener.enterObjectValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitObjectValue" ): + listener.exitObjectValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitObjectValue" ): + return visitor.visitObjectValue(self) + else: + return visitor.visitChildren(self) + + + class IntegerValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + def INTEGER(self): + return self.getToken(AgtypeParser.INTEGER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIntegerValue" ): + listener.enterIntegerValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIntegerValue" ): + listener.exitIntegerValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitIntegerValue" ): + return visitor.visitIntegerValue(self) + else: + return visitor.visitChildren(self) + + + class TrueBooleanContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTrueBoolean" ): + listener.enterTrueBoolean(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTrueBoolean" ): + listener.exitTrueBoolean(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTrueBoolean" ): + return visitor.visitTrueBoolean(self) + else: + return visitor.visitChildren(self) + + + class FalseBooleanContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFalseBoolean" ): + listener.enterFalseBoolean(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFalseBoolean" ): + listener.exitFalseBoolean(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFalseBoolean" ): + return visitor.visitFalseBoolean(self) + else: + return visitor.visitChildren(self) + + + class FloatValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + def floatLiteral(self): + return self.getTypedRuleContext(AgtypeParser.FloatLiteralContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFloatValue" ): + listener.enterFloatValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFloatValue" ): + listener.exitFloatValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFloatValue" ): + return visitor.visitFloatValue(self) + else: + return visitor.visitChildren(self) + + + class StringValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + def STRING(self): + return self.getToken(AgtypeParser.STRING, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterStringValue" ): + listener.enterStringValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitStringValue" ): + listener.exitStringValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStringValue" ): + return visitor.visitStringValue(self) + else: + return visitor.visitChildren(self) + + + class ArrayValueContext(ValueContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a AgtypeParser.ValueContext + super().__init__(parser) + self.copyFrom(ctx) + + def array(self): + return self.getTypedRuleContext(AgtypeParser.ArrayContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArrayValue" ): + listener.enterArrayValue(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArrayValue" ): + listener.exitArrayValue(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArrayValue" ): + return visitor.visitArrayValue(self) + else: + return visitor.visitChildren(self) + + + + def value(self): + + localctx = AgtypeParser.ValueContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_value) + try: + self.state = 31 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + localctx = AgtypeParser.StringValueContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 23 + self.match(AgtypeParser.STRING) + pass + elif token in [16]: + localctx = AgtypeParser.IntegerValueContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 24 + self.match(AgtypeParser.INTEGER) + pass + elif token in [11, 12, 13, 17, 18]: + localctx = AgtypeParser.FloatValueContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 25 + self.floatLiteral() + pass + elif token in [1]: + localctx = AgtypeParser.TrueBooleanContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 26 + self.match(AgtypeParser.T__0) + pass + elif token in [2]: + localctx = AgtypeParser.FalseBooleanContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 27 + self.match(AgtypeParser.T__1) + pass + elif token in [3]: + localctx = AgtypeParser.NullValueContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 28 + self.match(AgtypeParser.T__2) + pass + elif token in [4]: + localctx = AgtypeParser.ObjectValueContext(self, localctx) + self.enterOuterAlt(localctx, 7) + self.state = 29 + self.obj() + pass + elif token in [8]: + localctx = AgtypeParser.ArrayValueContext(self, localctx) + self.enterOuterAlt(localctx, 8) + self.state = 30 + self.array() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ObjContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def pair(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(AgtypeParser.PairContext) + else: + return self.getTypedRuleContext(AgtypeParser.PairContext,i) + + + def getRuleIndex(self): + return AgtypeParser.RULE_obj + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterObj" ): + listener.enterObj(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitObj" ): + listener.exitObj(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitObj" ): + return visitor.visitObj(self) + else: + return visitor.visitChildren(self) + + + + + def obj(self): + + localctx = AgtypeParser.ObjContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_obj) + self._la = 0 # Token type + try: + self.state = 46 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,3,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 33 + self.match(AgtypeParser.T__3) + self.state = 34 + self.pair() + self.state = 39 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==5: + self.state = 35 + self.match(AgtypeParser.T__4) + self.state = 36 + self.pair() + self.state = 41 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 42 + self.match(AgtypeParser.T__5) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 44 + self.match(AgtypeParser.T__3) + self.state = 45 + self.match(AgtypeParser.T__5) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class PairContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def STRING(self): + return self.getToken(AgtypeParser.STRING, 0) + + def agValue(self): + return self.getTypedRuleContext(AgtypeParser.AgValueContext,0) + + + def getRuleIndex(self): + return AgtypeParser.RULE_pair + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPair" ): + listener.enterPair(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPair" ): + listener.exitPair(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPair" ): + return visitor.visitPair(self) + else: + return visitor.visitChildren(self) + + + + + def pair(self): + + localctx = AgtypeParser.PairContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_pair) + try: + self.enterOuterAlt(localctx, 1) + self.state = 48 + self.match(AgtypeParser.STRING) + self.state = 49 + self.match(AgtypeParser.T__6) + self.state = 50 + self.agValue() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ArrayContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def agValue(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(AgtypeParser.AgValueContext) + else: + return self.getTypedRuleContext(AgtypeParser.AgValueContext,i) + + + def getRuleIndex(self): + return AgtypeParser.RULE_array + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArray" ): + listener.enterArray(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArray" ): + listener.exitArray(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArray" ): + return visitor.visitArray(self) + else: + return visitor.visitChildren(self) + + + + + def array(self): + + localctx = AgtypeParser.ArrayContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_array) + self._la = 0 # Token type + try: + self.state = 65 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,5,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 52 + self.match(AgtypeParser.T__7) + self.state = 53 + self.agValue() + self.state = 58 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==5: + self.state = 54 + self.match(AgtypeParser.T__4) + self.state = 55 + self.agValue() + self.state = 60 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 61 + self.match(AgtypeParser.T__8) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 63 + self.match(AgtypeParser.T__7) + self.state = 64 + self.match(AgtypeParser.T__8) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class TypeAnnotationContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def IDENT(self): + return self.getToken(AgtypeParser.IDENT, 0) + + def getRuleIndex(self): + return AgtypeParser.RULE_typeAnnotation + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTypeAnnotation" ): + listener.enterTypeAnnotation(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTypeAnnotation" ): + listener.exitTypeAnnotation(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTypeAnnotation" ): + return visitor.visitTypeAnnotation(self) + else: + return visitor.visitChildren(self) + + + + + def typeAnnotation(self): + + localctx = AgtypeParser.TypeAnnotationContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_typeAnnotation) + try: + self.enterOuterAlt(localctx, 1) + self.state = 67 + self.match(AgtypeParser.T__9) + self.state = 68 + self.match(AgtypeParser.IDENT) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class FloatLiteralContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def RegularFloat(self): + return self.getToken(AgtypeParser.RegularFloat, 0) + + def ExponentFloat(self): + return self.getToken(AgtypeParser.ExponentFloat, 0) + + def getRuleIndex(self): + return AgtypeParser.RULE_floatLiteral + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFloatLiteral" ): + listener.enterFloatLiteral(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFloatLiteral" ): + listener.exitFloatLiteral(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFloatLiteral" ): + return visitor.visitFloatLiteral(self) + else: + return visitor.visitChildren(self) + + + + + def floatLiteral(self): + + localctx = AgtypeParser.FloatLiteralContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_floatLiteral) + self._la = 0 # Token type + try: + self.state = 77 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [17]: + self.enterOuterAlt(localctx, 1) + self.state = 70 + self.match(AgtypeParser.RegularFloat) + pass + elif token in [18]: + self.enterOuterAlt(localctx, 2) + self.state = 71 + self.match(AgtypeParser.ExponentFloat) + pass + elif token in [11, 12]: + self.enterOuterAlt(localctx, 3) + self.state = 73 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==11: + self.state = 72 + self.match(AgtypeParser.T__10) + + + self.state = 75 + self.match(AgtypeParser.T__11) + pass + elif token in [13]: + self.enterOuterAlt(localctx, 4) + self.state = 76 + self.match(AgtypeParser.T__12) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + + diff --git a/age/gen/AgtypeVisitor.java b/age/gen/AgtypeVisitor.java deleted file mode 100644 index 016e4c4..0000000 --- a/age/gen/AgtypeVisitor.java +++ /dev/null @@ -1,110 +0,0 @@ -// Generated from java-escape by ANTLR 4.11.1 -import org.antlr.v4.runtime.tree.ParseTreeVisitor; - -/** - * This interface defines a complete generic visitor for a parse tree produced - * by {@link AgtypeParser}. - * - * @param The return type of the visit operation. Use {@link Void} for - * operations with no return type. - */ -public interface AgtypeVisitor extends ParseTreeVisitor { - /** - * Visit a parse tree produced by {@link AgtypeParser#agType}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitAgType(AgtypeParser.AgTypeContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#agValue}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitAgValue(AgtypeParser.AgValueContext ctx); - /** - * Visit a parse tree produced by the {@code StringValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitStringValue(AgtypeParser.StringValueContext ctx); - /** - * Visit a parse tree produced by the {@code IntegerValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitIntegerValue(AgtypeParser.IntegerValueContext ctx); - /** - * Visit a parse tree produced by the {@code FloatValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitFloatValue(AgtypeParser.FloatValueContext ctx); - /** - * Visit a parse tree produced by the {@code TrueBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitTrueBoolean(AgtypeParser.TrueBooleanContext ctx); - /** - * Visit a parse tree produced by the {@code FalseBoolean} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitFalseBoolean(AgtypeParser.FalseBooleanContext ctx); - /** - * Visit a parse tree produced by the {@code NullValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitNullValue(AgtypeParser.NullValueContext ctx); - /** - * Visit a parse tree produced by the {@code ObjectValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitObjectValue(AgtypeParser.ObjectValueContext ctx); - /** - * Visit a parse tree produced by the {@code ArrayValue} - * labeled alternative in {@link AgtypeParser#value}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitArrayValue(AgtypeParser.ArrayValueContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#obj}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitObj(AgtypeParser.ObjContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#pair}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitPair(AgtypeParser.PairContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#array}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitArray(AgtypeParser.ArrayContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#typeAnnotation}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitTypeAnnotation(AgtypeParser.TypeAnnotationContext ctx); - /** - * Visit a parse tree produced by {@link AgtypeParser#floatLiteral}. - * @param ctx the parse tree - * @return the visitor result - */ - T visitFloatLiteral(AgtypeParser.FloatLiteralContext ctx); -} \ No newline at end of file diff --git a/age/gen/AgtypeVisitor.py b/age/gen/AgtypeVisitor.py new file mode 100644 index 0000000..2042927 --- /dev/null +++ b/age/gen/AgtypeVisitor.py @@ -0,0 +1,88 @@ +# Generated from antlr/Agtype.g4 by ANTLR 4.11.1 +from antlr4 import * +if __name__ is not None and "." in __name__: + from .AgtypeParser import AgtypeParser +else: + from AgtypeParser import AgtypeParser + +# This class defines a complete generic visitor for a parse tree produced by AgtypeParser. + +class AgtypeVisitor(ParseTreeVisitor): + + # Visit a parse tree produced by AgtypeParser#agType. + def visitAgType(self, ctx:AgtypeParser.AgTypeContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#agValue. + def visitAgValue(self, ctx:AgtypeParser.AgValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#StringValue. + def visitStringValue(self, ctx:AgtypeParser.StringValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#IntegerValue. + def visitIntegerValue(self, ctx:AgtypeParser.IntegerValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#FloatValue. + def visitFloatValue(self, ctx:AgtypeParser.FloatValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#TrueBoolean. + def visitTrueBoolean(self, ctx:AgtypeParser.TrueBooleanContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#FalseBoolean. + def visitFalseBoolean(self, ctx:AgtypeParser.FalseBooleanContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#NullValue. + def visitNullValue(self, ctx:AgtypeParser.NullValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#ObjectValue. + def visitObjectValue(self, ctx:AgtypeParser.ObjectValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#ArrayValue. + def visitArrayValue(self, ctx:AgtypeParser.ArrayValueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#obj. + def visitObj(self, ctx:AgtypeParser.ObjContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#pair. + def visitPair(self, ctx:AgtypeParser.PairContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#array. + def visitArray(self, ctx:AgtypeParser.ArrayContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#typeAnnotation. + def visitTypeAnnotation(self, ctx:AgtypeParser.TypeAnnotationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by AgtypeParser#floatLiteral. + def visitFloatLiteral(self, ctx:AgtypeParser.FloatLiteralContext): + return self.visitChildren(ctx) + + + +del AgtypeParser \ No newline at end of file diff --git a/age/gen/__init__.py b/age/gen/__init__.py new file mode 100644 index 0000000..e69de29 From 875a073977f10e225e34478d6768d8209ee45f67 Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:07:41 +0200 Subject: [PATCH 4/8] updated environment for CI --- test_age_py.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_age_py.py b/test_age_py.py index 1758989..e4e08a5 100644 --- a/test_age_py.py +++ b/test_age_py.py @@ -18,8 +18,8 @@ import decimal import age -DSN = "host=172.17.0.2 port=5432 dbname=postgres user=postgres password=agens" -TEST_HOST = "172.17.0.2" +DSN = "host=localhost port=5432 dbname=postgres user=postgres password=agens" +TEST_HOST = "localhost" TEST_PORT = 5432 TEST_DB = "postgres" TEST_USER = "postgres" From f3508f0c5976132b5fcef05220e8590e2cf0af84 Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:09:23 +0200 Subject: [PATCH 5/8] typo --- .github/workflows/unittest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 02060fa..9cfea94 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -9,7 +9,7 @@ jobs: age: image: apache/age env: - POSTGRES_PASSWORD: agnes + POSTGRES_PASSWORD: agens POSTGRES_USER: postgres POSTGRES_DB: postgres ports: From 055798fb39bda0b60862c391627068e41464fda7 Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:27:02 +0200 Subject: [PATCH 6/8] updated antlr version number --- .github/workflows/unittest.yaml | 2 +- README.md | 2 +- antlr/README.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 9cfea94..e0c6055 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -20,6 +20,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.11" - - run: pip install antlr4-python3-runtime psycopg2 + - run: pip install antlr4-python3-runtime==4.11.1 psycopg2 - name: Run tests run: python -m unittest -v test_age_py test_agtypes.py diff --git a/README.md b/README.md index b835389..353b346 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Apache AGE is: sudo apt-get update sudo apt-get install python3-dev libpq-dev pip install --no-binary :all: psycopg2 -pip install antlr4-python3-runtime==4.9.2 +pip install antlr4-python3-runtime==4.11.1 ``` ### Install via PIP diff --git a/antlr/README.md b/antlr/README.md index 747c283..cf92a34 100644 --- a/antlr/README.md +++ b/antlr/README.md @@ -7,7 +7,7 @@ Python driver for Apache AGE, graph extention for PostgreSQL. ``` # prerequisites : # - java over 8 -# - download ANTLR4 from https://www.antlr.org/download/antlr-4.9.2-complete.jar -# - java -cp antlr-4.9.2-complete.jar org.antlr.v4.Tool -Dlanguage=Python3 -visitor -o ../age/gen Agtype.g4 +# - download ANTLR4 from https://www.antlr.org/download/antlr-4.11.1-complete.jar +# - java -cp antlr-4.11.1-complete.jar org.antlr.v4.Tool -Dlanguage=Python3 -visitor -o ../age/gen Agtype.g4 ``` From bafd82df59ef0292081f1753d1f2bcb5558cd7ea Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:42:10 +0200 Subject: [PATCH 7/8] workflow only tirggers on main --- .github/workflows/unittest.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index e0c6055..cc57a53 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -1,6 +1,12 @@ name: Run unit tests run-name: Testing ${{ github.actor }}'s changes -on: [pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: unit-test: runs-on: ubuntu-latest @@ -20,6 +26,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.11" - - run: pip install antlr4-python3-runtime==4.11.1 psycopg2 + - run: python -m pip install antlr4-python3-runtime==4.11.1 psycopg2 - name: Run tests run: python -m unittest -v test_age_py test_agtypes.py From 586c2436a2933b8db02d1aed3e4ee83ed9292d94 Mon Sep 17 00:00:00 2001 From: Abdelsalam ElTamawy Date: Mon, 6 Feb 2023 15:42:12 +0200 Subject: [PATCH 8/8] workflows only trigger on main --- .github/workflows/unittest.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index cc57a53..1780cd8 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -3,10 +3,10 @@ run-name: Testing ${{ github.actor }}'s changes on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: unit-test: runs-on: ubuntu-latest