mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Assignment updates
This commit is contained in:
parent
74347f80e8
commit
17dd99aeac
@ -51,8 +51,8 @@ le = LanguageExample
|
||||
examples :: [LanguageExample]
|
||||
examples =
|
||||
-- [ le "go" "**/*.go" goFileSkips goDirSkips
|
||||
-- [ le "python" "**/*.py" mempty mempty
|
||||
[ le "ruby" "**/*.rb" rubySkips mempty
|
||||
[ le "python" "**/*.py" mempty mempty
|
||||
-- [ le "ruby" "**/*.rb" rubySkips mempty
|
||||
-- , le "typescript" "**/*.[jt]s" typescriptSkips mempty
|
||||
-- , le "typescript" "**/*.[jt]sx" tsxSkips mempty
|
||||
]
|
||||
@ -223,19 +223,22 @@ buildExamples session lang tsDir = do
|
||||
-- lSpan = " [" <> show (startRow left) <> ", " <> show (left^.P.span^.start^.column) <> "]"
|
||||
-- rSpan = " [" <> show (startRow right) <> ", " <> show (right^.P.span^.start^.column) <> "]"
|
||||
HUnit.assertEqual (Text.unpack (x^.path) <> lineNo) (left^.symbol) (right^.symbol)
|
||||
HUnit.assertEqual (Text.unpack (x^.path) <> lineNo) (left^.line) (right^.line)
|
||||
-- HUnit.assertEqual (Text.unpack (x^.path) <> lineNo) (Text.unpack (left^.symbol) <> span left) (Text.unpack (right^.symbol) <> span right)
|
||||
HUnit.assertEqual (Text.unpack (x^.path) <> lineNo) (Text.unpack (left^.symbol) <> span left) (Text.unpack (right^.symbol) <> span right)
|
||||
if left^.kind == "Class"
|
||||
then HUnit.assertEqual (Text.unpack (x^.path) <> lineNo) (left^.line) (right^.line)
|
||||
-- then HUnit.assertBool (Text.unpack (x^.path) <> lineNo) (Text.isPrefixOf (left^.line) (right^.line))
|
||||
else pure ()
|
||||
|
||||
_ -> HUnit.assertFailure "Expected 1 file in each response"
|
||||
(Left e1, Left e2) -> HUnit.assertFailure ("Unable to parse (both)" <> show (displayException e1) <> show (displayException e2))
|
||||
(_, Left e) -> HUnit.assertFailure ("Unable to parse (precise)" <> show (displayException e))
|
||||
(Left e, _) -> HUnit.assertFailure ("Unable to parse (a la carte)" <> show (displayException e))
|
||||
|
||||
sSym x = SortableSymbol (x^.symbol) (x^.P.span^.start^.line)
|
||||
-- span x = " [" <> show (x^.P.span^.start^.line) <> ", " <> show (x^.P.span^.start^.column) <>
|
||||
-- " - " <> show (x^.P.span^.end^.line) <> ", " <> show (x^.P.span^.end^.column) <> "]"
|
||||
sSym x = SortableSymbol (x^.symbol) (x^.P.span^.start^.line) (x^.P.span^.start^.column) (x^.P.span^.end^.line) (x^.P.span^.end^.column)
|
||||
span x = " [" <> show (x^.P.span^.start^.line) <> ", " <> show (x^.P.span^.start^.column) <>
|
||||
" - " <> show (x^.P.span^.end^.line) <> ", " <> show (x^.P.span^.end^.column) <> "]"
|
||||
|
||||
data SortableSymbol = SortableSymbol Text.Text Int32
|
||||
data SortableSymbol = SortableSymbol Text.Text Int32 Int32 Int32 Int32
|
||||
deriving (Eq, Show, Ord)
|
||||
|
||||
|
||||
|
@ -11,15 +11,16 @@
|
||||
(Decorator
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
{-(Integer)-}
|
||||
(Decorator
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Statements
|
||||
{+(Identifier)+}
|
||||
{-(Statements
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Integer)-})
|
||||
(Decorator
|
||||
(Identifier)
|
||||
{+(Statements
|
||||
@ -27,17 +28,21 @@
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Boolean)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+})+}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Boolean)-})-}
|
||||
{ (Decorator
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
{-(Decorator
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
{-(Decorator
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
@ -45,8 +50,10 @@
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Boolean)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Function
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
|
@ -12,14 +12,15 @@
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Integer)+}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
(Decorator
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Statements
|
||||
(Statements
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
{-(Identifier)-}
|
||||
{+(Integer)+}
|
||||
{-(Identifier)-})
|
||||
(Decorator
|
||||
(Identifier)
|
||||
{+(Assignment
|
||||
@ -30,18 +31,22 @@
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Boolean)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-})-}
|
||||
{ (Function
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-})
|
||||
->(Decorator
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
{+(Decorator
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
{+(Decorator
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
@ -49,8 +54,10 @@
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Boolean)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Function
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
|
@ -22,10 +22,12 @@
|
||||
(Boolean))
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Statements
|
||||
@ -33,8 +35,10 @@
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
|
@ -9,10 +9,12 @@
|
||||
(Statements)
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Decorator
|
||||
(Identifier)
|
||||
(Statements
|
||||
@ -20,8 +22,10 @@
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
|
@ -14,8 +14,9 @@
|
||||
(RequiredParameter
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
@ -43,7 +44,8 @@
|
||||
->(Integer) })
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
(Identifier))))
|
||||
|
@ -4,7 +4,8 @@
|
||||
->(Identifier) }
|
||||
{-(RequiredParameter
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Statements
|
||||
{-(Identifier)-})-}
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
@ -21,7 +22,8 @@
|
||||
(RequiredParameter
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{+(Identifier)+}
|
||||
{+(Statements
|
||||
{+(Identifier)+})+}
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
@ -41,7 +43,8 @@
|
||||
->(TextElement) })
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
->(Identifier) })
|
||||
(Statements
|
||||
(Identifier))))
|
||||
|
@ -13,7 +13,8 @@
|
||||
(Identifier)
|
||||
(RequiredParameter
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Function
|
||||
@ -30,6 +31,7 @@
|
||||
(Identifier)
|
||||
(TextElement))
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier))))
|
||||
|
@ -3,7 +3,8 @@
|
||||
(Identifier)
|
||||
(RequiredParameter
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Function
|
||||
@ -23,6 +24,7 @@
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier))))
|
||||
|
6
test/fixtures/ruby/corpus/calls.parseA.txt
vendored
6
test/fixtures/ruby/corpus/calls.parseA.txt
vendored
@ -27,7 +27,9 @@
|
||||
(Identifier)))
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Send
|
||||
(Identifier))))
|
||||
|
@ -27,7 +27,8 @@
|
||||
{-(KeyValue
|
||||
{-(Array)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Send
|
||||
{-(Identifier)-})-}
|
||||
{-(Send
|
||||
{-(Identifier)-})-}
|
||||
{-(Function
|
||||
|
@ -27,7 +27,8 @@
|
||||
{+(KeyValue
|
||||
{+(Array)+}
|
||||
{+(Integer)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Send
|
||||
{+(Identifier)+})+}
|
||||
{+(Send
|
||||
{+(Identifier)+})+}
|
||||
{+(Function
|
||||
|
@ -26,7 +26,8 @@
|
||||
(KeyValue
|
||||
(Array)
|
||||
(Integer))
|
||||
(Identifier)
|
||||
(Send
|
||||
(Identifier))
|
||||
(Send
|
||||
(Identifier))
|
||||
(Function
|
||||
|
@ -33,7 +33,8 @@
|
||||
{-(Statements
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Send
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Statements
|
||||
{-(Send
|
||||
@ -56,4 +57,5 @@
|
||||
{-(Statements
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Identifier)-})-})
|
||||
{-(Send
|
||||
{-(Identifier)-})-})-})
|
||||
|
@ -33,7 +33,8 @@
|
||||
{+(Statements
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Send
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Statements
|
||||
{+(Send
|
||||
@ -56,4 +57,5 @@
|
||||
{+(Statements
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Identifier)+})+})
|
||||
{+(Send
|
||||
{+(Identifier)+})+})+})
|
||||
|
@ -33,7 +33,8 @@
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(Assignment
|
||||
(Statements
|
||||
(Send
|
||||
@ -56,4 +57,5 @@
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier)))
|
||||
(Send
|
||||
(Identifier))))
|
||||
|
Loading…
Reference in New Issue
Block a user