diff --git a/languages/ruby/vendor/tree-sitter-ruby b/languages/ruby/vendor/tree-sitter-ruby index dd1c7953f..04fd77ba8 160000 --- a/languages/ruby/vendor/tree-sitter-ruby +++ b/languages/ruby/vendor/tree-sitter-ruby @@ -1 +1 @@ -Subproject commit dd1c7953f2b83a86d10a6d34ae20ff11267bc5a2 +Subproject commit 04fd77ba80a49c4db32e5063dcabb2de5dbce866 diff --git a/script/generate-example b/script/generate-example index b56a64884..bc9fb55ba 100755 --- a/script/generate-example +++ b/script/generate-example @@ -52,7 +52,7 @@ generate_example () { stack exec semantic diff -- --sexpression $fileA /dev/null > $diffFileRemoveA status $diffFileAddB - stack exec semantic diff -- --sexpression --no-index /dev/null $fileB > $diffFileAddB + stack exec semantic diff -- --sexpression /dev/null $fileB > $diffFileAddB status $diffFileRemoveB stack exec semantic diff -- --sexpression $fileB /dev/null > $diffFileRemoveB diff --git a/src/Command/Files.hs b/src/Command/Files.hs index 0f24daa98..7692b2e85 100644 --- a/src/Command/Files.hs +++ b/src/Command/Files.hs @@ -6,7 +6,6 @@ module Command.Files import Prologue hiding (readFile) import Source import qualified Data.ByteString as B -import System.IO hiding (readFile) import Control.Exception (catch, IOException) import qualified Data.Text.ICU.Convert as Convert import qualified Data.Text.ICU.Detect as Detect @@ -14,28 +13,9 @@ import qualified Data.Text.ICU.Detect as Detect -- | Read a file to a SourceBlob, transcoding to UTF-8 along the way. readFile :: FilePath -> IO SourceBlob readFile path = do - source <- (Just <$> readFile' path) `catch` (const (pure Nothing) :: IOException -> IO (Maybe Source)) + raw <- (Just <$> B.readFile path) `catch` (const (pure Nothing) :: IOException -> IO (Maybe ByteString)) + source <- traverse transcode raw pure $ fromMaybe (emptySourceBlob path) (flip sourceBlob path <$> source) - where - -- | Read a file and safely handle special paths like /dev/null - readFile' :: FilePath -> IO Source - readFile' path = do - size <- fileSize path - text <- case size of - 0 -> pure B.empty - _ -> B.readFile path - transcode text - - -- Based on https://github.com/haskell/bytestring/pull/79/files - -- Neccessary to be able to handle /dev/null as a file. - fileSize :: FilePath -> IO Integer - fileSize f = withBinaryFile f ReadMode $ \h -> do - -- hFileSize fails if file is not regular file (like /dev/null). Catch - -- exception and return 0 in that case. - filesz <- catch (hFileSize h) useZeroIfNotRegularFile - pure $ fromIntegral filesz `max` 0 - where useZeroIfNotRegularFile :: IOException -> IO Integer - useZeroIfNotRegularFile _ = pure 0 -- | Transcode a ByteString to a unicode Source. transcode :: B.ByteString -> IO Source diff --git a/src/Renderer/SExpression.hs b/src/Renderer/SExpression.hs index 51c21928a..2f0195103 100644 --- a/src/Renderer/SExpression.hs +++ b/src/Renderer/SExpression.hs @@ -22,11 +22,11 @@ data SExpressionFormat = TreeOnly | TreeAndRanges -- | Returns a ByteString SExpression formatted diff. sExpression :: (HasField fields Category, HasField fields SourceSpan, Foldable f) => SExpressionFormat -> Both SourceBlob -> Diff f (Record fields) -> ByteString -sExpression format _ diff = printDiff diff 0 format +sExpression format _ diff = printDiff diff 0 format <> "\n" -- | Returns a ByteString SExpression formatted term. sExpressionParseTree :: (HasField fields Category, HasField fields SourceSpan, Foldable f) => SExpressionFormat -> SourceBlob -> Term f (Record fields) -> ByteString -sExpressionParseTree format _ term = printTerm term 0 format +sExpressionParseTree format _ term = printTerm term 0 format <> "\n" printDiff :: (HasField fields Category, HasField fields SourceSpan, Foldable f) => Diff f (Record fields) -> Int -> SExpressionFormat -> ByteString printDiff diff level format = case runFree diff of diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index 8f4308786..9b32bf8c8 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -40,7 +40,7 @@ treeSitterParser language grammar blob = do ts_document_set_language document grammar withCStringLen (toText (source blob)) $ \ (source, len) -> do ts_document_set_input_string_with_length document source len - ts_document_parse document + ts_document_parse_halt_on_error document term <- documentToTerm language document blob ts_document_free document pure term @@ -55,7 +55,7 @@ parseRubyToAST source = do ts_document_set_language document Ruby.tree_sitter_ruby root <- withCStringLen (toText source) $ \ (source, len) -> do ts_document_set_input_string_with_length document source len - ts_document_parse document + ts_document_parse_halt_on_error document alloca (\ rootPtr -> do ts_document_root_node_p document rootPtr peek rootPtr) diff --git a/test/SemanticCmdLineSpec.hs b/test/SemanticCmdLineSpec.hs index 33dcc5b71..871faa24c 100644 --- a/test/SemanticCmdLineSpec.hs +++ b/test/SemanticCmdLineSpec.hs @@ -33,14 +33,14 @@ data ParseFixture = ParseFixture instance Listable ParseFixture where tiers = cons0 (ParseFixture (sExpressionParseTree pathMode "" []) sExpressionParseTreeOutput) \/ cons0 (ParseFixture (jsonParseTree pathMode "" []) jsonParseTreeOutput) - \/ cons0 (ParseFixture (sExpressionParseTree commitMode repo []) "(Program\n (Method\n (Identifier)))") + \/ cons0 (ParseFixture (sExpressionParseTree commitMode repo []) "(Program\n (Method\n (Identifier)))\n") \/ cons0 (ParseFixture (jsonParseTree commitMode repo []) "[{\"filePath\":\"methods.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"identifier\":{\"category\":\"Identifier\",\"identifier\":\"foo\",\"range\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}},\"clauses\":[],\"receiver\":null,\"range\":[0,11],\"callSignature\":[],\"definitions\":[],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}],\"range\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}}},[]]\n") where pathMode = ParsePaths ["test/fixtures/ruby/and-or.A.rb"] commitMode = ParseCommit "2e4144eb8c44f007463ec34cb66353f0041161fe" ["methods.rb"] - sExpressionParseTreeOutput = "(Program\n (Binary\n (Identifier)\n (Other \"and\")\n (Identifier)))" + sExpressionParseTreeOutput = "(Program\n (Binary\n (Identifier)\n (Other \"and\")\n (Identifier)))\n" jsonParseTreeOutput = "[{\"filePath\":\"test/fixtures/ruby/and-or.A.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"operatorSyntaxes\":[{\"category\":\"Identifier\",\"identifier\":\"foo\",\"range\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"and\",\"identifier\":\"and\",\"range\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}},{\"category\":\"Identifier\",\"identifier\":\"bar\",\"range\":[8,11],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,12]}}],\"category\":\"Binary\",\"range\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,12]}}],\"range\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,1]}}},[]]\n" @@ -75,8 +75,8 @@ instance Listable DiffFixture where summaryOutput' = "{\"changes\":{\"methods.rb\":[{\"span\":{\"insert\":{\"start\":[1,1],\"end\":[2,4]}},\"summary\":\"Added the 'foo()' method\"}]},\"errors\":{}}\n" jsonOutput = "{\"oids\":[\"0000000000000000000000000000000000000000\",\"0000000000000000000000000000000000000000\"],\"paths\":[\"test/fixtures/ruby/method-declaration.A.rb\",\"test/fixtures/ruby/method-declaration.B.rb\"],\"rows\":[[{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[{\"replace\":{\"category\":\"Identifier\",\"range\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}}}],\"range\":[0,8],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}],\"range\":[0,8],\"number\":1,\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[{\"replace\":{\"category\":\"Identifier\",\"range\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}}},{\"insert\":{\"category\":\"Params\",\"children\":[{\"category\":\"Identifier\",\"range\":[8,9],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,10]}}],\"range\":[7,11],\"sourceSpan\":{\"start\":[1,8],\"end\":[2,3]}}}],\"range\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,4]}}],\"range\":[0,11],\"number\":1,\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}}],[{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[{\"insert\":{\"category\":\"Params\",\"children\":[],\"range\":[11,13],\"sourceSpan\":{\"start\":[1,8],\"end\":[2,3]}}},{\"insert\":{\"category\":\"Identifier\",\"range\":[13,16],\"sourceSpan\":{\"start\":[2,3],\"end\":[2,6]}}}],\"range\":[11,17],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,4]}}],\"range\":[11,17],\"number\":2,\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}}],[{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[],\"range\":[8,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}],\"range\":[8,12],\"number\":2,\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[],\"range\":[17,20],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,4]}}],\"range\":[17,21],\"number\":3,\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}}],[{\"category\":\"Program\",\"children\":[],\"range\":[12,12],\"number\":3,\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},{\"category\":\"Program\",\"children\":[],\"range\":[21,21],\"number\":4,\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}}]]}\n" jsonOutput' = "{\"oids\":[\"0000000000000000000000000000000000000000\",\"ff7bbbe9495f61d9e1e58c597502d152bab1761e\"],\"paths\":[\"methods.rb\",\"methods.rb\"],\"rows\":[[{\"insert\":{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[{\"category\":\"Identifier\",\"range\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}}],\"range\":[0,8],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}],\"range\":[0,8],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},\"number\":1}],[{\"insert\":{\"category\":\"Program\",\"children\":[{\"category\":\"Method\",\"children\":[],\"range\":[8,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}],\"range\":[8,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},\"number\":2}],[{\"insert\":{\"category\":\"Program\",\"children\":[],\"range\":[12,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},\"number\":3}]]}\n" - sExpressionOutput = "(Program\n (Method\n { (Identifier)\n ->(Identifier) }\n {+(Params\n (Identifier))+}\n {+(Identifier)+}))" - sExpressionOutput' = "{+(Program\n (Method\n (Identifier)))+}" + sExpressionOutput = "(Program\n (Method\n { (Identifier)\n ->(Identifier) }\n {+(Params\n (Identifier))+}\n {+(Identifier)+}))\n" + sExpressionOutput' = "{+(Program\n (Method\n (Identifier)))+}\n" tocOutput = "{\"changes\":{\"test/fixtures/ruby/method-declaration.A.rb -> test/fixtures/ruby/method-declaration.B.rb\":[{\"span\":{\"start\":[1,1],\"end\":[3,4]},\"category\":\"Method\",\"term\":\"bar\",\"changeType\":\"modified\"}]},\"errors\":{}}\n" tocOutput' = "{\"changes\":{\"methods.rb\":[{\"span\":{\"start\":[1,1],\"end\":[2,4]},\"category\":\"Method\",\"term\":\"foo\",\"changeType\":\"added\"}]},\"errors\":{}}\n" diff --git a/test/SemanticSpec.hs b/test/SemanticSpec.hs index 809c7ce7b..ab8b18938 100644 --- a/test/SemanticSpec.hs +++ b/test/SemanticSpec.hs @@ -23,7 +23,7 @@ spec = parallel $ do describe "parseBlobs" $ do it "renders to ByteString output" $ do output <- parseBlobs (SExpressionParseTreeRenderer TreeOnly) [methodsBlob] - output `shouldBe` "(Program\n (Method\n (Identifier)))" + output `shouldBe` "(Program\n (Method\n (Identifier)))\n" where methodsBlob = SourceBlob (Source "def foo\nend\n") "ff7bbbe9495f61d9e1e58c597502d152bab1761e" "methods.rb" (Just defaultPlainBlob) diff --git a/test/fixtures/go/function-declarations.diff+A.txt b/test/fixtures/go/function-declarations.diff+A.txt index 02bef17a1..6ca554797 100644 --- a/test/fixtures/go/function-declarations.diff+A.txt +++ b/test/fixtures/go/function-declarations.diff+A.txt @@ -1,38 +1,6 @@ {+(ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))))+} + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier))+} diff --git a/test/fixtures/go/function-declarations.diff+B.txt b/test/fixtures/go/function-declarations.diff+B.txt index 02bef17a1..6ca554797 100644 --- a/test/fixtures/go/function-declarations.diff+B.txt +++ b/test/fixtures/go/function-declarations.diff+B.txt @@ -1,38 +1,6 @@ {+(ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))))+} + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier))+} diff --git a/test/fixtures/go/function-declarations.diff-A.txt b/test/fixtures/go/function-declarations.diff-A.txt index ec448316d..6e098d56e 100644 --- a/test/fixtures/go/function-declarations.diff-A.txt +++ b/test/fixtures/go/function-declarations.diff-A.txt @@ -1,38 +1,6 @@ {-(ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))))-} + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier))-} diff --git a/test/fixtures/go/function-declarations.diff-B.txt b/test/fixtures/go/function-declarations.diff-B.txt index ec448316d..6e098d56e 100644 --- a/test/fixtures/go/function-declarations.diff-B.txt +++ b/test/fixtures/go/function-declarations.diff-B.txt @@ -1,38 +1,6 @@ {-(ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))))-} + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier))-} diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index c7d7b6759..908d34c72 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -1,42 +1,7 @@ (ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - { (Identifier) - ->(Identifier) }))) - (Function - { (Identifier) - ->(Identifier) } - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (Identifier) - (Identifier))) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier)))))) + (Module + (Identifier)) + (Identifier) + (Args) +{ (Identifier) +->(Identifier) }) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index c7d7b6759..908d34c72 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -1,42 +1,7 @@ (ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - { (Identifier) - ->(Identifier) }))) - (Function - { (Identifier) - ->(Identifier) } - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (Identifier) - (Identifier))) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier)))))) + (Module + (Identifier)) + (Identifier) + (Args) +{ (Identifier) +->(Identifier) }) diff --git a/test/fixtures/go/function-declarations.parseA.txt b/test/fixtures/go/function-declarations.parseA.txt index be301478e..fe92108e7 100644 --- a/test/fixtures/go/function-declarations.parseA.txt +++ b/test/fixtures/go/function-declarations.parseA.txt @@ -1,38 +1,6 @@ (ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier)))))) + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier)) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index be301478e..fe92108e7 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -1,38 +1,6 @@ (ParseError - (Program - (Module - (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (FunctionCall - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function - (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier)))))) + (Module + (Identifier)) + (Identifier) + (Args) + (Identifier)) diff --git a/test/fixtures/go/function-types.diff+B.txt b/test/fixtures/go/function-types.diff+B.txt index 4d145d50c..70cea7c63 100644 --- a/test/fixtures/go/function-types.diff+B.txt +++ b/test/fixtures/go/function-types.diff+B.txt @@ -1,24 +1,15 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function + (Identifier) + (Args) + (TypeDecl (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier)) - (Identifier))) - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier) - (Identifier)) - (Args - (ParameterDecl - (ChannelTy - (ParseError) - (Identifier)))))))))+} + (FunctionTy + (Args + (Identifier)) + (Identifier))) + (Identifier) + (Args + (Identifier) + (Identifier)))+} diff --git a/test/fixtures/go/function-types.diff-B.txt b/test/fixtures/go/function-types.diff-B.txt index 4205f07e5..0ebce3e5c 100644 --- a/test/fixtures/go/function-types.diff-B.txt +++ b/test/fixtures/go/function-types.diff-B.txt @@ -1,24 +1,15 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function + (Identifier) + (Args) + (TypeDecl (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier)) - (Identifier))) - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier) - (Identifier)) - (Args - (ParameterDecl - (ChannelTy - (ParseError) - (Identifier)))))))))-} + (FunctionTy + (Args + (Identifier)) + (Identifier))) + (Identifier) + (Args + (Identifier) + (Identifier)))-} diff --git a/test/fixtures/go/function-types.diffA-B.txt b/test/fixtures/go/function-types.diffA-B.txt index b5ece1095..7c9fee08b 100644 --- a/test/fixtures/go/function-types.diffA-B.txt +++ b/test/fixtures/go/function-types.diffA-B.txt @@ -1,4 +1,4 @@ -(Program +{ (Program (Module (Identifier)) (Function @@ -6,26 +6,31 @@ (Args) (Other "type_declaration" (TypeDecl - { (Identifier) - ->(Identifier) } + (Identifier) (FunctionTy (Args - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) })) + (Identifier)) + (Identifier))) (TypeDecl - { (Identifier) - ->(Identifier) } + (Identifier) (FunctionTy (Args - {-(Identifier)-} (Identifier) - {+(Identifier)+}) + (Identifier)) (Args - {+(ParameterDecl - (ChannelTy - (ParseError) - (Identifier)))+} - {-(Identifier)-} - {-(Identifier)-})))))) + (Identifier) + (Identifier)))))))->(ParseError + (Module + (Identifier)) + (Identifier) + (Args) + (TypeDecl + (Identifier) + (FunctionTy + (Args + (Identifier)) + (Identifier))) + (Identifier) + (Args + (Identifier) + (Identifier))) } diff --git a/test/fixtures/go/function-types.diffB-A.txt b/test/fixtures/go/function-types.diffB-A.txt index ba2f7f712..ba877c9ed 100644 --- a/test/fixtures/go/function-types.diffB-A.txt +++ b/test/fixtures/go/function-types.diffB-A.txt @@ -1,4 +1,18 @@ -(Program +{ (ParseError + (Module + (Identifier)) + (Identifier) + (Args) + (TypeDecl + (Identifier) + (FunctionTy + (Args + (Identifier)) + (Identifier))) + (Identifier) + (Args + (Identifier) + (Identifier)))->(Program (Module (Identifier)) (Function @@ -6,26 +20,17 @@ (Args) (Other "type_declaration" (TypeDecl - { (Identifier) - ->(Identifier) } + (Identifier) (FunctionTy (Args - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) })) + (Identifier)) + (Identifier))) (TypeDecl - { (Identifier) - ->(Identifier) } + (Identifier) (FunctionTy (Args - {-(Identifier)-} (Identifier) - {+(Identifier)+}) + (Identifier)) (Args - {+(Identifier)+} - {+(Identifier)+} - {-(ParameterDecl - (ChannelTy - (ParseError) - (Identifier)))-})))))) + (Identifier) + (Identifier))))))) } diff --git a/test/fixtures/go/function-types.parseB.txt b/test/fixtures/go/function-types.parseB.txt index bb5ce0215..c7791d43b 100644 --- a/test/fixtures/go/function-types.parseB.txt +++ b/test/fixtures/go/function-types.parseB.txt @@ -1,24 +1,15 @@ -(Program +(ParseError (Module (Identifier)) - (Function + (Identifier) + (Args) + (TypeDecl (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier)) - (Identifier))) - (TypeDecl - (Identifier) - (FunctionTy - (Args - (Identifier) - (Identifier)) - (Args - (ParameterDecl - (ChannelTy - (ParseError) - (Identifier))))))))) + (FunctionTy + (Args + (Identifier)) + (Identifier))) + (Identifier) + (Args + (Identifier) + (Identifier))) diff --git a/test/fixtures/go/grouped-import-declarations.diff+A.txt b/test/fixtures/go/grouped-import-declarations.diff+A.txt index 06065ead1..8f4a62964 100644 --- a/test/fixtures/go/grouped-import-declarations.diff+A.txt +++ b/test/fixtures/go/grouped-import-declarations.diff+A.txt @@ -1,14 +1,8 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral))))))+} + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral))+} diff --git a/test/fixtures/go/grouped-import-declarations.diff+B.txt b/test/fixtures/go/grouped-import-declarations.diff+B.txt index 06065ead1..8f4a62964 100644 --- a/test/fixtures/go/grouped-import-declarations.diff+B.txt +++ b/test/fixtures/go/grouped-import-declarations.diff+B.txt @@ -1,14 +1,8 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral))))))+} + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral))+} diff --git a/test/fixtures/go/grouped-import-declarations.diff-A.txt b/test/fixtures/go/grouped-import-declarations.diff-A.txt index 5840f2c33..b0951350a 100644 --- a/test/fixtures/go/grouped-import-declarations.diff-A.txt +++ b/test/fixtures/go/grouped-import-declarations.diff-A.txt @@ -1,14 +1,8 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral))))))-} + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral))-} diff --git a/test/fixtures/go/grouped-import-declarations.diff-B.txt b/test/fixtures/go/grouped-import-declarations.diff-B.txt index 5840f2c33..b0951350a 100644 --- a/test/fixtures/go/grouped-import-declarations.diff-B.txt +++ b/test/fixtures/go/grouped-import-declarations.diff-B.txt @@ -1,14 +1,8 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral))))))-} + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral))-} diff --git a/test/fixtures/go/grouped-import-declarations.diffA-B.txt b/test/fixtures/go/grouped-import-declarations.diffA-B.txt index 12c3f0538..12d0b70ae 100644 --- a/test/fixtures/go/grouped-import-declarations.diffA-B.txt +++ b/test/fixtures/go/grouped-import-declarations.diffA-B.txt @@ -1,17 +1,10 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - { (StringLiteral) - ->(StringLiteral) } - (ParseError - { (StringLiteral) - ->(StringLiteral) } - (Import - (Identifier) - { (StringLiteral) - ->(StringLiteral) }))))) + (Identifier) + (Args) + (Identifier) +{ (StringLiteral) +->(StringLiteral) } +{ (StringLiteral) +->(StringLiteral) }) diff --git a/test/fixtures/go/grouped-import-declarations.diffB-A.txt b/test/fixtures/go/grouped-import-declarations.diffB-A.txt index 12c3f0538..12d0b70ae 100644 --- a/test/fixtures/go/grouped-import-declarations.diffB-A.txt +++ b/test/fixtures/go/grouped-import-declarations.diffB-A.txt @@ -1,17 +1,10 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - { (StringLiteral) - ->(StringLiteral) } - (ParseError - { (StringLiteral) - ->(StringLiteral) } - (Import - (Identifier) - { (StringLiteral) - ->(StringLiteral) }))))) + (Identifier) + (Args) + (Identifier) +{ (StringLiteral) +->(StringLiteral) } +{ (StringLiteral) +->(StringLiteral) }) diff --git a/test/fixtures/go/grouped-import-declarations.parseA.txt b/test/fixtures/go/grouped-import-declarations.parseA.txt index f0e554def..88de52847 100644 --- a/test/fixtures/go/grouped-import-declarations.parseA.txt +++ b/test/fixtures/go/grouped-import-declarations.parseA.txt @@ -1,14 +1,8 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral)))))) + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral)) diff --git a/test/fixtures/go/grouped-import-declarations.parseB.txt b/test/fixtures/go/grouped-import-declarations.parseB.txt index f0e554def..88de52847 100644 --- a/test/fixtures/go/grouped-import-declarations.parseB.txt +++ b/test/fixtures/go/grouped-import-declarations.parseB.txt @@ -1,14 +1,8 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (Identifier) - (StringLiteral) - (ParseError - (StringLiteral) - (Import - (Identifier) - (StringLiteral)))))) + (Identifier) + (Args) + (Identifier) + (StringLiteral) + (StringLiteral)) diff --git a/test/fixtures/go/int-literals.diff+A.txt b/test/fixtures/go/int-literals.diff+A.txt index 48e6b0b3a..878b8559a 100644 --- a/test/fixtures/go/int-literals.diff+A.txt +++ b/test/fixtures/go/int-literals.diff+A.txt @@ -1,20 +1,11 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral)))))))+} + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier))))+} diff --git a/test/fixtures/go/int-literals.diff+B.txt b/test/fixtures/go/int-literals.diff+B.txt index 48e6b0b3a..878b8559a 100644 --- a/test/fixtures/go/int-literals.diff+B.txt +++ b/test/fixtures/go/int-literals.diff+B.txt @@ -1,20 +1,11 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral)))))))+} + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier))))+} diff --git a/test/fixtures/go/int-literals.diff-A.txt b/test/fixtures/go/int-literals.diff-A.txt index 6527699d4..c4196e235 100644 --- a/test/fixtures/go/int-literals.diff-A.txt +++ b/test/fixtures/go/int-literals.diff-A.txt @@ -1,20 +1,11 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral)))))))-} + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier))))-} diff --git a/test/fixtures/go/int-literals.diff-B.txt b/test/fixtures/go/int-literals.diff-B.txt index 6527699d4..c4196e235 100644 --- a/test/fixtures/go/int-literals.diff-B.txt +++ b/test/fixtures/go/int-literals.diff-B.txt @@ -1,20 +1,11 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral)))))))-} + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier))))-} diff --git a/test/fixtures/go/int-literals.diffA-B.txt b/test/fixtures/go/int-literals.diffA-B.txt index a340227cf..1d105cd20 100644 --- a/test/fixtures/go/int-literals.diffA-B.txt +++ b/test/fixtures/go/int-literals.diffA-B.txt @@ -1,23 +1,12 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - (Identifier))) - (Assignment - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })))))) + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + { (NumberLiteral) + ->(NumberLiteral) } + (Identifier)))) diff --git a/test/fixtures/go/int-literals.diffB-A.txt b/test/fixtures/go/int-literals.diffB-A.txt index a340227cf..1d105cd20 100644 --- a/test/fixtures/go/int-literals.diffB-A.txt +++ b/test/fixtures/go/int-literals.diffB-A.txt @@ -1,23 +1,12 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - (Identifier))) - (Assignment - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })))))) + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + { (NumberLiteral) + ->(NumberLiteral) } + (Identifier)))) diff --git a/test/fixtures/go/int-literals.parseA.txt b/test/fixtures/go/int-literals.parseA.txt index 5adf7f5a5..a3f3584c1 100644 --- a/test/fixtures/go/int-literals.parseA.txt +++ b/test/fixtures/go/int-literals.parseA.txt @@ -1,20 +1,11 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral))))))) + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier)))) diff --git a/test/fixtures/go/int-literals.parseB.txt b/test/fixtures/go/int-literals.parseB.txt index 5adf7f5a5..a3f3584c1 100644 --- a/test/fixtures/go/int-literals.parseB.txt +++ b/test/fixtures/go/int-literals.parseB.txt @@ -1,20 +1,11 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (Other "const_declaration" - (ParseError - (VarAssignment - (Other "identifier_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (Identifier))) - (Assignment - (Other "expression_list" - (NumberLiteral) - (Identifier)) - (Other "expression_list" - (NumberLiteral))))))) + (Identifier) + (Args) + (VarAssignment + (Other "identifier_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral) + (Identifier)))) diff --git a/test/fixtures/go/single-import-declarations.diff+A.txt b/test/fixtures/go/single-import-declarations.diff+A.txt index 80275ca69..cdb031982 100644 --- a/test/fixtures/go/single-import-declarations.diff+A.txt +++ b/test/fixtures/go/single-import-declarations.diff+A.txt @@ -1,17 +1,7 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral)))))+} + (Identifier) + (Args) + (Identifier) + (StringLiteral))+} diff --git a/test/fixtures/go/single-import-declarations.diff+B.txt b/test/fixtures/go/single-import-declarations.diff+B.txt index 80275ca69..cdb031982 100644 --- a/test/fixtures/go/single-import-declarations.diff+B.txt +++ b/test/fixtures/go/single-import-declarations.diff+B.txt @@ -1,17 +1,7 @@ -{+(Program +{+(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral)))))+} + (Identifier) + (Args) + (Identifier) + (StringLiteral))+} diff --git a/test/fixtures/go/single-import-declarations.diff-A.txt b/test/fixtures/go/single-import-declarations.diff-A.txt index e1e03580e..73386144a 100644 --- a/test/fixtures/go/single-import-declarations.diff-A.txt +++ b/test/fixtures/go/single-import-declarations.diff-A.txt @@ -1,17 +1,7 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral)))))-} + (Identifier) + (Args) + (Identifier) + (StringLiteral))-} diff --git a/test/fixtures/go/single-import-declarations.diff-B.txt b/test/fixtures/go/single-import-declarations.diff-B.txt index e1e03580e..73386144a 100644 --- a/test/fixtures/go/single-import-declarations.diff-B.txt +++ b/test/fixtures/go/single-import-declarations.diff-B.txt @@ -1,17 +1,7 @@ -{-(Program +{-(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral)))))-} + (Identifier) + (Args) + (Identifier) + (StringLiteral))-} diff --git a/test/fixtures/go/single-import-declarations.diffA-B.txt b/test/fixtures/go/single-import-declarations.diffA-B.txt index 804738c01..fac6dbfb2 100644 --- a/test/fixtures/go/single-import-declarations.diffA-B.txt +++ b/test/fixtures/go/single-import-declarations.diffA-B.txt @@ -1,20 +1,8 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - { (StringLiteral) - ->(StringLiteral) } - (ParseError - (Identifier)) - { (StringLiteral) - ->(StringLiteral) } - (Identifier) - (ParseError - (Import - (Identifier) - { (StringLiteral) - ->(StringLiteral) })))) + (Identifier) + (Args) + (Identifier) +{ (StringLiteral) +->(StringLiteral) }) diff --git a/test/fixtures/go/single-import-declarations.diffB-A.txt b/test/fixtures/go/single-import-declarations.diffB-A.txt index 804738c01..fac6dbfb2 100644 --- a/test/fixtures/go/single-import-declarations.diffB-A.txt +++ b/test/fixtures/go/single-import-declarations.diffB-A.txt @@ -1,20 +1,8 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - { (StringLiteral) - ->(StringLiteral) } - (ParseError - (Identifier)) - { (StringLiteral) - ->(StringLiteral) } - (Identifier) - (ParseError - (Import - (Identifier) - { (StringLiteral) - ->(StringLiteral) })))) + (Identifier) + (Args) + (Identifier) +{ (StringLiteral) +->(StringLiteral) }) diff --git a/test/fixtures/go/single-import-declarations.parseA.txt b/test/fixtures/go/single-import-declarations.parseA.txt index 311ba0d17..cb3d823d8 100644 --- a/test/fixtures/go/single-import-declarations.parseA.txt +++ b/test/fixtures/go/single-import-declarations.parseA.txt @@ -1,17 +1,7 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral))))) + (Identifier) + (Args) + (Identifier) + (StringLiteral)) diff --git a/test/fixtures/go/single-import-declarations.parseB.txt b/test/fixtures/go/single-import-declarations.parseB.txt index 311ba0d17..cb3d823d8 100644 --- a/test/fixtures/go/single-import-declarations.parseB.txt +++ b/test/fixtures/go/single-import-declarations.parseB.txt @@ -1,17 +1,7 @@ -(Program +(ParseError (Module (Identifier)) - (Function - (Identifier) - (Args) - (ParseError - (Identifier)) - (StringLiteral) - (ParseError - (Identifier)) - (StringLiteral) - (Identifier) - (ParseError - (Import - (Identifier) - (StringLiteral))))) + (Identifier) + (Args) + (Identifier) + (StringLiteral)) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index 1b1685f30..11361887f 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit 1b1685f3046f82f8d509e691ecfb4f4d09238cb3 +Subproject commit 11361887f9d17170293413bf2717b724dc48fac8