diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-09-06 13:52:32 +0200 |
---|---|---|
committer | Juergen Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-30 10:01:20 +0100 |
commit | 5c5ca49f9c16b0ae746ee5775867598725b08208 (patch) | |
tree | 4e15bd3b89f815da9b6d3edfde50d7f683f7c2a5 /qface | |
parent | e160fc94b126baaa90af06a5cb72648bfa70ebb9 (diff) | |
download | qtivi-qface-5c5ca49f9c16b0ae746ee5775867598725b08208.tar.gz |
Renamed face files to QDL and changed package identified in grammar and everywhere else to module.
Diffstat (limited to 'qface')
-rw-r--r-- | qface/generator.py | 4 | ||||
-rw-r--r-- | qface/idl/domain.py | 108 | ||||
-rw-r--r-- | qface/idl/listener.py | 24 | ||||
-rw-r--r-- | qface/idl/parser/T.g4 | 8 | ||||
-rw-r--r-- | qface/idl/parser/T.tokens | 2 | ||||
-rw-r--r-- | qface/idl/parser/TLexer.py | 168 | ||||
-rw-r--r-- | qface/idl/parser/TLexer.tokens | 2 | ||||
-rw-r--r-- | qface/idl/parser/TListener.py | 8 | ||||
-rw-r--r-- | qface/idl/parser/TParser.py | 34 | ||||
-rw-r--r-- | qface/idl/parser/TVisitor.py | 4 |
10 files changed, 181 insertions, 181 deletions
diff --git a/qface/generator.py b/qface/generator.py index 86a61f8..110e3af 100644 --- a/qface/generator.py +++ b/qface/generator.py @@ -115,7 +115,7 @@ class FileSystem(object): system = cache[identifier] else: # if domain model not cached generate it - documents = path.rglob('*.qface') + documents = path.rglob('*.qdl') for document in documents: listener = DomainListener(system) FileSystem._parse_document(document, listener) @@ -123,7 +123,7 @@ class FileSystem(object): return system @staticmethod - def find_files(path, glob='*.qface'): + def find_files(path, glob='*.qdl'): """Find recursively all files given by glob parameter in a give directory path""" path = Path(path) diff --git a/qface/idl/domain.py b/qface/idl/domain.py index a02548a..761d1c7 100644 --- a/qface/idl/domain.py +++ b/qface/idl/domain.py @@ -5,20 +5,20 @@ import logging log = logging.getLogger(__name__) # System -# +- Package +# +- Module # +- Import # +- Interface -# +- Attribute -# +- Operation -# +- Struct -# +- Enum +# +- Attribute => Property +# +- Operation => Method +# +- Struct (has attributes) +# +- Enum (has values) class System(object): - """The root entity which consist of packages""" + """The root entity which consist of modules""" def __init__(self): log.debug('System()') - self.packageMap = OrderedDict() # type: Dict[str, Package] + self.moduleMap = OrderedDict() # type: Dict[str, Module] def __unicode__(self): return 'system' @@ -27,52 +27,52 @@ class System(object): return '<System>' @property - def packages(self): - return self.packageMap.values() + def modules(self): + return self.moduleMap.values() - def lookup_package(self, name: str): - return self.packageMap[name] + def lookup_module(self, name: str): + return self.moduleMap[name] def lookup_interface(self, name: str): - package_name, type_name = name.rsplit('.', 1) - package = self.packageMap[package_name] - return package.interfaceMap[type_name] + module_name, type_name = name.rsplit('.', 1) + module = self.moduleMap[module_name] + return module.interfaceMap[type_name] def lookup_struct(self, name: str): - package_name, type_name = name.rsplit('.', 1) - package = self.packageMap[package_name] - return package.structMap[type_name] + module_name, type_name = name.rsplit('.', 1) + module = self.moduleMap[module_name] + return module.structMap[type_name] def lookup_enum(self, name: str): - package_name, type_name = name.rsplit('.', 1) - package = self.packageMap[package_name] - return package.enumMap[type_name] + module_name, type_name = name.rsplit('.', 1) + module = self.moduleMap[module_name] + return module.enumMap[type_name] def lookup_definition(self, name: str): parts = name.rsplit('.', 1) if len(parts) == 2: - package_name = parts[0] + module_name = parts[0] type_name = parts[1] - package = self.packageMap[package_name] - return package.lookup_definition(type_name) + module = self.moduleMap[module_name] + return module.lookup_definition(type_name) @property def system(self): return self -class Package(object): - """A packages is a namespace for types, e.g. interfaces, enums, structs""" +class Module(object): + """A module is a namespace for types, e.g. interfaces, enums, structs""" def __init__(self, name: str, system: System): - log.debug('Package()') + log.debug('Module()') self.name = name self.system = system - self.system.packageMap[name] = self + self.system.moduleMap[name] = self self.interfaceMap = OrderedDict() # type: Dict[str, Service] self.structMap = OrderedDict() # type: Dict[str, Struct] self.enumMap = OrderedDict() # type: Dict[str, Enum] self.definitionMap = ChainMap(self.interfaceMap, self.structMap, self.enumMap) - self.importMap = OrderedDict() # type: Dict[str, Package] + self.importMap = OrderedDict() # type: Dict[str, Module] @property def interfaces(self): @@ -98,9 +98,9 @@ class Package(object): if name in self.definitionMap: return self.definitionMap[name] - def lookup_package(self, name: str): - if name in self.system.packageMap: - return self.system.packageMap[name] + def lookup_module(self, name: str): + if name in self.system.moduleMap: + return self.system.moduleMap[name] def __unicode__(self): return self.name @@ -112,14 +112,14 @@ class Package(object): class Symbol(object): """A symbol represents a base class for names elements""" - def __init__(self, name: str, package: Package): + def __init__(self, name: str, module: Module): self.name = name - self.package = package + self.module = module self.comment = '' @property def system(self): - return self.package.system + return self.module.system def __unicode__(self): return self.name @@ -129,20 +129,20 @@ class Symbol(object): @property def qualifiedName(self): - return '{0}.{1}'.format(self.package.name, self.name) + return '{0}.{1}'.format(self.module.name, self.name) class TypedSymbol(Symbol): """A symbol which has a type""" - def __init__(self, name: str, package: Package): - super().__init__(name, package) + def __init__(self, name: str, module: Module): + super().__init__(name, module) self.type = TypeSymbol("", self) class TypeSymbol(Symbol): """Defines a type in the system""" def __init__(self, name: str, parent: Symbol): - super().__init__(name, parent.package) + super().__init__(name, parent.module) log.debug('TypeSymbol()') self.parent = parent self.is_void = False # type:bool @@ -171,7 +171,7 @@ class TypeSymbol(Symbol): def definition(self): if not self.is_complex: return - result = self.package.lookup_definition(self.name) + result = self.module.lookup_definition(self.name) if not result: result = self.system.lookup_definition(self.name) return result @@ -188,10 +188,10 @@ class TypeSymbol(Symbol): class Interface(Symbol): """A interface is an object with operations, attributes and events""" - def __init__(self, name: str, package: Package): - super().__init__(name, package) + def __init__(self, name: str, module: Module): + super().__init__(name, module) log.debug('Interface()') - self.package.interfaceMap[name] = self + self.module.interfaceMap[name] = self self.attributeMap = OrderedDict() # type: Dict[str, Attribute] self.operationMap = OrderedDict() # type: Dict[str, Operation] self.eventMap = OrderedDict() # type: Dict[str, Operation] @@ -211,10 +211,10 @@ class Interface(Symbol): class Struct(Symbol): """Represents a data container""" - def __init__(self, name: str, package: Package): - super().__init__(name, package) + def __init__(self, name: str, module: Module): + super().__init__(name, module) log.debug('Struct()') - self.package.structMap[name] = self + self.module.structMap[name] = self self.memberMap = OrderedDict() # type: Dict[str, Member] @property @@ -225,7 +225,7 @@ class Struct(Symbol): class Member(TypedSymbol): """A member in a struct""" def __init__(self, name: str, struct: Struct): - super().__init__(name, struct.package) + super().__init__(name, struct.module) log.debug('Member()') self.struct = struct # type:Struct self.struct.memberMap[name] = self @@ -234,7 +234,7 @@ class Member(TypedSymbol): class Operation(TypedSymbol): """An operation inside a interface""" def __init__(self, name: str, interface: Interface, is_event=False): - super().__init__(name, interface.package) + super().__init__(name, interface.module) log.debug('Operation()') self.interface = interface self.is_event = is_event @@ -252,7 +252,7 @@ class Operation(TypedSymbol): class Attribute(TypedSymbol): """A typed attribute inside a interface""" def __init__(self, name: str, interface: Interface): - super().__init__(name, interface.package) + super().__init__(name, interface.module) log.debug('Attribute()') self.interface = interface self.interface.attributeMap[name] = self @@ -260,13 +260,13 @@ class Attribute(TypedSymbol): class Enum(Symbol): - """An enum (flag) inside a package""" - def __init__(self, name: str, package: Package): - super().__init__(name, package) + """An enum (flag) inside a module""" + def __init__(self, name: str, module: Module): + super().__init__(name, module) log.debug('Enum()') self.is_enum = True self.is_flag = False - self.package.enumMap[name] = self + self.module.enumMap[name] = self self.memberMap = OrderedDict() # type: Dict[EnumMember] @property @@ -277,7 +277,7 @@ class Enum(Symbol): class EnumMember(Symbol): """A enum value""" def __init__(self, name: str, enum: Enum): - super().__init__(name, enum.package) + super().__init__(name, enum.module) log.debug('EnumMember()') self.enum = enum self.enum.memberMap[name] = self @@ -287,7 +287,7 @@ class EnumMember(Symbol): class Parameter(TypedSymbol): """An operation parameter""" def __init__(self, name: str, operation: Operation): - super().__init__(name, operation.package) + super().__init__(name, operation.module) log.debug('Parameter()') self.operation = operation self.operation.parameterMap[name] = self diff --git a/qface/idl/listener.py b/qface/idl/listener.py index 5a2f1a1..e3689e1 100644 --- a/qface/idl/listener.py +++ b/qface/idl/listener.py @@ -15,7 +15,7 @@ class DomainListener(TListener): def __init__(self, system): super(DomainListener, self).__init__() self.system = system or System() # type:System - self.package = None # type:Package + self.module = None # type:Module self.interface = None # type:Interface self.struct = None # type:Struct self.enum = None # type:Enum @@ -63,37 +63,37 @@ class DomainListener(TListener): def exitEveryRule(self, ctx): log.debug('exit ' + ctx.__class__.__name__) - def enterPackageSymbol(self, ctx: TParser.PackageSymbolContext): + def enterModuleSymbol(self, ctx: TParser.ModuleSymbolContext): assert self.system name = ctx.name.text - self.package = Package(name, self.system) + self.module = Module(name, self.system) - def exitPackageSymbol(self, ctx: TParser.PackageSymbolContext): + def exitModuleSymbol(self, ctx: TParser.ModuleSymbolContext): pass def enterInterfaceSymbol(self, ctx: TParser.InterfaceSymbolContext): - assert self.package + assert self.module name = ctx.name.text - self.interface = Interface(name, self.package) + self.interface = Interface(name, self.module) self.parse_comment(ctx, self.interface) def exitInterfaceSymbol(self, ctx: TParser.InterfaceSymbolContext): self.interface = None def enterStructSymbol(self, ctx: TParser.StructSymbolContext): - assert self.package + assert self.module name = ctx.name.text - self.struct = Struct(name, self.package) + self.struct = Struct(name, self.module) self.parse_comment(ctx, self.struct) def exitStructSymbol(self, ctx: TParser.StructSymbolContext): self.struct = None def enterEnumSymbol(self, ctx: TParser.EnumSymbolContext): - assert self.package + assert self.module name = ctx.name.text # import ipdb; ipdb.set_trace() - self.enum = Enum(name, self.package) + self.enum = Enum(name, self.module) self.parse_comment(ctx, self.enum) def exitEnumSymbol(self, ctx: TParser.EnumSymbolContext): @@ -157,9 +157,9 @@ class DomainListener(TListener): self.member = None def enterImportSymbol(self, ctx:TParser.ImportSymbolContext): - assert self.package + assert self.module name = ctx.name.text - self.package.importMap[name] = None + self.module.importMap[name] = None def exitImportSymbol(self, ctx:TParser.ImportSymbolContext): diff --git a/qface/idl/parser/T.g4 b/qface/idl/parser/T.g4 index d607466..a8500d3 100644 --- a/qface/idl/parser/T.g4 +++ b/qface/idl/parser/T.g4 @@ -7,19 +7,19 @@ documentSymbol ; /** -package name; +module name; import name; */ headerSymbol - : packageSymbol importSymbol* + : moduleSymbol importSymbol* ; importSymbol : 'import' name=IDENTIFIER ';' ; -packageSymbol - : comment=DOCCOMMENT? 'package' name=IDENTIFIER ';' +moduleSymbol + : comment=DOCCOMMENT? 'module' name=IDENTIFIER ';' ; definitionSymbol diff --git a/qface/idl/parser/T.tokens b/qface/idl/parser/T.tokens index 07637f5..d77faa8 100644 --- a/qface/idl/parser/T.tokens +++ b/qface/idl/parser/T.tokens @@ -31,7 +31,7 @@ COMMENT=30 MULTICOMM=31 'import'=1 ';'=2 -'package'=3 +'module'=3 'interface'=4 '{'=5 '}'=6 diff --git a/qface/idl/parser/TLexer.py b/qface/idl/parser/TLexer.py index 58d35d4..04f843a 100644 --- a/qface/idl/parser/TLexer.py +++ b/qface/idl/parser/TLexer.py @@ -6,105 +6,105 @@ from io import StringIO def serializedATN(): with StringIO() as buf: buf.write("\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2!") - buf.write("\u00f5\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("\u00f4\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\4\34\t\34\4\35\t\35\4\36") buf.write("\t\36\4\37\t\37\4 \t \3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3") - buf.write("\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3") - buf.write("\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\b") - buf.write("\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f") - buf.write("\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\16\3\16\3\16\3") - buf.write("\16\3\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20") - buf.write("\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22") - buf.write("\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25") - buf.write("\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27") - buf.write("\3\27\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\32\5\32\u00b3") - buf.write("\n\32\3\32\6\32\u00b6\n\32\r\32\16\32\u00b7\3\33\3\33") - buf.write("\3\33\3\33\6\33\u00be\n\33\r\33\16\33\u00bf\3\34\3\34") - buf.write("\7\34\u00c4\n\34\f\34\16\34\u00c7\13\34\3\35\3\35\3\35") - buf.write("\3\35\3\35\7\35\u00ce\n\35\f\35\16\35\u00d1\13\35\3\35") - buf.write("\3\35\3\35\3\36\6\36\u00d7\n\36\r\36\16\36\u00d8\3\36") - buf.write("\3\36\3\37\3\37\3\37\3\37\7\37\u00e1\n\37\f\37\16\37\u00e4") - buf.write("\13\37\3\37\3\37\3 \3 \3 \3 \7 \u00ec\n \f \16 \u00ef") - buf.write("\13 \3 \3 \3 \3 \3 \4\u00cf\u00ed\2!\3\3\5\4\7\5\t\6\13") + buf.write("\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3") + buf.write("\5\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\b\3\b") + buf.write("\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f") + buf.write("\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\16\3\16\3\16\3\16\3") + buf.write("\16\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\21") + buf.write("\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22") + buf.write("\3\23\3\23\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25\3\26") + buf.write("\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27") + buf.write("\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\32\5\32\u00b2\n") + buf.write("\32\3\32\6\32\u00b5\n\32\r\32\16\32\u00b6\3\33\3\33\3") + buf.write("\33\3\33\6\33\u00bd\n\33\r\33\16\33\u00be\3\34\3\34\7") + buf.write("\34\u00c3\n\34\f\34\16\34\u00c6\13\34\3\35\3\35\3\35\3") + buf.write("\35\3\35\7\35\u00cd\n\35\f\35\16\35\u00d0\13\35\3\35\3") + buf.write("\35\3\35\3\36\6\36\u00d6\n\36\r\36\16\36\u00d7\3\36\3") + buf.write("\36\3\37\3\37\3\37\3\37\7\37\u00e0\n\37\f\37\16\37\u00e3") + buf.write("\13\37\3\37\3\37\3 \3 \3 \3 \7 \u00eb\n \f \16 \u00ee") + buf.write("\13 \3 \3 \3 \3 \3 \4\u00ce\u00ec\2!\3\3\5\4\7\5\t\6\13") buf.write("\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37") buf.write("\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34") buf.write("\67\359\36;\37= ?!\3\2\b\4\2--//\5\2\62;CHch\6\2\62;C") buf.write("\\aac|\b\2\60\60\62;C\\^^aac|\5\2\13\f\17\17\"\"\4\2\f") - buf.write("\f\17\17\u00fc\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t") + buf.write("\f\17\17\u00fb\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t") buf.write("\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3") buf.write("\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2") buf.write("\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2") buf.write("\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2") buf.write("\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65") buf.write("\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2") - buf.write("\2?\3\2\2\2\3A\3\2\2\2\5H\3\2\2\2\7J\3\2\2\2\tR\3\2\2") - buf.write("\2\13\\\3\2\2\2\r^\3\2\2\2\17`\3\2\2\2\21f\3\2\2\2\23") - buf.write("k\3\2\2\2\25m\3\2\2\2\27o\3\2\2\2\31x\3\2\2\2\33z\3\2") - buf.write("\2\2\35\177\3\2\2\2\37\u0083\3\2\2\2!\u0088\3\2\2\2#\u008f") - buf.write("\3\2\2\2%\u0094\3\2\2\2\'\u0096\3\2\2\2)\u0098\3\2\2\2") - buf.write("+\u009e\3\2\2\2-\u00a5\3\2\2\2/\u00aa\3\2\2\2\61\u00af") - buf.write("\3\2\2\2\63\u00b2\3\2\2\2\65\u00b9\3\2\2\2\67\u00c1\3") - buf.write("\2\2\29\u00c8\3\2\2\2;\u00d6\3\2\2\2=\u00dc\3\2\2\2?\u00e7") + buf.write("\2?\3\2\2\2\3A\3\2\2\2\5H\3\2\2\2\7J\3\2\2\2\tQ\3\2\2") + buf.write("\2\13[\3\2\2\2\r]\3\2\2\2\17_\3\2\2\2\21e\3\2\2\2\23j") + buf.write("\3\2\2\2\25l\3\2\2\2\27n\3\2\2\2\31w\3\2\2\2\33y\3\2\2") + buf.write("\2\35~\3\2\2\2\37\u0082\3\2\2\2!\u0087\3\2\2\2#\u008e") + buf.write("\3\2\2\2%\u0093\3\2\2\2\'\u0095\3\2\2\2)\u0097\3\2\2\2") + buf.write("+\u009d\3\2\2\2-\u00a4\3\2\2\2/\u00a9\3\2\2\2\61\u00ae") + buf.write("\3\2\2\2\63\u00b1\3\2\2\2\65\u00b8\3\2\2\2\67\u00c0\3") + buf.write("\2\2\29\u00c7\3\2\2\2;\u00d5\3\2\2\2=\u00db\3\2\2\2?\u00e6") buf.write("\3\2\2\2AB\7k\2\2BC\7o\2\2CD\7r\2\2DE\7q\2\2EF\7t\2\2") - buf.write("FG\7v\2\2G\4\3\2\2\2HI\7=\2\2I\6\3\2\2\2JK\7r\2\2KL\7") - buf.write("c\2\2LM\7e\2\2MN\7m\2\2NO\7c\2\2OP\7i\2\2PQ\7g\2\2Q\b") - buf.write("\3\2\2\2RS\7k\2\2ST\7p\2\2TU\7v\2\2UV\7g\2\2VW\7t\2\2") - buf.write("WX\7h\2\2XY\7c\2\2YZ\7e\2\2Z[\7g\2\2[\n\3\2\2\2\\]\7}") - buf.write("\2\2]\f\3\2\2\2^_\7\177\2\2_\16\3\2\2\2`a\7g\2\2ab\7x") - buf.write("\2\2bc\7g\2\2cd\7p\2\2de\7v\2\2e\20\3\2\2\2fg\7x\2\2g") - buf.write("h\7q\2\2hi\7k\2\2ij\7f\2\2j\22\3\2\2\2kl\7*\2\2l\24\3") - buf.write("\2\2\2mn\7+\2\2n\26\3\2\2\2op\7t\2\2pq\7g\2\2qr\7c\2\2") - buf.write("rs\7f\2\2st\7q\2\2tu\7p\2\2uv\7n\2\2vw\7{\2\2w\30\3\2") - buf.write("\2\2xy\7.\2\2y\32\3\2\2\2z{\7d\2\2{|\7q\2\2|}\7q\2\2}") - buf.write("~\7n\2\2~\34\3\2\2\2\177\u0080\7k\2\2\u0080\u0081\7p\2") - buf.write("\2\u0081\u0082\7v\2\2\u0082\36\3\2\2\2\u0083\u0084\7t") - buf.write("\2\2\u0084\u0085\7g\2\2\u0085\u0086\7c\2\2\u0086\u0087") - buf.write("\7n\2\2\u0087 \3\2\2\2\u0088\u0089\7u\2\2\u0089\u008a") - buf.write("\7v\2\2\u008a\u008b\7t\2\2\u008b\u008c\7k\2\2\u008c\u008d") - buf.write("\7p\2\2\u008d\u008e\7i\2\2\u008e\"\3\2\2\2\u008f\u0090") - buf.write("\7n\2\2\u0090\u0091\7k\2\2\u0091\u0092\7u\2\2\u0092\u0093") - buf.write("\7v\2\2\u0093$\3\2\2\2\u0094\u0095\7>\2\2\u0095&\3\2\2") - buf.write("\2\u0096\u0097\7@\2\2\u0097(\3\2\2\2\u0098\u0099\7o\2") - buf.write("\2\u0099\u009a\7q\2\2\u009a\u009b\7f\2\2\u009b\u009c\7") - buf.write("g\2\2\u009c\u009d\7n\2\2\u009d*\3\2\2\2\u009e\u009f\7") - buf.write("u\2\2\u009f\u00a0\7v\2\2\u00a0\u00a1\7t\2\2\u00a1\u00a2") - buf.write("\7w\2\2\u00a2\u00a3\7e\2\2\u00a3\u00a4\7v\2\2\u00a4,\3") - buf.write("\2\2\2\u00a5\u00a6\7g\2\2\u00a6\u00a7\7p\2\2\u00a7\u00a8") - buf.write("\7w\2\2\u00a8\u00a9\7o\2\2\u00a9.\3\2\2\2\u00aa\u00ab") - buf.write("\7h\2\2\u00ab\u00ac\7n\2\2\u00ac\u00ad\7c\2\2\u00ad\u00ae") - buf.write("\7i\2\2\u00ae\60\3\2\2\2\u00af\u00b0\7?\2\2\u00b0\62\3") - buf.write("\2\2\2\u00b1\u00b3\t\2\2\2\u00b2\u00b1\3\2\2\2\u00b2\u00b3") - buf.write("\3\2\2\2\u00b3\u00b5\3\2\2\2\u00b4\u00b6\4\62;\2\u00b5") - buf.write("\u00b4\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7\u00b5\3\2\2\2") - buf.write("\u00b7\u00b8\3\2\2\2\u00b8\64\3\2\2\2\u00b9\u00ba\7\62") - buf.write("\2\2\u00ba\u00bb\7z\2\2\u00bb\u00bd\3\2\2\2\u00bc\u00be") - buf.write("\t\3\2\2\u00bd\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf") - buf.write("\u00bd\3\2\2\2\u00bf\u00c0\3\2\2\2\u00c0\66\3\2\2\2\u00c1") - buf.write("\u00c5\t\4\2\2\u00c2\u00c4\t\5\2\2\u00c3\u00c2\3\2\2\2") - buf.write("\u00c4\u00c7\3\2\2\2\u00c5\u00c3\3\2\2\2\u00c5\u00c6\3") - buf.write("\2\2\2\u00c68\3\2\2\2\u00c7\u00c5\3\2\2\2\u00c8\u00c9") - buf.write("\7\61\2\2\u00c9\u00ca\7,\2\2\u00ca\u00cb\7#\2\2\u00cb") - buf.write("\u00cf\3\2\2\2\u00cc\u00ce\13\2\2\2\u00cd\u00cc\3\2\2") - buf.write("\2\u00ce\u00d1\3\2\2\2\u00cf\u00d0\3\2\2\2\u00cf\u00cd") - buf.write("\3\2\2\2\u00d0\u00d2\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d2") - buf.write("\u00d3\7,\2\2\u00d3\u00d4\7\61\2\2\u00d4:\3\2\2\2\u00d5") - buf.write("\u00d7\t\6\2\2\u00d6\u00d5\3\2\2\2\u00d7\u00d8\3\2\2\2") - buf.write("\u00d8\u00d6\3\2\2\2\u00d8\u00d9\3\2\2\2\u00d9\u00da\3") - buf.write("\2\2\2\u00da\u00db\b\36\2\2\u00db<\3\2\2\2\u00dc\u00dd") - buf.write("\7\61\2\2\u00dd\u00de\7\61\2\2\u00de\u00e2\3\2\2\2\u00df") - buf.write("\u00e1\n\7\2\2\u00e0\u00df\3\2\2\2\u00e1\u00e4\3\2\2\2") - buf.write("\u00e2\u00e0\3\2\2\2\u00e2\u00e3\3\2\2\2\u00e3\u00e5\3") - buf.write("\2\2\2\u00e4\u00e2\3\2\2\2\u00e5\u00e6\b\37\2\2\u00e6") - buf.write(">\3\2\2\2\u00e7\u00e8\7\61\2\2\u00e8\u00e9\7,\2\2\u00e9") - buf.write("\u00ed\3\2\2\2\u00ea\u00ec\13\2\2\2\u00eb\u00ea\3\2\2") - buf.write("\2\u00ec\u00ef\3\2\2\2\u00ed\u00ee\3\2\2\2\u00ed\u00eb") - buf.write("\3\2\2\2\u00ee\u00f0\3\2\2\2\u00ef\u00ed\3\2\2\2\u00f0") - buf.write("\u00f1\7,\2\2\u00f1\u00f2\7\61\2\2\u00f2\u00f3\3\2\2\2") - buf.write("\u00f3\u00f4\b \2\2\u00f4@\3\2\2\2\13\2\u00b2\u00b7\u00bf") - buf.write("\u00c5\u00cf\u00d8\u00e2\u00ed\3\b\2\2") + buf.write("FG\7v\2\2G\4\3\2\2\2HI\7=\2\2I\6\3\2\2\2JK\7o\2\2KL\7") + buf.write("q\2\2LM\7f\2\2MN\7w\2\2NO\7n\2\2OP\7g\2\2P\b\3\2\2\2Q") + buf.write("R\7k\2\2RS\7p\2\2ST\7v\2\2TU\7g\2\2UV\7t\2\2VW\7h\2\2") + buf.write("WX\7c\2\2XY\7e\2\2YZ\7g\2\2Z\n\3\2\2\2[\\\7}\2\2\\\f\3") + buf.write("\2\2\2]^\7\177\2\2^\16\3\2\2\2_`\7g\2\2`a\7x\2\2ab\7g") + buf.write("\2\2bc\7p\2\2cd\7v\2\2d\20\3\2\2\2ef\7x\2\2fg\7q\2\2g") + buf.write("h\7k\2\2hi\7f\2\2i\22\3\2\2\2jk\7*\2\2k\24\3\2\2\2lm\7") + buf.write("+\2\2m\26\3\2\2\2no\7t\2\2op\7g\2\2pq\7c\2\2qr\7f\2\2") + buf.write("rs\7q\2\2st\7p\2\2tu\7n\2\2uv\7{\2\2v\30\3\2\2\2wx\7.") + buf.write("\2\2x\32\3\2\2\2yz\7d\2\2z{\7q\2\2{|\7q\2\2|}\7n\2\2}") + buf.write("\34\3\2\2\2~\177\7k\2\2\177\u0080\7p\2\2\u0080\u0081\7") + buf.write("v\2\2\u0081\36\3\2\2\2\u0082\u0083\7t\2\2\u0083\u0084") + buf.write("\7g\2\2\u0084\u0085\7c\2\2\u0085\u0086\7n\2\2\u0086 \3") + buf.write("\2\2\2\u0087\u0088\7u\2\2\u0088\u0089\7v\2\2\u0089\u008a") + buf.write("\7t\2\2\u008a\u008b\7k\2\2\u008b\u008c\7p\2\2\u008c\u008d") + buf.write("\7i\2\2\u008d\"\3\2\2\2\u008e\u008f\7n\2\2\u008f\u0090") + buf.write("\7k\2\2\u0090\u0091\7u\2\2\u0091\u0092\7v\2\2\u0092$\3") + buf.write("\2\2\2\u0093\u0094\7>\2\2\u0094&\3\2\2\2\u0095\u0096\7") + buf.write("@\2\2\u0096(\3\2\2\2\u0097\u0098\7o\2\2\u0098\u0099\7") + buf.write("q\2\2\u0099\u009a\7f\2\2\u009a\u009b\7g\2\2\u009b\u009c") + buf.write("\7n\2\2\u009c*\3\2\2\2\u009d\u009e\7u\2\2\u009e\u009f") + buf.write("\7v\2\2\u009f\u00a0\7t\2\2\u00a0\u00a1\7w\2\2\u00a1\u00a2") + buf.write("\7e\2\2\u00a2\u00a3\7v\2\2\u00a3,\3\2\2\2\u00a4\u00a5") + buf.write("\7g\2\2\u00a5\u00a6\7p\2\2\u00a6\u00a7\7w\2\2\u00a7\u00a8") + buf.write("\7o\2\2\u00a8.\3\2\2\2\u00a9\u00aa\7h\2\2\u00aa\u00ab") + buf.write("\7n\2\2\u00ab\u00ac\7c\2\2\u00ac\u00ad\7i\2\2\u00ad\60") + buf.write("\3\2\2\2\u00ae\u00af\7?\2\2\u00af\62\3\2\2\2\u00b0\u00b2") + buf.write("\t\2\2\2\u00b1\u00b0\3\2\2\2\u00b1\u00b2\3\2\2\2\u00b2") + buf.write("\u00b4\3\2\2\2\u00b3\u00b5\4\62;\2\u00b4\u00b3\3\2\2\2") + buf.write("\u00b5\u00b6\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6\u00b7\3") + buf.write("\2\2\2\u00b7\64\3\2\2\2\u00b8\u00b9\7\62\2\2\u00b9\u00ba") + buf.write("\7z\2\2\u00ba\u00bc\3\2\2\2\u00bb\u00bd\t\3\2\2\u00bc") + buf.write("\u00bb\3\2\2\2\u00bd\u00be\3\2\2\2\u00be\u00bc\3\2\2\2") + buf.write("\u00be\u00bf\3\2\2\2\u00bf\66\3\2\2\2\u00c0\u00c4\t\4") + buf.write("\2\2\u00c1\u00c3\t\5\2\2\u00c2\u00c1\3\2\2\2\u00c3\u00c6") + buf.write("\3\2\2\2\u00c4\u00c2\3\2\2\2\u00c4\u00c5\3\2\2\2\u00c5") + buf.write("8\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c7\u00c8\7\61\2\2\u00c8") + buf.write("\u00c9\7,\2\2\u00c9\u00ca\7#\2\2\u00ca\u00ce\3\2\2\2\u00cb") + buf.write("\u00cd\13\2\2\2\u00cc\u00cb\3\2\2\2\u00cd\u00d0\3\2\2") + buf.write("\2\u00ce\u00cf\3\2\2\2\u00ce\u00cc\3\2\2\2\u00cf\u00d1") + buf.write("\3\2\2\2\u00d0\u00ce\3\2\2\2\u00d1\u00d2\7,\2\2\u00d2") + buf.write("\u00d3\7\61\2\2\u00d3:\3\2\2\2\u00d4\u00d6\t\6\2\2\u00d5") + buf.write("\u00d4\3\2\2\2\u00d6\u00d7\3\2\2\2\u00d7\u00d5\3\2\2\2") + buf.write("\u00d7\u00d8\3\2\2\2\u00d8\u00d9\3\2\2\2\u00d9\u00da\b") + buf.write("\36\2\2\u00da<\3\2\2\2\u00db\u00dc\7\61\2\2\u00dc\u00dd") + buf.write("\7\61\2\2\u00dd\u00e1\3\2\2\2\u00de\u00e0\n\7\2\2\u00df") + buf.write("\u00de\3\2\2\2\u00e0\u00e3\3\2\2\2\u00e1\u00df\3\2\2\2") + buf.write("\u00e1\u00e2\3\2\2\2\u00e2\u00e4\3\2\2\2\u00e3\u00e1\3") + buf.write("\2\2\2\u00e4\u00e5\b\37\2\2\u00e5>\3\2\2\2\u00e6\u00e7") + buf.write("\7\61\2\2\u00e7\u00e8\7,\2\2\u00e8\u00ec\3\2\2\2\u00e9") + buf.write("\u00eb\13\2\2\2\u00ea\u00e9\3\2\2\2\u00eb\u00ee\3\2\2") + buf.write("\2\u00ec\u00ed\3\2\2\2\u00ec\u00ea\3\2\2\2\u00ed\u00ef") + buf.write("\3\2\2\2\u00ee\u00ec\3\2\2\2\u00ef\u00f0\7,\2\2\u00f0") + buf.write("\u00f1\7\61\2\2\u00f1\u00f2\3\2\2\2\u00f2\u00f3\b \2\2") + buf.write("\u00f3@\3\2\2\2\13\2\u00b1\u00b6\u00be\u00c4\u00ce\u00d7") + buf.write("\u00e1\u00ec\3\b\2\2") return buf.getvalue() @@ -150,7 +150,7 @@ class TLexer(Lexer): modeNames = [ "DEFAULT_MODE" ] literalNames = [ "<INVALID>", - "'import'", "';'", "'package'", "'interface'", "'{'", "'}'", + "'import'", "';'", "'module'", "'interface'", "'{'", "'}'", "'event'", "'void'", "'('", "')'", "'readonly'", "','", "'bool'", "'int'", "'real'", "'string'", "'list'", "'<'", "'>'", "'model'", "'struct'", "'enum'", "'flag'", "'='" ] diff --git a/qface/idl/parser/TLexer.tokens b/qface/idl/parser/TLexer.tokens index 07637f5..d77faa8 100644 --- a/qface/idl/parser/TLexer.tokens +++ b/qface/idl/parser/TLexer.tokens @@ -31,7 +31,7 @@ COMMENT=30 MULTICOMM=31 'import'=1 ';'=2 -'package'=3 +'module'=3 'interface'=4 '{'=5 '}'=6 diff --git a/qface/idl/parser/TListener.py b/qface/idl/parser/TListener.py index d92deaf..066e031 100644 --- a/qface/idl/parser/TListener.py +++ b/qface/idl/parser/TListener.py @@ -35,12 +35,12 @@ class TListener(ParseTreeListener): pass - # Enter a parse tree produced by TParser#packageSymbol. - def enterPackageSymbol(self, ctx:TParser.PackageSymbolContext): + # Enter a parse tree produced by TParser#moduleSymbol. + def enterModuleSymbol(self, ctx:TParser.ModuleSymbolContext): pass - # Exit a parse tree produced by TParser#packageSymbol. - def exitPackageSymbol(self, ctx:TParser.PackageSymbolContext): + # Exit a parse tree produced by TParser#moduleSymbol. + def exitModuleSymbol(self, ctx:TParser.ModuleSymbolContext): pass diff --git a/qface/idl/parser/TParser.py b/qface/idl/parser/TParser.py index e5c3cc9..76b6cca 100644 --- a/qface/idl/parser/TParser.py +++ b/qface/idl/parser/TParser.py @@ -101,7 +101,7 @@ class TParser ( Parser ): sharedContextCache = PredictionContextCache() - literalNames = [ "<INVALID>", "'import'", "';'", "'package'", "'interface'", + literalNames = [ "<INVALID>", "'import'", "';'", "'module'", "'interface'", "'{'", "'}'", "'event'", "'void'", "'('", "')'", "'readonly'", "','", "'bool'", "'int'", "'real'", "'string'", "'list'", "'<'", "'>'", "'model'", "'struct'", "'enum'", "'flag'", @@ -119,7 +119,7 @@ class TParser ( Parser ): RULE_documentSymbol = 0 RULE_headerSymbol = 1 RULE_importSymbol = 2 - RULE_packageSymbol = 3 + RULE_moduleSymbol = 3 RULE_definitionSymbol = 4 RULE_interfaceSymbol = 5 RULE_memberSymbol = 6 @@ -138,7 +138,7 @@ class TParser ( Parser ): RULE_enumMemberSymbol = 19 RULE_intSymbol = 20 - ruleNames = [ "documentSymbol", "headerSymbol", "importSymbol", "packageSymbol", + ruleNames = [ "documentSymbol", "headerSymbol", "importSymbol", "moduleSymbol", "definitionSymbol", "interfaceSymbol", "memberSymbol", "operationSymbol", "attributeSymbol", "parameterSymbol", "typeSymbol", "complexTypeSymbol", "primitiveTypeSymbol", @@ -257,8 +257,8 @@ class TParser ( Parser ): super().__init__(parent, invokingState) self.parser = parser - def packageSymbol(self): - return self.getTypedRuleContext(TParser.PackageSymbolContext,0) + def moduleSymbol(self): + return self.getTypedRuleContext(TParser.ModuleSymbolContext,0) def importSymbol(self, i:int=None): @@ -296,7 +296,7 @@ class TParser ( Parser ): try: self.enterOuterAlt(localctx, 1) self.state = 49 - self.packageSymbol() + self.moduleSymbol() self.state = 53 self._errHandler.sync(self) _la = self._input.LA(1) @@ -365,7 +365,7 @@ class TParser ( Parser ): self.exitRule() return localctx - class PackageSymbolContext(ParserRuleContext): + class ModuleSymbolContext(ParserRuleContext): def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): super().__init__(parent, invokingState) @@ -380,29 +380,29 @@ class TParser ( Parser ): return self.getToken(TParser.DOCCOMMENT, 0) def getRuleIndex(self): - return TParser.RULE_packageSymbol + return TParser.RULE_moduleSymbol def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterPackageSymbol" ): - listener.enterPackageSymbol(self) + if hasattr( listener, "enterModuleSymbol" ): + listener.enterModuleSymbol(self) def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitPackageSymbol" ): - listener.exitPackageSymbol(self) + if hasattr( listener, "exitModuleSymbol" ): + listener.exitModuleSymbol(self) def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitPackageSymbol" ): - return visitor.visitPackageSymbol(self) + if hasattr( visitor, "visitModuleSymbol" ): + return visitor.visitModuleSymbol(self) else: return visitor.visitChildren(self) - def packageSymbol(self): + def moduleSymbol(self): - localctx = TParser.PackageSymbolContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_packageSymbol) + localctx = TParser.ModuleSymbolContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_moduleSymbol) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) diff --git a/qface/idl/parser/TVisitor.py b/qface/idl/parser/TVisitor.py index 560e537..52513fc 100644 --- a/qface/idl/parser/TVisitor.py +++ b/qface/idl/parser/TVisitor.py @@ -24,8 +24,8 @@ class TVisitor(ParseTreeVisitor): return self.visitChildren(ctx) - # Visit a parse tree produced by TParser#packageSymbol. - def visitPackageSymbol(self, ctx:TParser.PackageSymbolContext): + # Visit a parse tree produced by TParser#moduleSymbol. + def visitModuleSymbol(self, ctx:TParser.ModuleSymbolContext): return self.visitChildren(ctx) |