From be3273bf6f40b83e352005b33e314832f5e40139 Mon Sep 17 00:00:00 2001 From: Julien WITTOUCK Date: Fri, 17 Sep 2021 17:55:08 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20:=20remove=20redundant=20qualifiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/gaia_app/hcl/HclParserImpl.kt | 4 ++-- src/main/java/io/gaia_app/hcl/HclVisitor.kt | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/gaia_app/hcl/HclParserImpl.kt b/src/main/java/io/gaia_app/hcl/HclParserImpl.kt index be64fde2a..b327599e1 100644 --- a/src/main/java/io/gaia_app/hcl/HclParserImpl.kt +++ b/src/main/java/io/gaia_app/hcl/HclParserImpl.kt @@ -23,13 +23,13 @@ class HclParserImpl : HclParser { val charStream = CharStreams.fromString(content) // configuring antlr lexer - val lexer = io.gaia_app.hcl.antlr.hclLexer(charStream) + val lexer = hclLexer(charStream) // using the lexer to configure a token stream val tokenStream = CommonTokenStream(lexer) // configuring antlr parser using the token stream - val parser = io.gaia_app.hcl.antlr.hclParser(tokenStream) + val parser = hclParser(tokenStream) // visit the AST val hclVisitor = HclVisitor() diff --git a/src/main/java/io/gaia_app/hcl/HclVisitor.kt b/src/main/java/io/gaia_app/hcl/HclVisitor.kt index d901be902..e2e78a627 100644 --- a/src/main/java/io/gaia_app/hcl/HclVisitor.kt +++ b/src/main/java/io/gaia_app/hcl/HclVisitor.kt @@ -17,50 +17,50 @@ class HclVisitor : io.gaia_app.hcl.antlr.hclBaseVisitor() { private var currentOutput: Output = Output() - override fun visitVariableDirective(ctx: io.gaia_app.hcl.antlr.hclParser.VariableDirectiveContext) { + override fun visitVariableDirective(ctx: hclParser.VariableDirectiveContext) { currentVariable = Variable(name = ctx.STRING().text.removeSurrounding("\"")) variables.add(currentVariable) visitChildren(ctx) } - override fun visitVariableType(ctx: io.gaia_app.hcl.antlr.hclParser.VariableTypeContext) { + override fun visitVariableType(ctx: hclParser.VariableTypeContext) { currentVariable.type = ctx.type().text.removeSurrounding("\"") } - override fun visitVariableDefault(ctx: io.gaia_app.hcl.antlr.hclParser.VariableDefaultContext) { + override fun visitVariableDefault(ctx: hclParser.VariableDefaultContext) { currentVariable.defaultValue = ctx.expression().text.removeSurrounding("\"") } - override fun visitVariableDescription(ctx: io.gaia_app.hcl.antlr.hclParser.VariableDescriptionContext) { + override fun visitVariableDescription(ctx: hclParser.VariableDescriptionContext) { currentVariable.description = ctx.STRING().text.removeSurrounding("\"") } - override fun visitOutputDirective(ctx: io.gaia_app.hcl.antlr.hclParser.OutputDirectiveContext) { + override fun visitOutputDirective(ctx: hclParser.OutputDirectiveContext) { currentOutput = Output(name = ctx.STRING().text.removeSurrounding("\"")) outputs.add(currentOutput) visitChildren(ctx) } - override fun visitOutputDescription(ctx: io.gaia_app.hcl.antlr.hclParser.OutputDescriptionContext) { + override fun visitOutputDescription(ctx: hclParser.OutputDescriptionContext) { currentOutput.description = ctx.STRING().text.removeSurrounding("\"") } - override fun visitOutputValue(ctx: io.gaia_app.hcl.antlr.hclParser.OutputValueContext) { + override fun visitOutputValue(ctx: hclParser.OutputValueContext) { currentOutput.value = ctx.expression().text.removeSurrounding("\"") } - override fun visitOutputSensitive(ctx: io.gaia_app.hcl.antlr.hclParser.OutputSensitiveContext) { + override fun visitOutputSensitive(ctx: hclParser.OutputSensitiveContext) { currentOutput.sensitive = ctx.BOOLEAN().text.removeSurrounding("\"") } - override fun visitProviderDirective(ctx: io.gaia_app.hcl.antlr.hclParser.ProviderDirectiveContext) { + override fun visitProviderDirective(ctx: hclParser.ProviderDirectiveContext) { val parsedProvider = ctx.STRING().text.removeSurrounding("\"") if (! IGNORED_PROVIDERS.contains(parsedProvider)) { provider = parsedProvider } } - override fun visitResourceDirective(ctx: io.gaia_app.hcl.antlr.hclParser.ResourceDirectiveContext) { + override fun visitResourceDirective(ctx: hclParser.ResourceDirectiveContext) { // provider already found ! if (provider != "unknown") return