diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2017-01-20 09:00:23 +0100 |
---|---|---|
committer | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2017-01-20 09:00:23 +0100 |
commit | 7693d2e66fa18992a0f7161a2ee68bbf1b028ee3 (patch) | |
tree | d1b37c1c99545deb7af80298d3c81447fbe4c1b9 | |
parent | f9a67d7525727367181fe4d819c898d1ab32ca22 (diff) | |
parent | 6bc7bf7cf2174cd3e0c75ba1a02a9fa72a726999 (diff) |
Merge branch 'release/1.0b3'1.0b3
-rw-r--r-- | docs/domain.rst | 2 | ||||
-rw-r--r-- | docs/grammar.rst | 16 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/usage.rst | 4 | ||||
-rw-r--r-- | qface/__about__.py | 2 | ||||
-rw-r--r-- | qface/idl/domain.py | 11 | ||||
-rw-r--r-- | qface/idl/parser/T.g4 | 6 | ||||
-rw-r--r-- | qface/idl/parser/TLexer.py | 108 | ||||
-rw-r--r-- | qface/idl/parser/TListener.py | 2 | ||||
-rw-r--r-- | qface/idl/parser/TParser.py | 65 | ||||
-rw-r--r-- | qface/idl/parser/TVisitor.py | 2 | ||||
-rw-r--r-- | requirements.txt | 2 |
12 files changed, 126 insertions, 96 deletions
diff --git a/docs/domain.rst b/docs/domain.rst index 7dd15d0..bf8f1c1 100644 --- a/docs/domain.rst +++ b/docs/domain.rst @@ -27,7 +27,7 @@ The domain model is the base for the code generation. You traverse the domain tr from qface.generator import FileSystem - system = FileSystem.parse_dir('interfaces') + system = FileSystem.parse('./interfaces') for module in sytem.modules: print(module.name) diff --git a/docs/grammar.rst b/docs/grammar.rst index 1998025..8fe04bb 100644 --- a/docs/grammar.rst +++ b/docs/grammar.rst @@ -1,8 +1,8 @@ =========== -QDL Grammar +QFace Grammar =========== -QDL (Qt definition language) is an IDL to define an interface. In general it is modeled to define an interface between Qt QML and C++. The QDL syntax is flexible enough also to be used in other context. +QFace (Qt interface language) is an IDL to define an interface. In general it is modeled to define an interface between Qt QML and C++. The QFace syntax is flexible enough also to be used in other context. .. code-block:: html @@ -27,13 +27,13 @@ QDL (Qt definition language) is an IDL to define an interface. In general it is <name> = <value>, } -A QDL document always describes one module. Each document can contain one or more interfaces, structs, flags or enums. Each document can import other modules using the import statement. +A QFace document always describes one module. Each document can contain one or more interfaces, structs, flags or enums. Each document can import other modules using the import statement. Module ====== -A module is identified name. A module should be normally a URI where all parts are lowercase (e.g. `entertainment.tuner`). A module can import other modules. This is used to ensure that dependencies are declared inside the QDL file. +A module is identified name. A module should be normally a URI where all parts are lowercase (e.g. `entertainment.tuner`). A module can import other modules. This is used to ensure that dependencies are declared inside the QFace file. Types ----- @@ -42,9 +42,9 @@ Types are either local and can be references simply by its name, or they are fro A module consist of either one or more interfaces, structs and enums/flags. They can come in any number or combination. The interface is the only type which can contain operations and events. The struct is merely a container to transport structured data. An enum/flag allows the user to encode information used inside the struct or interface as datatype. -The QDL does not allow to extend interfaces. It is by design kept simple. +The QFace does not allow to extend interfaces. It is by design kept simple. -Below is an example of a QDL file. +Below is an example of a QFace file. .. code-block:: js @@ -61,7 +61,7 @@ Below is an example of a QDL file. /*! operation previousStation */ void previousStation(); /*! operation updateCurrentStation */ - void updateCurrentStation(int stationId); + void updateCurrentStation(int stationId); list<int> primitiveList; list<Station> complexList; @@ -102,7 +102,7 @@ Below is an example of a QDL file. string name; /*! last time modified */ common.TimeStamp modified; - } + } diff --git a/docs/index.rst b/docs/index.rst index d2a2e6d..4a28a7f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ QFace ===== -QFace is a flexible Qt API generator. It uses a common IDL format (called QDL) to define an API. QFace comes with a set of predefined generators to generate QML Plugins. QFace can be easily extended with your own generator. +QFace is a flexible Qt API generator. It uses a common IDL format (called QFace interface document) to define an API. QFace comes with a set of predefined generators to generate QML Plugins. QFace can be easily extended with your own generator. .. toctree:: :maxdepth: 1 diff --git a/docs/usage.rst b/docs/usage.rst index 974ae7e..8cc059f 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -5,7 +5,7 @@ Usage Concept ======= -QFace requires one or more IDL files as input file and a generator to produce output files. The IDL files are named QDL (Qt definition language). +QFace requires one or more IDL files as input file and a generator to produce output files. The IDL files are named QFace interface documents. .. image:: qface_concept.png @@ -77,7 +77,7 @@ The code generation is driven by a small script which iterates over the domain m from qface.generator import FileSystem, Generator def generate(input, output): - system = FileSystem.parse_dir(input) + system = FileSystem.parse(input) generator = Generator(searchpath='templates') ctx = {'output': output, 'system': system} generator.write('{{output}}/modules.csv', 'modules.csv', ctx) diff --git a/qface/__about__.py b/qface/__about__.py index e900ebc..d2abd9c 100644 --- a/qface/__about__.py +++ b/qface/__about__.py @@ -9,5 +9,5 @@ except NameError: __title__ = "qface" __summary__ = "A generator framework based on a common modern IDL" __uri__ = "https://pelagicore.github.io/qface/" -__version__ = "1.0b2" +__version__ = "1.0b3" __author__ = "JRyannel" diff --git a/qface/idl/domain.py b/qface/idl/domain.py index 3b944a9..6a6ece9 100644 --- a/qface/idl/domain.py +++ b/qface/idl/domain.py @@ -1,7 +1,7 @@ # Copyright (c) Pelagicore AB 2016 '''The domian module contains an object hierachy which resembles the -QDL grammar as a domain model. It is created from the QDL and the main +QFace grammar as a domain model. It is created from the QFace and the main input for the code generation templates. .. note:: Changes on this API will result into broken templates @@ -18,7 +18,10 @@ input for the code generation templates. +- Struct (has attributes) +- Enum (has values) -.. note:: When the API talks about an order list, the order is by appearance in the QDL file. +.. note:: + + When the API talks about an order list, the order is by appearance + in the QFace file. ''' from collections import OrderedDict, ChainMap @@ -75,10 +78,10 @@ class Symbol(object): self.module = module """module the symbol belongs to""" self.comment = '' - """comment which appeared in QDL right before symbol""" + """comment which appeared in QFace right before symbol""" self._tags = OrderedDict() - + @property def system(self): diff --git a/qface/idl/parser/T.g4 b/qface/idl/parser/T.g4 index 5e5bc9d..6f1e1c1 100644 --- a/qface/idl/parser/T.g4 +++ b/qface/idl/parser/T.g4 @@ -55,7 +55,7 @@ tagSymbol tagAttributeSymbol : name=IDENTIFIER ('=' value=IDENTIFIER)? - ; + ; typeSymbol : primitiveTypeSymbol @@ -112,8 +112,8 @@ intSymbol INTCONSTANT : ('+' | '-')? '0'..'9'+; HEXCONSTANT : '0x' ('0'..'9' | 'a'..'f' | 'A'..'F')+; -TAGIDENTIFIER : '@'[a-zA-Z_][a-zA-Z0-9_\.]*; -IDENTIFIER : [a-zA-Z_][a-zA-Z0-9_\.]*; +TAGIDENTIFIER : '@'[a-zA-Z_][a-zA-Z0-9_.]*; +IDENTIFIER : [a-zA-Z_][a-zA-Z0-9_.]*; VERSION : [0-9]'.'[0-9]; DOCCOMMENT : '/*!' .*? '*/'; WHITESPACE : [ \t\r\n]+ -> skip; diff --git a/qface/idl/parser/TLexer.py b/qface/idl/parser/TLexer.py index 2fbc965..9feb45c 100644 --- a/qface/idl/parser/TLexer.py +++ b/qface/idl/parser/TLexer.py @@ -1,4 +1,4 @@ -# Generated from T.g4 by ANTLR 4.5.3 +# Generated from T.g4 by ANTLR 4.6 from antlr4 import * from io import StringIO @@ -33,58 +33,58 @@ def serializedATN(): buf.write("\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17") buf.write("\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63") buf.write("\33\65\34\67\359\36;\37= ?!A\"C#E$\3\2\t\4\2--//\5\2\62") - buf.write(";CHch\5\2C\\aac|\b\2\60\60\62;C\\^^aac|\3\2\62;\5\2\13") - buf.write("\f\17\17\"\"\4\2\f\f\17\17\u0112\2\3\3\2\2\2\2\5\3\2\2") - buf.write("\2\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") - buf.write("\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27") - buf.write("\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3") - buf.write("\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2") - buf.write(")\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2") - buf.write("\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2") - buf.write(";\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2") - buf.write("\2E\3\2\2\2\3G\3\2\2\2\5N\3\2\2\2\7P\3\2\2\2\tW\3\2\2") - buf.write("\2\13a\3\2\2\2\rc\3\2\2\2\17e\3\2\2\2\21k\3\2\2\2\23p") - buf.write("\3\2\2\2\25r\3\2\2\2\27t\3\2\2\2\31}\3\2\2\2\33\177\3") - buf.write("\2\2\2\35\u0081\3\2\2\2\37\u0086\3\2\2\2!\u008a\3\2\2") - buf.write("\2#\u008f\3\2\2\2%\u0096\3\2\2\2\'\u009a\3\2\2\2)\u009f") - buf.write("\3\2\2\2+\u00a1\3\2\2\2-\u00a3\3\2\2\2/\u00a9\3\2\2\2") - buf.write("\61\u00b0\3\2\2\2\63\u00b5\3\2\2\2\65\u00bb\3\2\2\2\67") - buf.write("\u00c2\3\2\2\29\u00ca\3\2\2\2;\u00d2\3\2\2\2=\u00d9\3") - buf.write("\2\2\2?\u00dd\3\2\2\2A\u00eb\3\2\2\2C\u00f1\3\2\2\2E\u00fc") - buf.write("\3\2\2\2GH\7k\2\2HI\7o\2\2IJ\7r\2\2JK\7q\2\2KL\7t\2\2") - buf.write("LM\7v\2\2M\4\3\2\2\2NO\7=\2\2O\6\3\2\2\2PQ\7o\2\2QR\7") - buf.write("q\2\2RS\7f\2\2ST\7w\2\2TU\7n\2\2UV\7g\2\2V\b\3\2\2\2W") - buf.write("X\7k\2\2XY\7p\2\2YZ\7v\2\2Z[\7g\2\2[\\\7t\2\2\\]\7h\2") - buf.write("\2]^\7c\2\2^_\7e\2\2_`\7g\2\2`\n\3\2\2\2ab\7}\2\2b\f\3") - buf.write("\2\2\2cd\7\177\2\2d\16\3\2\2\2ef\7g\2\2fg\7x\2\2gh\7g") - buf.write("\2\2hi\7p\2\2ij\7v\2\2j\20\3\2\2\2kl\7x\2\2lm\7q\2\2m") - buf.write("n\7k\2\2no\7f\2\2o\22\3\2\2\2pq\7*\2\2q\24\3\2\2\2rs\7") - buf.write("+\2\2s\26\3\2\2\2tu\7t\2\2uv\7g\2\2vw\7c\2\2wx\7f\2\2") - buf.write("xy\7q\2\2yz\7p\2\2z{\7n\2\2{|\7{\2\2|\30\3\2\2\2}~\7.") - buf.write("\2\2~\32\3\2\2\2\177\u0080\7?\2\2\u0080\34\3\2\2\2\u0081") - buf.write("\u0082\7d\2\2\u0082\u0083\7q\2\2\u0083\u0084\7q\2\2\u0084") - buf.write("\u0085\7n\2\2\u0085\36\3\2\2\2\u0086\u0087\7k\2\2\u0087") - buf.write("\u0088\7p\2\2\u0088\u0089\7v\2\2\u0089 \3\2\2\2\u008a") - buf.write("\u008b\7t\2\2\u008b\u008c\7g\2\2\u008c\u008d\7c\2\2\u008d") - buf.write("\u008e\7n\2\2\u008e\"\3\2\2\2\u008f\u0090\7u\2\2\u0090") - buf.write("\u0091\7v\2\2\u0091\u0092\7t\2\2\u0092\u0093\7k\2\2\u0093") - buf.write("\u0094\7p\2\2\u0094\u0095\7i\2\2\u0095$\3\2\2\2\u0096") - buf.write("\u0097\7x\2\2\u0097\u0098\7c\2\2\u0098\u0099\7t\2\2\u0099") - buf.write("&\3\2\2\2\u009a\u009b\7n\2\2\u009b\u009c\7k\2\2\u009c") - buf.write("\u009d\7u\2\2\u009d\u009e\7v\2\2\u009e(\3\2\2\2\u009f") - buf.write("\u00a0\7>\2\2\u00a0*\3\2\2\2\u00a1\u00a2\7@\2\2\u00a2") - buf.write(",\3\2\2\2\u00a3\u00a4\7o\2\2\u00a4\u00a5\7q\2\2\u00a5") - buf.write("\u00a6\7f\2\2\u00a6\u00a7\7g\2\2\u00a7\u00a8\7n\2\2\u00a8") - buf.write(".\3\2\2\2\u00a9\u00aa\7u\2\2\u00aa\u00ab\7v\2\2\u00ab") - buf.write("\u00ac\7t\2\2\u00ac\u00ad\7w\2\2\u00ad\u00ae\7e\2\2\u00ae") - buf.write("\u00af\7v\2\2\u00af\60\3\2\2\2\u00b0\u00b1\7g\2\2\u00b1") - buf.write("\u00b2\7p\2\2\u00b2\u00b3\7w\2\2\u00b3\u00b4\7o\2\2\u00b4") - buf.write("\62\3\2\2\2\u00b5\u00b6\7h\2\2\u00b6\u00b7\7n\2\2\u00b7") - buf.write("\u00b8\7c\2\2\u00b8\u00b9\7i\2\2\u00b9\64\3\2\2\2\u00ba") - buf.write("\u00bc\t\2\2\2\u00bb\u00ba\3\2\2\2\u00bb\u00bc\3\2\2\2") - buf.write("\u00bc\u00be\3\2\2\2\u00bd\u00bf\4\62;\2\u00be\u00bd\3") - buf.write("\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\u00be\3\2\2\2\u00c0\u00c1") - buf.write("\3\2\2\2\u00c1\66\3\2\2\2\u00c2\u00c3\7\62\2\2\u00c3\u00c4") + buf.write(";CHch\5\2C\\aac|\7\2\60\60\62;C\\aac|\3\2\62;\5\2\13\f") + buf.write("\17\17\"\"\4\2\f\f\17\17\u0112\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\'\3\2\2\2\2)\3") + buf.write("\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2") + buf.write("\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3") + buf.write("\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E") + buf.write("\3\2\2\2\3G\3\2\2\2\5N\3\2\2\2\7P\3\2\2\2\tW\3\2\2\2\13") + buf.write("a\3\2\2\2\rc\3\2\2\2\17e\3\2\2\2\21k\3\2\2\2\23p\3\2\2") + buf.write("\2\25r\3\2\2\2\27t\3\2\2\2\31}\3\2\2\2\33\177\3\2\2\2") + buf.write("\35\u0081\3\2\2\2\37\u0086\3\2\2\2!\u008a\3\2\2\2#\u008f") + buf.write("\3\2\2\2%\u0096\3\2\2\2\'\u009a\3\2\2\2)\u009f\3\2\2\2") + buf.write("+\u00a1\3\2\2\2-\u00a3\3\2\2\2/\u00a9\3\2\2\2\61\u00b0") + buf.write("\3\2\2\2\63\u00b5\3\2\2\2\65\u00bb\3\2\2\2\67\u00c2\3") + buf.write("\2\2\29\u00ca\3\2\2\2;\u00d2\3\2\2\2=\u00d9\3\2\2\2?\u00dd") + buf.write("\3\2\2\2A\u00eb\3\2\2\2C\u00f1\3\2\2\2E\u00fc\3\2\2\2") + buf.write("GH\7k\2\2HI\7o\2\2IJ\7r\2\2JK\7q\2\2KL\7t\2\2LM\7v\2\2") + buf.write("M\4\3\2\2\2NO\7=\2\2O\6\3\2\2\2PQ\7o\2\2QR\7q\2\2RS\7") + buf.write("f\2\2ST\7w\2\2TU\7n\2\2UV\7g\2\2V\b\3\2\2\2WX\7k\2\2X") + buf.write("Y\7p\2\2YZ\7v\2\2Z[\7g\2\2[\\\7t\2\2\\]\7h\2\2]^\7c\2") + buf.write("\2^_\7e\2\2_`\7g\2\2`\n\3\2\2\2ab\7}\2\2b\f\3\2\2\2cd") + buf.write("\7\177\2\2d\16\3\2\2\2ef\7g\2\2fg\7x\2\2gh\7g\2\2hi\7") + buf.write("p\2\2ij\7v\2\2j\20\3\2\2\2kl\7x\2\2lm\7q\2\2mn\7k\2\2") + buf.write("no\7f\2\2o\22\3\2\2\2pq\7*\2\2q\24\3\2\2\2rs\7+\2\2s\26") + buf.write("\3\2\2\2tu\7t\2\2uv\7g\2\2vw\7c\2\2wx\7f\2\2xy\7q\2\2") + buf.write("yz\7p\2\2z{\7n\2\2{|\7{\2\2|\30\3\2\2\2}~\7.\2\2~\32\3") + buf.write("\2\2\2\177\u0080\7?\2\2\u0080\34\3\2\2\2\u0081\u0082\7") + buf.write("d\2\2\u0082\u0083\7q\2\2\u0083\u0084\7q\2\2\u0084\u0085") + buf.write("\7n\2\2\u0085\36\3\2\2\2\u0086\u0087\7k\2\2\u0087\u0088") + buf.write("\7p\2\2\u0088\u0089\7v\2\2\u0089 \3\2\2\2\u008a\u008b") + buf.write("\7t\2\2\u008b\u008c\7g\2\2\u008c\u008d\7c\2\2\u008d\u008e") + buf.write("\7n\2\2\u008e\"\3\2\2\2\u008f\u0090\7u\2\2\u0090\u0091") + buf.write("\7v\2\2\u0091\u0092\7t\2\2\u0092\u0093\7k\2\2\u0093\u0094") + buf.write("\7p\2\2\u0094\u0095\7i\2\2\u0095$\3\2\2\2\u0096\u0097") + buf.write("\7x\2\2\u0097\u0098\7c\2\2\u0098\u0099\7t\2\2\u0099&\3") + buf.write("\2\2\2\u009a\u009b\7n\2\2\u009b\u009c\7k\2\2\u009c\u009d") + buf.write("\7u\2\2\u009d\u009e\7v\2\2\u009e(\3\2\2\2\u009f\u00a0") + buf.write("\7>\2\2\u00a0*\3\2\2\2\u00a1\u00a2\7@\2\2\u00a2,\3\2\2") + buf.write("\2\u00a3\u00a4\7o\2\2\u00a4\u00a5\7q\2\2\u00a5\u00a6\7") + buf.write("f\2\2\u00a6\u00a7\7g\2\2\u00a7\u00a8\7n\2\2\u00a8.\3\2") + buf.write("\2\2\u00a9\u00aa\7u\2\2\u00aa\u00ab\7v\2\2\u00ab\u00ac") + buf.write("\7t\2\2\u00ac\u00ad\7w\2\2\u00ad\u00ae\7e\2\2\u00ae\u00af") + buf.write("\7v\2\2\u00af\60\3\2\2\2\u00b0\u00b1\7g\2\2\u00b1\u00b2") + buf.write("\7p\2\2\u00b2\u00b3\7w\2\2\u00b3\u00b4\7o\2\2\u00b4\62") + buf.write("\3\2\2\2\u00b5\u00b6\7h\2\2\u00b6\u00b7\7n\2\2\u00b7\u00b8") + buf.write("\7c\2\2\u00b8\u00b9\7i\2\2\u00b9\64\3\2\2\2\u00ba\u00bc") + buf.write("\t\2\2\2\u00bb\u00ba\3\2\2\2\u00bb\u00bc\3\2\2\2\u00bc") + buf.write("\u00be\3\2\2\2\u00bd\u00bf\4\62;\2\u00be\u00bd\3\2\2\2") + buf.write("\u00bf\u00c0\3\2\2\2\u00c0\u00be\3\2\2\2\u00c0\u00c1\3") + buf.write("\2\2\2\u00c1\66\3\2\2\2\u00c2\u00c3\7\62\2\2\u00c3\u00c4") buf.write("\7z\2\2\u00c4\u00c6\3\2\2\2\u00c5\u00c7\t\3\2\2\u00c6") buf.write("\u00c5\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8\u00c6\3\2\2\2") buf.write("\u00c8\u00c9\3\2\2\2\u00c98\3\2\2\2\u00ca\u00cb\7B\2\2") @@ -182,7 +182,7 @@ class TLexer(Lexer): def __init__(self, input=None): super().__init__(input) - self.checkVersion("4.5.3") + self.checkVersion("4.6") self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) self._actions = None self._predicates = None diff --git a/qface/idl/parser/TListener.py b/qface/idl/parser/TListener.py index dbcafbd..b1f0969 100644 --- a/qface/idl/parser/TListener.py +++ b/qface/idl/parser/TListener.py @@ -1,4 +1,4 @@ -# Generated from T.g4 by ANTLR 4.5.3 +# Generated from T.g4 by ANTLR 4.6 from antlr4 import * if __name__ is not None and "." in __name__: from .TParser import TParser diff --git a/qface/idl/parser/TParser.py b/qface/idl/parser/TParser.py index 5130a93..081f381 100644 --- a/qface/idl/parser/TParser.py +++ b/qface/idl/parser/TParser.py @@ -1,4 +1,4 @@ -# Generated from T.g4 by ANTLR 4.5.3 +# Generated from T.g4 by ANTLR 4.6 # encoding: utf-8 from antlr4 import * from io import StringIO @@ -235,7 +235,7 @@ class TParser ( Parser ): def __init__(self, input:TokenStream): super().__init__(input) - self.checkVersion("4.5.3") + self.checkVersion("4.6") self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) self._predicates = None @@ -417,6 +417,7 @@ class TParser ( Parser ): self.state = 62 localctx.version = self.match(TParser.VERSION) self.state = 64 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 63 @@ -484,6 +485,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 67 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 66 @@ -507,6 +509,7 @@ class TParser ( Parser ): self.state = 77 localctx.version = self.match(TParser.VERSION) self.state = 79 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 78 @@ -565,7 +568,7 @@ class TParser ( Parser ): self.enterRule(localctx, 8, self.RULE_definitionSymbol) try: self.state = 84 - self._errHandler.sync(self); + self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,6,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) @@ -650,6 +653,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 87 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 86 @@ -685,6 +689,7 @@ class TParser ( Parser ): self.state = 104 self.match(TParser.T__5) self.state = 106 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 105 @@ -739,7 +744,7 @@ class TParser ( Parser ): self.enterRule(localctx, 12, self.RULE_interfaceMemberSymbol) try: self.state = 110 - self._errHandler.sync(self); + self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,11,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) @@ -823,6 +828,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 113 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 112 @@ -840,6 +846,7 @@ class TParser ( Parser ): _la = self._input.LA(1) self.state = 122 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__6: self.state = 121 @@ -847,15 +854,16 @@ class TParser ( Parser ): self.state = 126 + self._errHandler.sync(self) token = self._input.LA(1) if token in [TParser.T__13, TParser.T__14, TParser.T__15, TParser.T__16, TParser.T__17, TParser.T__18, TParser.T__21, TParser.IDENTIFIER]: self.state = 124 self.typeSymbol() - + pass elif token in [TParser.T__7]: self.state = 125 self.match(TParser.T__7) - + pass else: raise NoViableAltException(self) @@ -876,6 +884,7 @@ class TParser ( Parser ): self.state = 136 self.match(TParser.T__9) self.state = 138 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 137 @@ -944,6 +953,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 141 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 140 @@ -961,6 +971,7 @@ class TParser ( Parser ): _la = self._input.LA(1) self.state = 150 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__10: self.state = 149 @@ -972,6 +983,7 @@ class TParser ( Parser ): self.state = 153 localctx.name = self.match(TParser.IDENTIFIER) self.state = 155 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 154 @@ -1032,6 +1044,7 @@ class TParser ( Parser ): self.state = 158 localctx.name = self.match(TParser.IDENTIFIER) self.state = 160 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__11: self.state = 159 @@ -1158,6 +1171,7 @@ class TParser ( Parser ): self.state = 172 localctx.name = self.match(TParser.IDENTIFIER) self.state = 175 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__12: self.state = 173 @@ -1222,27 +1236,28 @@ class TParser ( Parser ): self.enterRule(localctx, 24, self.RULE_typeSymbol) try: self.state = 181 + self._errHandler.sync(self) token = self._input.LA(1) if token in [TParser.T__13, TParser.T__14, TParser.T__15, TParser.T__16, TParser.T__17]: self.enterOuterAlt(localctx, 1) self.state = 177 self.primitiveTypeSymbol() - + pass elif token in [TParser.IDENTIFIER]: self.enterOuterAlt(localctx, 2) self.state = 178 self.complexTypeSymbol() - + pass elif token in [TParser.T__18]: self.enterOuterAlt(localctx, 3) self.state = 179 self.listTypeSymbol() - + pass elif token in [TParser.T__21]: self.enterOuterAlt(localctx, 4) self.state = 180 self.modelTypeSymbol() - + pass else: raise NoViableAltException(self) @@ -1334,32 +1349,33 @@ class TParser ( Parser ): self.enterRule(localctx, 28, self.RULE_primitiveTypeSymbol) try: self.state = 190 + self._errHandler.sync(self) token = self._input.LA(1) if token in [TParser.T__13]: self.enterOuterAlt(localctx, 1) self.state = 185 localctx.name = self.match(TParser.T__13) - + pass elif token in [TParser.T__14]: self.enterOuterAlt(localctx, 2) self.state = 186 localctx.name = self.match(TParser.T__14) - + pass elif token in [TParser.T__15]: self.enterOuterAlt(localctx, 3) self.state = 187 localctx.name = self.match(TParser.T__15) - + pass elif token in [TParser.T__16]: self.enterOuterAlt(localctx, 4) self.state = 188 localctx.name = self.match(TParser.T__16) - + pass elif token in [TParser.T__17]: self.enterOuterAlt(localctx, 5) self.state = 189 localctx.name = self.match(TParser.T__17) - + pass else: raise NoViableAltException(self) @@ -1533,6 +1549,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 203 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 202 @@ -1568,6 +1585,7 @@ class TParser ( Parser ): self.state = 220 self.match(TParser.T__5) self.state = 222 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 221 @@ -1635,6 +1653,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 225 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 224 @@ -1656,6 +1675,7 @@ class TParser ( Parser ): self.state = 234 localctx.name = self.match(TParser.IDENTIFIER) self.state = 236 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 235 @@ -1730,6 +1750,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 239 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 238 @@ -1765,6 +1786,7 @@ class TParser ( Parser ): self.state = 256 self.match(TParser.T__5) self.state = 258 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__1: self.state = 257 @@ -1814,17 +1836,18 @@ class TParser ( Parser ): self.enterRule(localctx, 40, self.RULE_enumTypeSymbol) try: self.state = 262 + self._errHandler.sync(self) token = self._input.LA(1) if token in [TParser.T__23]: self.enterOuterAlt(localctx, 1) self.state = 260 localctx.isEnum = self.match(TParser.T__23) - + pass elif token in [TParser.T__24]: self.enterOuterAlt(localctx, 2) self.state = 261 localctx.isFlag = self.match(TParser.T__24) - + pass else: raise NoViableAltException(self) @@ -1889,6 +1912,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 265 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.DOCCOMMENT: self.state = 264 @@ -1908,6 +1932,7 @@ class TParser ( Parser ): self.state = 273 localctx.name = self.match(TParser.IDENTIFIER) self.state = 276 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__12: self.state = 274 @@ -1917,6 +1942,7 @@ class TParser ( Parser ): self.state = 279 + self._errHandler.sync(self) _la = self._input.LA(1) if _la==TParser.T__11: self.state = 278 @@ -1970,17 +1996,18 @@ class TParser ( Parser ): self.enterRule(localctx, 44, self.RULE_intSymbol) try: self.state = 283 + self._errHandler.sync(self) token = self._input.LA(1) if token in [TParser.INTCONSTANT]: self.enterOuterAlt(localctx, 1) self.state = 281 localctx.value = self.match(TParser.INTCONSTANT) - + pass elif token in [TParser.HEXCONSTANT]: self.enterOuterAlt(localctx, 2) self.state = 282 localctx.value = self.match(TParser.HEXCONSTANT) - + pass else: raise NoViableAltException(self) diff --git a/qface/idl/parser/TVisitor.py b/qface/idl/parser/TVisitor.py index adafdea..64b345a 100644 --- a/qface/idl/parser/TVisitor.py +++ b/qface/idl/parser/TVisitor.py @@ -1,4 +1,4 @@ -# Generated from T.g4 by ANTLR 4.5.3 +# Generated from T.g4 by ANTLR 4.6 from antlr4 import * if __name__ is not None and "." in __name__: from .TParser import TParser diff --git a/requirements.txt b/requirements.txt index adb387a..bbcf80e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -antlr4-python3-runtime +antlr4-python3-runtime>=4.6 jinja2 click path.py |