diff --git a/Sources/Common/Scope.swift b/Sources/Common/Scope.swift index ce2e999..7a7d290 100644 --- a/Sources/Common/Scope.swift +++ b/Sources/Common/Scope.swift @@ -72,7 +72,7 @@ public struct Scopes: CustomStringConvertible { var counter = 0 for s in scopes { result += "Scope #\(counter):\n\(s)\n" - counter += 1; + counter += 1 } return result diff --git a/Sources/Macros/Macros.swift b/Sources/Macros/Macros.swift index 18ade3b..c919f8c 100644 --- a/Sources/Macros/Macros.swift +++ b/Sources/Macros/Macros.swift @@ -124,6 +124,6 @@ public struct RequireErrorResult: ExpressionMacro { @main struct P4Macros: CompilerPlugin { var providingMacros: [Macro.Type] = [ - RequireResult.self, RequireErrorResult.self, UseOkResult.self, UseErrorResult.self + RequireResult.self, RequireErrorResult.self, UseOkResult.self, UseErrorResult.self, ] } diff --git a/Sources/P4Compiler/Parser.swift b/Sources/P4Compiler/Parser.swift index 7bf0a2c..f376559 100644 --- a/Sources/P4Compiler/Parser.swift +++ b/Sources/P4Compiler/Parser.swift @@ -52,7 +52,8 @@ extension ParserAssignmentStatement: CompilableStatement { ErrorOnNode(node: node, withError: "Missing rvalue in assignment statement")) } - let maybe_parsed_rvalue = Expression.Compile(node: rvalue_node, inTree: tree, withScopes: scopes) + let maybe_parsed_rvalue = Expression.Compile( + node: rvalue_node, inTree: tree, withScopes: scopes) guard case Result.Ok(let rvalue) = maybe_parsed_rvalue else { return Result.Error(maybe_parsed_rvalue.error()!) } @@ -289,7 +290,9 @@ public struct Parser { } } - return switch TransitionSelectExpression.Compile(node: node, inTree: tree, withScope: scopes) { + return + switch TransitionSelectExpression.Compile(node: node, inTree: tree, withScope: scopes) + { case .Ok((let tse, _)): .Ok((ParserTransitionStatement(withTransitionExpression: tse), scopes)) case .Error(let e): .Error(e) diff --git a/Sources/P4Compiler/Statement.swift b/Sources/P4Compiler/Statement.swift index 862a28c..ffc2914 100644 --- a/Sources/P4Compiler/Statement.swift +++ b/Sources/P4Compiler/Statement.swift @@ -57,7 +57,9 @@ extension BlockStatement: CompilableStatement { } currentChild = node.child(at: currentChildIdx) if currentChild!.nodeType == "statements" { - switch Parser.Statements.Compile(node: currentChild!, inTree: tree, withLexicalScopes: scopes.enter()) { + switch Parser.Statements.Compile( + node: currentChild!, inTree: tree, withLexicalScopes: scopes.enter()) + { case .Ok(let (parsed_statements, parsed_scopes)): new_scopes = parsed_scopes statements = parsed_statements @@ -112,7 +114,8 @@ extension ConditionalStatement: CompilableStatement { thens.nodeType == "statement" else { return Result.Error( - ErrorOnNode(node: node, withError: "Did not find then statement block for conditional statement")) + ErrorOnNode( + node: node, withError: "Did not find then statement block for conditional statement")) } guard @@ -175,7 +178,8 @@ extension VariableDeclarationStatement: CompilableStatement { typeref.nodeType == "typeRef" else { return Result.Error( - ErrorOnNode(node: node, withError: "Did not find type name for variable declaration statement")) + ErrorOnNode( + node: node, withError: "Did not find type name for variable declaration statement")) } let maybe_variablename = node.child(at: 1) @@ -183,7 +187,8 @@ extension VariableDeclarationStatement: CompilableStatement { variablename.nodeType == "identifier" else { return Result.Error( - ErrorOnNode(node: node, withError: "Did not find identifier name for variable declaration statement")) + ErrorOnNode( + node: node, withError: "Did not find identifier name for variable declaration statement")) } let maybe_rvalue = node.childCount > 3 ? node.child(at: 3) : .none @@ -191,7 +196,9 @@ extension VariableDeclarationStatement: CompilableStatement { rvalue.nodeType == "expression" else { return Result.Error( - ErrorOnNode(node: node, withError: "Did not find initial value expression for variable declaration statement")) + ErrorOnNode( + node: node, + withError: "Did not find initial value expression for variable declaration statement")) } guard diff --git a/Sources/P4Lang/Parser.swift b/Sources/P4Lang/Parser.swift index 61418d6..bab02df 100644 --- a/Sources/P4Lang/Parser.swift +++ b/Sources/P4Lang/Parser.swift @@ -229,7 +229,7 @@ public struct Parser: P4Type { public func findStartState() -> ParserState? { for state in states.states { - if state.state == Identifier(name:"start") { + if state.state == Identifier(name: "start") { return state } } diff --git a/Sources/TreeSitterExtensions/Extensions.swift b/Sources/TreeSitterExtensions/Extensions.swift index ad7dc80..d5b172e 100644 --- a/Sources/TreeSitterExtensions/Extensions.swift +++ b/Sources/TreeSitterExtensions/Extensions.swift @@ -64,4 +64,4 @@ extension Node { block(child) } } -} \ No newline at end of file +}