From 5db5ae459b937ca7b777ed70df598b6cf39c0bd9 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 6 Dec 2023 11:41:52 +0200 Subject: [PATCH] Fix formatting --- src/Visp.Compiler/Syntax/LexHelpers.fs | 31 +++++++++++----------- src/Visp.Compiler/Syntax/Syntax.fs | 4 +-- tests/Visp.Compiler.UnitTests/TestUtils.fs | 2 ++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/Visp.Compiler/Syntax/LexHelpers.fs b/src/Visp.Compiler/Syntax/LexHelpers.fs index 18fc219..deea7ea 100644 --- a/src/Visp.Compiler/Syntax/LexHelpers.fs +++ b/src/Visp.Compiler/Syntax/LexHelpers.fs @@ -260,20 +260,21 @@ let syntaxErrorToParseError (syn: SyntaxError) = match syn.Data0 with | :? FSharp.Text.Parsing.ParseErrorContext as ctx -> let (startPos, _) = ctx.ParseState.ResultRange - let r = new ParseError ( - { - ReduceTokens = ctx.ReduceTokens - ReducibleProductions = ctx.ReducibleProductions - ShiftTokens = ctx.ShiftTokens - StateStack = ctx.StateStack - CurrentToken = ctx.CurrentToken - Message = ctx.Message - FileName = startPos.FileName - Line = startPos.Line - Column = startPos.Column - }, - syn, - syn.range - ) + + let r = + new ParseError( + { ReduceTokens = ctx.ReduceTokens + ReducibleProductions = ctx.ReducibleProductions + ShiftTokens = ctx.ShiftTokens + StateStack = ctx.StateStack + CurrentToken = ctx.CurrentToken + Message = ctx.Message + FileName = startPos.FileName + Line = startPos.Line + Column = startPos.Column }, + syn, + syn.range + ) + r | _ -> failwith "not a valid syntax error" diff --git a/src/Visp.Compiler/Syntax/Syntax.fs b/src/Visp.Compiler/Syntax/Syntax.fs index e03c10f..154222f 100644 --- a/src/Visp.Compiler/Syntax/Syntax.fs +++ b/src/Visp.Compiler/Syntax/Syntax.fs @@ -413,8 +413,8 @@ and [] SynArg = member d.NameText = match d with - | TypedArg (name = name) - | InferredArg (name = name) -> name.Text + | TypedArg(name = name) + | InferredArg(name = name) -> name.Text and VispProgram = VispProgram of directives: SynDirective list * exprs: SynExpr list diff --git a/tests/Visp.Compiler.UnitTests/TestUtils.fs b/tests/Visp.Compiler.UnitTests/TestUtils.fs index f6487e6..c29b81b 100644 --- a/tests/Visp.Compiler.UnitTests/TestUtils.fs +++ b/tests/Visp.Compiler.UnitTests/TestUtils.fs @@ -19,10 +19,12 @@ let parseCoreLibs () = for lib in libs do let path = lib.Path + CoreParser.parseFile path lib.ReturnLast // TODO: We only really want macros here? |> CoreParser.transformFile |> ignore + () with :? ParseHelpers.SyntaxError as syn ->