diff --git a/.swiftlint.yml b/.swiftlint.yml index 40563aea..6503e53e 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -76,6 +76,8 @@ excluded: - PrismAPISDK - Sources/PrismSwiftSDK/protobuf - Tests/PrismSwiftSDKTests + - Castor/Sources/DIDGrammar + - Castor/Tests line_length: ignores_comments: true ignores_urls: true diff --git a/Castor/Sources/DIDGrammar/DIDAbnf.g4 b/Castor/Sources/DIDGrammar/DIDAbnf.g4 new file mode 100644 index 00000000..ac2a01d2 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnf.g4 @@ -0,0 +1,34 @@ +grammar DIDAbnf; + +did + : SCHEMA ':' method_name ':' method_specific_id EOF + ; +method_name + : (ALPHA | DIGIT)+ + ; + +method_specific_id + : ( idchar+ ':' )* idchar+ + ; + +idchar + : ( ALPHA | DIGIT | PERIOD | DASH | UNDERSCORE | PCT_ENCODED ) + ; + +fragment D : ('d' | 'D'); +fragment I : ('i' | 'I'); +SCHEMA : D I D; + +fragment LOWERCASE : [a-z]; +fragment UPPERCASE : [A-Z]; +ALPHA : ( LOWERCASE | UPPERCASE ); + +fragment HEX : [0-9a-fA-F]; +DIGIT : [0-9]; +PCT_ENCODED : PERCENT HEX HEX; +PERCENT : '%'; +DASH : '-'; +PERIOD : '.'; +COLON : ':'; +UNDERSCORE : '_'; + diff --git a/Castor/Sources/DIDGrammar/DIDAbnf.interp b/Castor/Sources/DIDGrammar/DIDAbnf.interp new file mode 100644 index 00000000..84a17107 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnf.interp @@ -0,0 +1,33 @@ +token literal names: +null +null +null +null +null +'%' +'-' +'.' +':' +'_' + +token symbolic names: +null +SCHEMA +ALPHA +DIGIT +PCT_ENCODED +PERCENT +DASH +PERIOD +COLON +UNDERSCORE + +rule names: +did +method_name +method_specific_id +idchar + + +atn: +[4, 1, 9, 40, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 4, 1, 17, 8, 1, 11, 1, 12, 1, 18, 1, 2, 4, 2, 22, 8, 2, 11, 2, 12, 2, 23, 1, 2, 1, 2, 5, 2, 28, 8, 2, 10, 2, 12, 2, 31, 9, 2, 1, 2, 4, 2, 34, 8, 2, 11, 2, 12, 2, 35, 1, 3, 1, 3, 1, 3, 0, 0, 4, 0, 2, 4, 6, 0, 2, 1, 0, 2, 3, 3, 0, 2, 4, 6, 7, 9, 9, 39, 0, 8, 1, 0, 0, 0, 2, 16, 1, 0, 0, 0, 4, 29, 1, 0, 0, 0, 6, 37, 1, 0, 0, 0, 8, 9, 5, 1, 0, 0, 9, 10, 5, 8, 0, 0, 10, 11, 3, 2, 1, 0, 11, 12, 5, 8, 0, 0, 12, 13, 3, 4, 2, 0, 13, 14, 5, 0, 0, 1, 14, 1, 1, 0, 0, 0, 15, 17, 7, 0, 0, 0, 16, 15, 1, 0, 0, 0, 17, 18, 1, 0, 0, 0, 18, 16, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 3, 1, 0, 0, 0, 20, 22, 3, 6, 3, 0, 21, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0, 0, 23, 21, 1, 0, 0, 0, 23, 24, 1, 0, 0, 0, 24, 25, 1, 0, 0, 0, 25, 26, 5, 8, 0, 0, 26, 28, 1, 0, 0, 0, 27, 21, 1, 0, 0, 0, 28, 31, 1, 0, 0, 0, 29, 27, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 33, 1, 0, 0, 0, 31, 29, 1, 0, 0, 0, 32, 34, 3, 6, 3, 0, 33, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 33, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 5, 1, 0, 0, 0, 37, 38, 7, 1, 0, 0, 38, 7, 1, 0, 0, 0, 4, 18, 23, 29, 35] \ No newline at end of file diff --git a/Castor/Sources/DIDGrammar/DIDAbnf.tokens b/Castor/Sources/DIDGrammar/DIDAbnf.tokens new file mode 100644 index 00000000..1c457b5c --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnf.tokens @@ -0,0 +1,14 @@ +SCHEMA=1 +ALPHA=2 +DIGIT=3 +PCT_ENCODED=4 +PERCENT=5 +DASH=6 +PERIOD=7 +COLON=8 +UNDERSCORE=9 +'%'=5 +'-'=6 +'.'=7 +':'=8 +'_'=9 diff --git a/Castor/Sources/DIDGrammar/DIDAbnfBaseListener.swift b/Castor/Sources/DIDGrammar/DIDAbnfBaseListener.swift new file mode 100644 index 00000000..3ab3aa39 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfBaseListener.swift @@ -0,0 +1,89 @@ +// Generated from java-escape by ANTLR 4.11.1 + +import Antlr4 + + +/** + * This class provides an empty implementation of {@link DIDAbnfListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +open class DIDAbnfBaseListener: DIDAbnfListener { + public init() { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func enterDid(_ ctx: DIDAbnfParser.DidContext) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func exitDid(_ ctx: DIDAbnfParser.DidContext) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func enterMethod_name(_ ctx: DIDAbnfParser.Method_nameContext) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func exitMethod_name(_ ctx: DIDAbnfParser.Method_nameContext) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func enterMethod_specific_id(_ ctx: DIDAbnfParser.Method_specific_idContext) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func exitMethod_specific_id(_ ctx: DIDAbnfParser.Method_specific_idContext) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func enterIdchar(_ ctx: DIDAbnfParser.IdcharContext) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func exitIdchar(_ ctx: DIDAbnfParser.IdcharContext) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func enterEveryRule(_ ctx: ParserRuleContext) throws { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func exitEveryRule(_ ctx: ParserRuleContext) throws { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func visitTerminal(_ node: TerminalNode) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + open func visitErrorNode(_ node: ErrorNode) { } +} \ No newline at end of file diff --git a/Castor/Sources/DIDGrammar/DIDAbnfLexer.interp b/Castor/Sources/DIDGrammar/DIDAbnfLexer.interp new file mode 100644 index 00000000..f0c7df02 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfLexer.interp @@ -0,0 +1,49 @@ +token literal names: +null +null +null +null +null +'%' +'-' +'.' +':' +'_' + +token symbolic names: +null +SCHEMA +ALPHA +DIGIT +PCT_ENCODED +PERCENT +DASH +PERIOD +COLON +UNDERSCORE + +rule names: +D +I +SCHEMA +LOWERCASE +UPPERCASE +ALPHA +HEX +DIGIT +PCT_ENCODED +PERCENT +DASH +PERIOD +COLON +UNDERSCORE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 9, 63, 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, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 44, 8, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 0, 0, 14, 1, 0, 3, 0, 5, 1, 7, 0, 9, 0, 11, 2, 13, 0, 15, 3, 17, 4, 19, 5, 21, 6, 23, 7, 25, 8, 27, 9, 1, 0, 6, 2, 0, 68, 68, 100, 100, 2, 0, 73, 73, 105, 105, 1, 0, 97, 122, 1, 0, 65, 90, 3, 0, 48, 57, 65, 70, 97, 102, 1, 0, 48, 57, 58, 0, 5, 1, 0, 0, 0, 0, 11, 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, 1, 29, 1, 0, 0, 0, 3, 31, 1, 0, 0, 0, 5, 33, 1, 0, 0, 0, 7, 37, 1, 0, 0, 0, 9, 39, 1, 0, 0, 0, 11, 43, 1, 0, 0, 0, 13, 45, 1, 0, 0, 0, 15, 47, 1, 0, 0, 0, 17, 49, 1, 0, 0, 0, 19, 53, 1, 0, 0, 0, 21, 55, 1, 0, 0, 0, 23, 57, 1, 0, 0, 0, 25, 59, 1, 0, 0, 0, 27, 61, 1, 0, 0, 0, 29, 30, 7, 0, 0, 0, 30, 2, 1, 0, 0, 0, 31, 32, 7, 1, 0, 0, 32, 4, 1, 0, 0, 0, 33, 34, 3, 1, 0, 0, 34, 35, 3, 3, 1, 0, 35, 36, 3, 1, 0, 0, 36, 6, 1, 0, 0, 0, 37, 38, 7, 2, 0, 0, 38, 8, 1, 0, 0, 0, 39, 40, 7, 3, 0, 0, 40, 10, 1, 0, 0, 0, 41, 44, 3, 7, 3, 0, 42, 44, 3, 9, 4, 0, 43, 41, 1, 0, 0, 0, 43, 42, 1, 0, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46, 7, 4, 0, 0, 46, 14, 1, 0, 0, 0, 47, 48, 7, 5, 0, 0, 48, 16, 1, 0, 0, 0, 49, 50, 3, 19, 9, 0, 50, 51, 3, 13, 6, 0, 51, 52, 3, 13, 6, 0, 52, 18, 1, 0, 0, 0, 53, 54, 5, 37, 0, 0, 54, 20, 1, 0, 0, 0, 55, 56, 5, 45, 0, 0, 56, 22, 1, 0, 0, 0, 57, 58, 5, 46, 0, 0, 58, 24, 1, 0, 0, 0, 59, 60, 5, 58, 0, 0, 60, 26, 1, 0, 0, 0, 61, 62, 5, 95, 0, 0, 62, 28, 1, 0, 0, 0, 2, 0, 43, 0] \ No newline at end of file diff --git a/Castor/Sources/DIDGrammar/DIDAbnfLexer.swift b/Castor/Sources/DIDGrammar/DIDAbnfLexer.swift new file mode 100644 index 00000000..d4a88f2a --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfLexer.swift @@ -0,0 +1,101 @@ +// Generated from java-escape by ANTLR 4.11.1 +import Antlr4 + +open class DIDAbnfLexer: Lexer { + + internal static var _decisionToDFA: [DFA] = { + var decisionToDFA = [DFA]() + let length = DIDAbnfLexer._ATN.getNumberOfDecisions() + for i in 0.. Vocabulary { + return DIDAbnfLexer.VOCABULARY + } + + public + required init(_ input: CharStream) { + RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION) + super.init(input) + _interp = LexerATNSimulator(self, DIDAbnfLexer._ATN, DIDAbnfLexer._decisionToDFA, DIDAbnfLexer._sharedContextCache) + } + + override open + func getGrammarFileName() -> String { return "DIDAbnf.g4" } + + override open + func getRuleNames() -> [String] { return DIDAbnfLexer.ruleNames } + + override open + func getSerializedATN() -> [Int] { return DIDAbnfLexer._serializedATN } + + override open + func getChannelNames() -> [String] { return DIDAbnfLexer.channelNames } + + override open + func getModeNames() -> [String] { return DIDAbnfLexer.modeNames } + + override open + func getATN() -> ATN { return DIDAbnfLexer._ATN } + + static let _serializedATN:[Int] = [ + 4,0,9,63,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,1,0,1, + 0,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,3,5,44,8,5,1,6,1,6,1, + 7,1,7,1,8,1,8,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13, + 0,0,14,1,0,3,0,5,1,7,0,9,0,11,2,13,0,15,3,17,4,19,5,21,6,23,7,25,8,27, + 9,1,0,6,2,0,68,68,100,100,2,0,73,73,105,105,1,0,97,122,1,0,65,90,3,0,48, + 57,65,70,97,102,1,0,48,57,58,0,5,1,0,0,0,0,11,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,1,29,1,0,0,0,3,31,1,0,0,0,5,33,1,0,0,0,7,37,1,0,0,0,9,39,1,0,0,0,11, + 43,1,0,0,0,13,45,1,0,0,0,15,47,1,0,0,0,17,49,1,0,0,0,19,53,1,0,0,0,21, + 55,1,0,0,0,23,57,1,0,0,0,25,59,1,0,0,0,27,61,1,0,0,0,29,30,7,0,0,0,30, + 2,1,0,0,0,31,32,7,1,0,0,32,4,1,0,0,0,33,34,3,1,0,0,34,35,3,3,1,0,35,36, + 3,1,0,0,36,6,1,0,0,0,37,38,7,2,0,0,38,8,1,0,0,0,39,40,7,3,0,0,40,10,1, + 0,0,0,41,44,3,7,3,0,42,44,3,9,4,0,43,41,1,0,0,0,43,42,1,0,0,0,44,12,1, + 0,0,0,45,46,7,4,0,0,46,14,1,0,0,0,47,48,7,5,0,0,48,16,1,0,0,0,49,50,3, + 19,9,0,50,51,3,13,6,0,51,52,3,13,6,0,52,18,1,0,0,0,53,54,5,37,0,0,54,20, + 1,0,0,0,55,56,5,45,0,0,56,22,1,0,0,0,57,58,5,46,0,0,58,24,1,0,0,0,59,60, + 5,58,0,0,60,26,1,0,0,0,61,62,5,95,0,0,62,28,1,0,0,0,2,0,43,0 + ] + + public + static let _ATN: ATN = try! ATNDeserializer().deserialize(_serializedATN) +} \ No newline at end of file diff --git a/Castor/Sources/DIDGrammar/DIDAbnfLexer.tokens b/Castor/Sources/DIDGrammar/DIDAbnfLexer.tokens new file mode 100644 index 00000000..1c457b5c --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfLexer.tokens @@ -0,0 +1,14 @@ +SCHEMA=1 +ALPHA=2 +DIGIT=3 +PCT_ENCODED=4 +PERCENT=5 +DASH=6 +PERIOD=7 +COLON=8 +UNDERSCORE=9 +'%'=5 +'-'=6 +'.'=7 +':'=8 +'_'=9 diff --git a/Castor/Sources/DIDGrammar/DIDAbnfListener.swift b/Castor/Sources/DIDGrammar/DIDAbnfListener.swift new file mode 100644 index 00000000..998aa8f6 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfListener.swift @@ -0,0 +1,57 @@ +// Generated from java-escape by ANTLR 4.11.1 +import Antlr4 + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link DIDAbnfParser}. + */ +public protocol DIDAbnfListener: ParseTreeListener { + /** + * Enter a parse tree produced by {@link DIDAbnfParser#did}. + - Parameters: + - ctx: the parse tree + */ + func enterDid(_ ctx: DIDAbnfParser.DidContext) + /** + * Exit a parse tree produced by {@link DIDAbnfParser#did}. + - Parameters: + - ctx: the parse tree + */ + func exitDid(_ ctx: DIDAbnfParser.DidContext) + /** + * Enter a parse tree produced by {@link DIDAbnfParser#method_name}. + - Parameters: + - ctx: the parse tree + */ + func enterMethod_name(_ ctx: DIDAbnfParser.Method_nameContext) + /** + * Exit a parse tree produced by {@link DIDAbnfParser#method_name}. + - Parameters: + - ctx: the parse tree + */ + func exitMethod_name(_ ctx: DIDAbnfParser.Method_nameContext) + /** + * Enter a parse tree produced by {@link DIDAbnfParser#method_specific_id}. + - Parameters: + - ctx: the parse tree + */ + func enterMethod_specific_id(_ ctx: DIDAbnfParser.Method_specific_idContext) + /** + * Exit a parse tree produced by {@link DIDAbnfParser#method_specific_id}. + - Parameters: + - ctx: the parse tree + */ + func exitMethod_specific_id(_ ctx: DIDAbnfParser.Method_specific_idContext) + /** + * Enter a parse tree produced by {@link DIDAbnfParser#idchar}. + - Parameters: + - ctx: the parse tree + */ + func enterIdchar(_ ctx: DIDAbnfParser.IdcharContext) + /** + * Exit a parse tree produced by {@link DIDAbnfParser#idchar}. + - Parameters: + - ctx: the parse tree + */ + func exitIdchar(_ ctx: DIDAbnfParser.IdcharContext) +} \ No newline at end of file diff --git a/Castor/Sources/DIDGrammar/DIDAbnfParser.swift b/Castor/Sources/DIDGrammar/DIDAbnfParser.swift new file mode 100644 index 00000000..d6df9dd1 --- /dev/null +++ b/Castor/Sources/DIDGrammar/DIDAbnfParser.swift @@ -0,0 +1,403 @@ +// Generated from java-escape by ANTLR 4.11.1 +import Antlr4 + +open class DIDAbnfParser: Parser { + + internal static var _decisionToDFA: [DFA] = { + var decisionToDFA = [DFA]() + let length = DIDAbnfParser._ATN.getNumberOfDecisions() + for i in 0.. String { return "java-escape" } + + override open + func getRuleNames() -> [String] { return DIDAbnfParser.ruleNames } + + override open + func getSerializedATN() -> [Int] { return DIDAbnfParser._serializedATN } + + override open + func getATN() -> ATN { return DIDAbnfParser._ATN } + + + override open + func getVocabulary() -> Vocabulary { + return DIDAbnfParser.VOCABULARY + } + + override public + init(_ input:TokenStream) throws { + RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION) + try super.init(input) + _interp = ParserATNSimulator(self,DIDAbnfParser._ATN,DIDAbnfParser._decisionToDFA, DIDAbnfParser._sharedContextCache) + } + + + public class DidContext: ParserRuleContext { + open + func SCHEMA() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.SCHEMA.rawValue, 0) + } + open + func COLON() -> [TerminalNode] { + return getTokens(DIDAbnfParser.Tokens.COLON.rawValue) + } + open + func COLON(_ i:Int) -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.COLON.rawValue, i) + } + open + func method_name() -> Method_nameContext? { + return getRuleContext(Method_nameContext.self, 0) + } + open + func method_specific_id() -> Method_specific_idContext? { + return getRuleContext(Method_specific_idContext.self, 0) + } + open + func EOF() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.EOF.rawValue, 0) + } + override open + func getRuleIndex() -> Int { + return DIDAbnfParser.RULE_did + } + override open + func enterRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.enterDid(self) + } + } + override open + func exitRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.exitDid(self) + } + } + } + @discardableResult + open func did() throws -> DidContext { + var _localctx: DidContext + _localctx = DidContext(_ctx, getState()) + try enterRule(_localctx, 0, DIDAbnfParser.RULE_did) + defer { + try! exitRule() + } + do { + try enterOuterAlt(_localctx, 1) + setState(8) + try match(DIDAbnfParser.Tokens.SCHEMA.rawValue) + setState(9) + try match(DIDAbnfParser.Tokens.COLON.rawValue) + setState(10) + try method_name() + setState(11) + try match(DIDAbnfParser.Tokens.COLON.rawValue) + setState(12) + try method_specific_id() + setState(13) + try match(DIDAbnfParser.Tokens.EOF.rawValue) + + } + catch ANTLRException.recognition(let re) { + _localctx.exception = re + _errHandler.reportError(self, re) + try _errHandler.recover(self, re) + } + + return _localctx + } + + public class Method_nameContext: ParserRuleContext { + open + func ALPHA() -> [TerminalNode] { + return getTokens(DIDAbnfParser.Tokens.ALPHA.rawValue) + } + open + func ALPHA(_ i:Int) -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.ALPHA.rawValue, i) + } + open + func DIGIT() -> [TerminalNode] { + return getTokens(DIDAbnfParser.Tokens.DIGIT.rawValue) + } + open + func DIGIT(_ i:Int) -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.DIGIT.rawValue, i) + } + override open + func getRuleIndex() -> Int { + return DIDAbnfParser.RULE_method_name + } + override open + func enterRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.enterMethod_name(self) + } + } + override open + func exitRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.exitMethod_name(self) + } + } + } + @discardableResult + open func method_name() throws -> Method_nameContext { + var _localctx: Method_nameContext + _localctx = Method_nameContext(_ctx, getState()) + try enterRule(_localctx, 2, DIDAbnfParser.RULE_method_name) + var _la: Int = 0 + defer { + try! exitRule() + } + do { + try enterOuterAlt(_localctx, 1) + setState(16) + try _errHandler.sync(self) + _la = try _input.LA(1) + repeat { + setState(15) + _la = try _input.LA(1) + if (!(_la == DIDAbnfParser.Tokens.ALPHA.rawValue || _la == DIDAbnfParser.Tokens.DIGIT.rawValue)) { + try _errHandler.recoverInline(self) + } + else { + _errHandler.reportMatch(self) + try consume() + } + + + setState(18); + try _errHandler.sync(self) + _la = try _input.LA(1) + } while (_la == DIDAbnfParser.Tokens.ALPHA.rawValue || _la == DIDAbnfParser.Tokens.DIGIT.rawValue) + + } + catch ANTLRException.recognition(let re) { + _localctx.exception = re + _errHandler.reportError(self, re) + try _errHandler.recover(self, re) + } + + return _localctx + } + + public class Method_specific_idContext: ParserRuleContext { + open + func COLON() -> [TerminalNode] { + return getTokens(DIDAbnfParser.Tokens.COLON.rawValue) + } + open + func COLON(_ i:Int) -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.COLON.rawValue, i) + } + open + func idchar() -> [IdcharContext] { + return getRuleContexts(IdcharContext.self) + } + open + func idchar(_ i: Int) -> IdcharContext? { + return getRuleContext(IdcharContext.self, i) + } + override open + func getRuleIndex() -> Int { + return DIDAbnfParser.RULE_method_specific_id + } + override open + func enterRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.enterMethod_specific_id(self) + } + } + override open + func exitRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.exitMethod_specific_id(self) + } + } + } + @discardableResult + open func method_specific_id() throws -> Method_specific_idContext { + var _localctx: Method_specific_idContext + _localctx = Method_specific_idContext(_ctx, getState()) + try enterRule(_localctx, 4, DIDAbnfParser.RULE_method_specific_id) + var _la: Int = 0 + defer { + try! exitRule() + } + do { + var _alt:Int + try enterOuterAlt(_localctx, 1) + setState(29) + try _errHandler.sync(self) + _alt = try getInterpreter().adaptivePredict(_input,2,_ctx) + while (_alt != 2 && _alt != ATN.INVALID_ALT_NUMBER) { + if ( _alt==1 ) { + setState(21) + try _errHandler.sync(self) + _la = try _input.LA(1) + repeat { + setState(20) + try idchar() + + + setState(23); + try _errHandler.sync(self) + _la = try _input.LA(1) + } while ((Int64(_la) & ~0x3f) == 0 && ((Int64(1) << _la) & 732) != 0) + setState(25) + try match(DIDAbnfParser.Tokens.COLON.rawValue) + + + } + setState(31) + try _errHandler.sync(self) + _alt = try getInterpreter().adaptivePredict(_input,2,_ctx) + } + setState(33) + try _errHandler.sync(self) + _la = try _input.LA(1) + repeat { + setState(32) + try idchar() + + + setState(35); + try _errHandler.sync(self) + _la = try _input.LA(1) + } while ((Int64(_la) & ~0x3f) == 0 && ((Int64(1) << _la) & 732) != 0) + + } + catch ANTLRException.recognition(let re) { + _localctx.exception = re + _errHandler.reportError(self, re) + try _errHandler.recover(self, re) + } + + return _localctx + } + + public class IdcharContext: ParserRuleContext { + open + func ALPHA() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.ALPHA.rawValue, 0) + } + open + func DIGIT() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.DIGIT.rawValue, 0) + } + open + func PERIOD() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.PERIOD.rawValue, 0) + } + open + func DASH() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.DASH.rawValue, 0) + } + open + func UNDERSCORE() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.UNDERSCORE.rawValue, 0) + } + open + func PCT_ENCODED() -> TerminalNode? { + return getToken(DIDAbnfParser.Tokens.PCT_ENCODED.rawValue, 0) + } + override open + func getRuleIndex() -> Int { + return DIDAbnfParser.RULE_idchar + } + override open + func enterRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.enterIdchar(self) + } + } + override open + func exitRule(_ listener: ParseTreeListener) { + if let listener = listener as? DIDAbnfListener { + listener.exitIdchar(self) + } + } + } + @discardableResult + open func idchar() throws -> IdcharContext { + var _localctx: IdcharContext + _localctx = IdcharContext(_ctx, getState()) + try enterRule(_localctx, 6, DIDAbnfParser.RULE_idchar) + var _la: Int = 0 + defer { + try! exitRule() + } + do { + try enterOuterAlt(_localctx, 1) + setState(37) + _la = try _input.LA(1) + if (!((Int64(_la) & ~0x3f) == 0 && ((Int64(1) << _la) & 732) != 0)) { + try _errHandler.recoverInline(self) + } + else { + _errHandler.reportMatch(self) + try consume() + } + + } + catch ANTLRException.recognition(let re) { + _localctx.exception = re + _errHandler.reportError(self, re) + try _errHandler.recover(self, re) + } + + return _localctx + } + + static let _serializedATN:[Int] = [ + 4,1,9,40,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 1,4,1,17,8,1,11,1,12,1,18,1,2,4,2,22,8,2,11,2,12,2,23,1,2,1,2,5,2,28,8, + 2,10,2,12,2,31,9,2,1,2,4,2,34,8,2,11,2,12,2,35,1,3,1,3,1,3,0,0,4,0,2,4, + 6,0,2,1,0,2,3,3,0,2,4,6,7,9,9,39,0,8,1,0,0,0,2,16,1,0,0,0,4,29,1,0,0,0, + 6,37,1,0,0,0,8,9,5,1,0,0,9,10,5,8,0,0,10,11,3,2,1,0,11,12,5,8,0,0,12,13, + 3,4,2,0,13,14,5,0,0,1,14,1,1,0,0,0,15,17,7,0,0,0,16,15,1,0,0,0,17,18,1, + 0,0,0,18,16,1,0,0,0,18,19,1,0,0,0,19,3,1,0,0,0,20,22,3,6,3,0,21,20,1,0, + 0,0,22,23,1,0,0,0,23,21,1,0,0,0,23,24,1,0,0,0,24,25,1,0,0,0,25,26,5,8, + 0,0,26,28,1,0,0,0,27,21,1,0,0,0,28,31,1,0,0,0,29,27,1,0,0,0,29,30,1,0, + 0,0,30,33,1,0,0,0,31,29,1,0,0,0,32,34,3,6,3,0,33,32,1,0,0,0,34,35,1,0, + 0,0,35,33,1,0,0,0,35,36,1,0,0,0,36,5,1,0,0,0,37,38,7,1,0,0,38,7,1,0,0, + 0,4,18,23,29,35 + ] + + public + static let _ATN = try! ATNDeserializer().deserialize(_serializedATN) +} \ No newline at end of file diff --git a/Package.swift b/Package.swift index 918bc955..0dcf7c9b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.5 +// swift-tools-version: 5.6 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -45,8 +45,7 @@ let package = Package( url: "https://github.com/apple/swift-log.git", from: "1.4.4" ), - .package(path: "OpenAPI/Castor"), - .package(path: "OpenAPI/Pollux") + .package(path: "OpenAPI/PrismAgentAPI") ], targets: [ .target( @@ -70,7 +69,7 @@ let package = Package( ), .target( name: "Castor", - dependencies: ["Domain", "Core", .product(name: "CastorAPI", package: "Castor")], + dependencies: ["Domain", "Core", .product(name: "PrismAgentAPI", package: "PrismAgentAPI")], path: "Castor/Sources" ), .testTarget( @@ -80,7 +79,7 @@ let package = Package( ), .target( name: "Pollux", - dependencies: ["Domain", "Core", .product(name: "PolluxAPI", package: "Pollux")], + dependencies: ["Domain", "Core", .product(name: "PrismAgentAPI", package: "PrismAgentAPI")], path: "Pollux/Sources" ), .testTarget( diff --git a/bootstrap.sh b/bootstrap.sh index b6ce7d94..4e27948a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -14,7 +14,5 @@ else cd atala-prism-swift-sdk || exit fi - openapi-generator generate -g swift5 -o OpenAPI/Castor -i ../atala-prism-building-blocks/castor/api/http/castor-openapi-spec.yaml --additional-properties=projectName=CastorAPI - - openapi-generator generate -g swift5 -o OpenAPI/Pollux -i ../atala-prism-building-blocks/pollux/api/pollux-openapi-spec.yaml --additional-properties=projectName=PolluxAPI + openapi-generator generate -g swift5 -o OpenAPI/PrismAgentAPI -i ../atala-prism-building-blocks/prism-agent/api/http/prism-agent-openapi-spec.yaml --additional-properties=projectName=PrismAgentAPI fi