1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Merge branch 'generic-term-comparability-and-equivalence' into simplified-high-level-flow

This commit is contained in:
Rob Rix 2017-10-03 16:23:50 -04:00
commit 684af38fe9
187 changed files with 701 additions and 679 deletions

View File

@ -106,6 +106,36 @@ algorithmForTerms t1@(Term (In ann1 f1)) t2@(Term (In ann2 f2))
<|> insertF . In ann2 <$> subalgorithmFor byInserting ( mergeFor t1) f2
where mergeFor (Term (In ann1 f1)) (Term (In ann2 f2)) = merge (ann1, ann2) <$> algorithmFor f1 f2
-- | An O(1) relation on terms indicating their non-recursive comparability (i.e. are they of the same “kind” in a way that warrants comparison), defined in terms of the comparability of their respective syntax.
comparableTerms :: Diffable syntax
=> TermF syntax ann1 term1
-> TermF syntax ann2 term2
-> Bool
comparableTerms (In _ syntax1) (In _ syntax2) = comparableTo syntax1 syntax2
-- | An O(n) relation on terms indicating their recursive equivalence (i.e. are they _notionally_ “the same,” as distinct from literal equality), defined at each node in terms of the equivalence of their respective syntax, computed first on a nominated subterm (if any), falling back to substructural equivalence (e.g. equivalence of one term against the subject of the other, annotating term), and finally to equality.
equivalentTerms :: (Diffable syntax, Eq1 syntax)
=> Term syntax ann1
-> Term syntax ann2
-> Bool
equivalentTerms term1@(Term (In _ syntax1)) term2@(Term (In _ syntax2))
= fromMaybe False (equivalentTerms <$> equivalentBySubterm syntax1 <*> equivalentBySubterm syntax2)
|| runEquivalence (subalgorithmFor pure (Equivalence . flip equivalentTerms term2) syntax1)
|| runEquivalence (subalgorithmFor pure (Equivalence . equivalentTerms term1) syntax2)
|| liftEq equivalentTerms syntax1 syntax2
-- | A constant 'Alternative' functor used by 'equivalentTerms' to compute the substructural equivalence of syntax.
newtype Equivalence a = Equivalence { runEquivalence :: Bool }
deriving (Eq, Functor)
instance Applicative Equivalence where
pure _ = Equivalence True
Equivalence a <*> Equivalence b = Equivalence (a && b)
instance Alternative Equivalence where
empty = Equivalence False
Equivalence a <|> Equivalence b = Equivalence (a || b)
-- | A type class for determining what algorithm to use for diffing two terms.
class Diffable f where
-- | Construct an algorithm to diff a pair of @f@s populated with disjoint terms.
@ -136,22 +166,43 @@ class Diffable f where
-> g (f b) -- ^ The resulting algorithm (or other 'Alternative' context), producing the traversed syntax.
subalgorithmFor _ _ _ = empty
-- | Syntax having a human-provided identifier, such as function/method definitions, can use equivalence of identifiers as a proxy for their overall equivalence, improving the quality & efficiency of the diff as a whole.
--
-- This can also be used for annotation nodes to ensure that their subjects equivalence is weighed appropriately.
--
-- Other syntax should use the default definition, and thus have equivalence computed piece-wise.
equivalentBySubterm :: f a -> Maybe a
equivalentBySubterm _ = Nothing
-- | A relation on syntax values indicating their In general this should be true iff both values have the same constructor (this is the relation computed by the default, generic definition).
--
-- For syntax with constant fields which serve as a classifier, this method can be overloaded to consider equality on that classifier in addition to/instead of the constructors themselves, and thus limit the comparisons accordingly.
comparableTo :: f term1 -> f term2 -> Bool
default comparableTo :: (Generic1 f, GDiffable (Rep1 f)) => f term1 -> f term2 -> Bool
comparableTo = genericComparableTo
genericAlgorithmFor :: (Generic1 f, GDiffable (Rep1 f))
=> f term1
-> f term2
-> Algorithm term1 term2 result (f result)
genericAlgorithmFor a b = to1 <$> galgorithmFor (from1 a) (from1 b)
genericAlgorithmFor a1 a2 = to1 <$> galgorithmFor (from1 a1) (from1 a2)
genericComparableTo :: (Generic1 f, GDiffable (Rep1 f)) => f term1 -> f term2 -> Bool
genericComparableTo a1 a2 = gcomparableTo (from1 a1) (from1 a2)
-- | Diff a Union of Syntax terms. Left is the "rest" of the Syntax terms in the Union,
-- Right is the "head" of the Union. 'weaken' relaxes the Union to allow the possible
-- diff terms from the "rest" of the Union, and 'inj' adds the diff terms into the Union.
-- NB: If Left or Right Syntax terms in our Union don't match, we fail fast by returning Nothing.
-- | 'Diffable' for 'Union's of syntax functors is defined in general by straightforward lifting of each method into the functors in the 'Union'.
instance Apply Diffable fs => Diffable (Union fs) where
algorithmFor u1 u2 = fromMaybe empty (apply2' (Proxy :: Proxy Diffable) (\ inj f1 f2 -> inj <$> algorithmFor f1 f2) u1 u2)
subalgorithmFor blur focus = apply' (Proxy :: Proxy Diffable) (\ inj f -> inj <$> subalgorithmFor blur focus f)
equivalentBySubterm = apply (Proxy :: Proxy Diffable) equivalentBySubterm
-- | Comparability on 'Union's is defined first by comparability of their contained functors (when theyre the same), falling back to using 'subalgorithmFor' to opt substructurally-diffable syntax into comparisons (e.g. to allow annotating nodes to be compared against the kind of nodes they annotate).
comparableTo u1 u2 = fromMaybe False (apply2 proxy comparableTo u1 u2 <|> True <$ subalgorithmFor pure pure u1 <|> True <$ subalgorithmFor pure pure u2)
where proxy = Proxy :: Proxy Diffable
-- | Diff two 'Maybe's.
instance Diffable Maybe where
algorithmFor = diffMaybe
@ -168,10 +219,15 @@ instance Diffable NonEmpty where
class GDiffable f where
galgorithmFor :: f term1 -> f term2 -> Algorithm term1 term2 result (f result)
gcomparableTo :: f term1 -> f term2 -> Bool
gcomparableTo _ _ = True
-- | Diff two constructors (M1 is the Generic1 newtype for meta-information (possibly related to type constructors, record selectors, and data types))
instance GDiffable f => GDiffable (M1 i c f) where
galgorithmFor (M1 a1) (M1 a2) = M1 <$> galgorithmFor a1 a2
gcomparableTo (M1 a1) (M1 a2) = gcomparableTo a1 a2
-- | Diff the fields of a product type.
-- i.e. data Foo a b = Foo a b (the 'Foo a b' is captured by 'a :*: b').
instance (GDiffable f, GDiffable g) => GDiffable (f :*: g) where
@ -184,6 +240,10 @@ instance (GDiffable f, GDiffable g) => GDiffable (f :+: g) where
galgorithmFor (R1 b1) (R1 b2) = R1 <$> galgorithmFor b1 b2
galgorithmFor _ _ = empty
gcomparableTo (L1 _) (L1 _) = True
gcomparableTo (R1 _) (R1 _) = True
gcomparableTo _ _ = False
-- | Diff two parameters (Par1 is the Generic1 newtype representing a type parameter).
-- i.e. data Foo a = Foo a (the 'a' is captured by Par1).
instance GDiffable Par1 where

View File

@ -168,7 +168,9 @@ data Context a = Context { contextTerms :: NonEmpty a, contextSubject :: a }
deriving (Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Diffable Context where
subalgorithmFor blur focus (Context n1 s1) = Context <$> traverse blur n1 <*> focus s1
subalgorithmFor blur focus (Context n s) = Context <$> traverse blur n <*> focus s
equivalentBySubterm = Just . contextSubject
instance Eq1 Context where liftEq = genericLiftEq
instance Ord1 Context where liftCompare = genericLiftCompare

View File

@ -10,7 +10,10 @@ import Data.Mergeable
import GHC.Generics
data Function a = Function { functionContext :: ![a], functionName :: !a, functionParameters :: ![a], functionBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
deriving (Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Diffable Function where
equivalentBySubterm = Just . functionName
instance Eq1 Function where liftEq = genericLiftEq
instance Ord1 Function where liftCompare = genericLiftCompare
@ -19,7 +22,10 @@ instance Show1 Function where liftShowsPrec = genericLiftShowsPrec
-- TODO: How should we represent function types, where applicable?
data Method a = Method { methodContext :: ![a], methodReceiver :: !a, methodName :: !a, methodParameters :: ![a], methodBody :: !a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
deriving (Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Diffable Method where
equivalentBySubterm = Just . methodName
instance Eq1 Method where liftEq = genericLiftEq
instance Ord1 Method where liftCompare = genericLiftCompare

View File

@ -2,8 +2,6 @@
module Interpreter
( diffTerms
, diffSyntaxTerms
, comparableByConstructor
, equivalentTerms
) where
import Algorithm
@ -13,15 +11,11 @@ import Data.Align.Generic
import Data.Diff
import Data.Functor.Classes
import Data.Hashable (Hashable)
import Data.Maybe (fromMaybe, isJust)
import Data.Maybe (fromMaybe)
import Data.Record
import qualified Data.Syntax as Syntax
import Data.Syntax.Algebra
import qualified Data.Syntax.Declaration as Declaration
import Data.Term
import Data.Text (Text)
import Data.These
import Data.Union
import Info hiding (Empty, Return)
import RWS
import Syntax (Syntax(Leaf))
@ -35,11 +29,11 @@ diffSyntaxTerms :: (HasField fields1 Category, HasField fields2 Category)
diffSyntaxTerms = decoratingWith comparableByCategory (equalTerms comparableByCategory) getLabel getLabel
-- | Diff two à la carte terms recursively.
diffTerms :: (Declaration.Method :< fs, Declaration.Function :< fs, Syntax.Context :< fs, Apply Diffable fs, Apply Foldable fs, Apply Functor fs, Apply GAlign fs, Apply Show1 fs, Apply Traversable fs)
=> Term (Union fs) (Record fields1)
-> Term (Union fs) (Record fields2)
-> Diff (Union fs) (Record fields1) (Record fields2)
diffTerms = decoratingWith comparableByConstructor equivalentTerms constructorNameAndConstantFields constructorNameAndConstantFields
diffTerms :: (Diffable syntax, Eq1 syntax, Foldable syntax, Functor syntax, GAlign syntax, Show1 syntax, Traversable syntax)
=> Term syntax (Record fields1)
-> Term syntax (Record fields2)
-> Diff syntax (Record fields1) (Record fields2)
diffTerms = decoratingWith comparableTerms equivalentTerms constructorNameAndConstantFields constructorNameAndConstantFields
-- | Diff two terms by decorating with feature vectors computed using the supplied labelling algebra, and stripping the feature vectors from the resulting diff.
decoratingWith :: (Hashable label, Diffable syntax, GAlign syntax, Traversable syntax)
@ -101,35 +95,3 @@ getLabel (In h t) = (Info.category h, case t of
-- | Test whether two terms are comparable by their Category.
comparableByCategory :: (HasField fields1 Category, HasField fields2 Category) => ComparabilityRelation syntax (Record fields1) (Record fields2)
comparableByCategory (In a _) (In b _) = category a == category b
-- | Test whether two terms are comparable by their constructor.
comparableByConstructor :: (Syntax.Context :< fs, Apply GAlign fs) => ComparabilityRelation (Union fs) ann1 ann2
comparableByConstructor (In _ u1) (In _ u2)
| Just Syntax.Context{} <- prj u1 = True
| Just Syntax.Context{} <- prj u2 = True
| otherwise = isJust (galign u1 u2)
-- | Equivalency relation for terms. Equivalence is determined by functions and
-- methods with equal identifiers/names and recursively by equivalent terms with
-- identical shapes.
equivalentTerms :: (Declaration.Method :< fs, Declaration.Function :< fs, Syntax.Context :< fs, Apply Foldable fs, Apply GAlign fs)
=> Term (Union fs) ann1
-> Term (Union fs) ann2
-> Bool
equivalentTerms t1@(Term (In _ u1)) t2@(Term (In _ u2))
| Just (Declaration.Method _ _ identifier1 _ _) <- prj u1
, Just (Declaration.Method _ _ identifier2 _ _) <- prj u2
= equivalentTerms identifier1 identifier2
| Just (Declaration.Function _ identifier1 _ _) <- prj u1
, Just (Declaration.Function _ identifier2 _ _) <- prj u2
= equivalentTerms identifier1 identifier2
| Just (Syntax.Context _ s1) <- prj u1
, Just (Syntax.Context _ s2) <- prj u2
= equivalentTerms s1 s2
| Just (Syntax.Context _ s1) <- prj u1
= equivalentTerms s1 t2
| Just (Syntax.Context _ s2) <- prj u2
= equivalentTerms t1 s2
| Just aligned <- galignWith (Just . these (const False) (const False) equivalentTerms) u1 u2
= and aligned
| otherwise = False

View File

@ -11,7 +11,6 @@ import Data.Syntax (makeTerm, parseError)
import qualified Data.Syntax as Syntax
import Data.Syntax.Assignment hiding (Assignment, Error)
import qualified Data.Syntax.Assignment as Assignment
import qualified Data.Syntax.Declaration as Declaration
import qualified Data.Syntax.Literal as Literal
import qualified Data.Term as Term
import Data.Union
@ -27,10 +26,6 @@ type Syntax =
, Literal.Null
, Literal.String
, Literal.TextElement
-- NB: Diffing requires Methods, Functions, and Context in the union.
, Declaration.Method
, Declaration.Function
, Syntax.Context
, Syntax.Error
, []
]

View File

@ -14,7 +14,6 @@ import Data.Syntax (makeTerm)
import qualified Data.Syntax as Syntax
import Data.Syntax.Assignment hiding (Assignment, Error)
import qualified Data.Syntax.Assignment as Assignment
import qualified Data.Syntax.Declaration as Declaration
import qualified Data.Syntax.Markup as Markup
import Data.Term as Term (Term(..), TermF(..), termIn, unwrap)
import qualified Data.Text as Text
@ -46,10 +45,6 @@ type Syntax =
, Markup.Strong
, Markup.Text
, Markup.Strikethrough
-- NB: Diffing requires Methods, Functions, and Context in the union.
, Declaration.Method
, Declaration.Function
, Syntax.Context
-- Assignment errors; cmark does not provide parse errors.
, Syntax.Error
, []

View File

@ -39,7 +39,7 @@ type Syntax =
, Declaration.Decorator
, Declaration.Function
, Declaration.Import
-- NB: Diffing requires Methods in the union.
-- NB: ToC rendering requires Methods in the union.
, Declaration.Method
, Declaration.Variable
, Expression.Arithmetic

View File

@ -73,6 +73,7 @@ diffBlobPair :: DiffRenderer output -> Both Blob -> Task output
diffBlobPair renderer blobs = case (renderer, effectiveLanguage) of
(OldToCDiffRenderer, Just Language.Markdown) -> run (\ blob -> parse markdownParser blob >>= decorate (markupSectionAlgebra blob)) diffTerms (renderToCDiff blobs)
(OldToCDiffRenderer, Just Language.Python) -> run (\ blob -> parse pythonParser blob >>= decorate (declarationAlgebra blob)) diffTerms (renderToCDiff blobs)
(OldToCDiffRenderer, Just Language.Ruby) -> run (\ blob -> parse rubyParser blob >>= decorate (declarationAlgebra blob)) diffTerms (renderToCDiff blobs)
(OldToCDiffRenderer, lang)
| Just syntaxParser <- lang >>= syntaxParserForLanguage ->
run (\ blob -> parse syntaxParser blob >>= decorate (syntaxDeclarationAlgebra blob)) diffSyntaxTerms (renderToCDiff blobs)

View File

@ -1,6 +1,7 @@
{-# LANGUAGE DataKinds #-}
module Data.RandomWalkSimilarity.Spec where
import Algorithm
import Data.Array.IArray
import Data.Bifunctor
import Data.Diff
@ -35,12 +36,12 @@ spec = parallel $ do
\ (as, bs) -> let tas = decorate <$> (as :: [Term ListableSyntax (Record '[])])
tbs = decorate <$> (bs :: [Term ListableSyntax (Record '[])])
wrap = termIn Nil . inj
diff = merge (Nil, Nil) (inj (stripDiff . diffThese <$> rws comparableByConstructor (equalTerms comparableByConstructor) tas tbs)) in
diff = merge (Nil, Nil) (inj (stripDiff . diffThese <$> rws comparableTerms (equalTerms comparableTerms) tas tbs)) in
(beforeTerm diff, afterTerm diff) `shouldBe` (Just (wrap (stripTerm <$> tas)), Just (wrap (stripTerm <$> tbs)))
it "produces unbiased insertions within branches" $
let (a, b) = (decorate (termIn Nil (inj [ termIn Nil (inj (Syntax.Identifier "a")) ])), decorate (termIn Nil (inj [ termIn Nil (inj (Syntax.Identifier "b")) ]))) in
fmap (bimap stripTerm stripTerm) (rws comparableByConstructor (equalTerms comparableByConstructor) [ b ] [ a, b ]) `shouldBe` fmap (bimap stripTerm stripTerm) [ That a, These b b ]
fmap (bimap stripTerm stripTerm) (rws comparableTerms (equalTerms comparableTerms) [ b ] [ a, b ]) `shouldBe` fmap (bimap stripTerm stripTerm) [ That a, These b b ]
where decorate = defaultFeatureVectorDecorator constructorNameAndConstantFields

View File

@ -1,5 +1,5 @@
(Program
(Context
{+(Comment)+}
{-(Comment)-}
{ (Comment)
->(Comment) }
(Empty)))

View File

@ -1,5 +1,5 @@
(Program
(Context
{+(Comment)+}
{-(Comment)-}
{ (Comment)
->(Comment) }
(Empty)))

View File

@ -5,6 +5,6 @@
(Identifier)
(Identifier))
(Float)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty))))

View File

@ -5,6 +5,6 @@
(Identifier)
(Identifier))
(Float)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty))))

View File

@ -7,6 +7,6 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -7,6 +7,6 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))

View File

@ -83,8 +83,8 @@
{+(Identifier)+}
{+(Empty)+})+}))
(Export
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{+(Export
{+(Function
{+(Empty)+}

View File

@ -81,8 +81,8 @@
{-(Identifier)-}
{-(Empty)-})-}))
(Export
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{-(Export
{-(Function
{-(Empty)-}
@ -111,8 +111,8 @@
{+(Identifier)+}
{+(Identifier)+})+})+})+}
(Export
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Export
(ExportClause
(ImportExportSpecifier
@ -131,8 +131,8 @@
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
{+(Export
{+(ExportClause
{+(ImportExportSpecifier

View File

@ -7,7 +7,7 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))))
(Empty))

View File

@ -7,7 +7,7 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))))
(Empty))

View File

@ -2,8 +2,8 @@
(Call
(Identifier)
(Float)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Function
(Empty)
(Empty)
@ -31,12 +31,12 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Return
{ (Identifier)
->(Identifier) })))
{+(Boolean)+}
{-(Boolean)-}
{ (Boolean)
->(Boolean) }
(Empty)))

View File

@ -2,8 +2,8 @@
(Call
(Identifier)
(Float)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Function
(Empty)
(Empty)
@ -26,12 +26,12 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Return
{ (Identifier)
->(Identifier) })))
{+(Boolean)+}
{-(Boolean)-}
{ (Boolean)
->(Boolean) }
(Empty)))

View File

@ -2,6 +2,6 @@
(Call
(Identifier)
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))

View File

@ -2,6 +2,6 @@
(Call
(Identifier)
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))

View File

@ -16,6 +16,6 @@
(Identifier)
(Empty)))
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))

View File

@ -16,6 +16,6 @@
(Identifier)
(Empty)))
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))

View File

@ -1,3 +1,3 @@
(Program
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })

View File

@ -1,3 +1,3 @@
(Program
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })

View File

@ -7,8 +7,8 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
{+(Identifier)+})
(Empty)))

View File

@ -7,8 +7,8 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
{-(Identifier)-})
(Empty)))

View File

@ -2,15 +2,15 @@
(Import
(ImportClause
(Identifier))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamespaceImport
{ (Identifier)
->(Identifier) }))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -18,8 +18,8 @@
{ (Identifier)
->(Identifier) }
(Empty))))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -31,8 +31,8 @@
{ (Identifier)
->(Identifier) }
(Empty))))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -45,8 +45,8 @@
->(Identifier) }
{ (Identifier)
->(Identifier) })))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(Identifier)
@ -60,16 +60,16 @@
->(Identifier) }
{ (Identifier)
->(Identifier) })))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(Identifier)
(NamespaceImport
{ (Identifier)
->(Identifier) }))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
{+(TextElement)+}
{-(TextElement)-}))
{ (TextElement)
->(TextElement) }))

View File

@ -2,15 +2,15 @@
(Import
(ImportClause
(Identifier))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamespaceImport
{ (Identifier)
->(Identifier) }))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -18,8 +18,8 @@
{ (Identifier)
->(Identifier) }
(Empty))))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -31,8 +31,8 @@
{ (Identifier)
->(Identifier) }
(Empty))))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(NamedImports
@ -45,8 +45,8 @@
->(Identifier) }
{ (Identifier)
->(Identifier) })))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(Identifier)
@ -60,16 +60,16 @@
->(Identifier) }
{ (Identifier)
->(Identifier) })))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
(ImportClause
(Identifier)
(NamespaceImport
{ (Identifier)
->(Identifier) }))
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })
(Import
{+(TextElement)+}
{-(TextElement)-}))
{ (TextElement)
->(TextElement) }))

View File

@ -4,6 +4,6 @@
(Identifier)
(Identifier))
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))

View File

@ -4,6 +4,6 @@
(Identifier)
(Identifier))
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))

View File

@ -22,6 +22,6 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -22,6 +22,6 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -37,13 +37,13 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -37,13 +37,13 @@
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(MemberAccess
(Identifier)
(Identifier))
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))))))

View File

@ -1,3 +1,3 @@
(Program
{+(Float)+}
{-(Float)-})
{ (Float)
->(Float) })

View File

@ -1,3 +1,3 @@
(Program
{+(Float)+}
{-(Float)-})
{ (Float)
->(Float) })

View File

@ -1,3 +1,3 @@
(Program
{+(Regex)+}
{-(Regex)-})
{ (Regex)
->(Regex) })

View File

@ -1,3 +1,3 @@
(Program
{+(Regex)+}
{-(Regex)-})
{ (Regex)
->(Regex) })

View File

@ -1,7 +1,7 @@
(Program
{+(LessThanEqual
{+(Identifier)+}
{+(Identifier)+})+}
{-(LessThan
{ (LessThan
{-(Identifier)-}
{-(Identifier)-})-})
{-(Identifier)-})
->(LessThanEqual
{+(Identifier)+}
{+(Identifier)+}) })

View File

@ -1,7 +1,7 @@
(Program
{+(LessThan
{+(Identifier)+}
{+(Identifier)+})+}
{-(LessThanEqual
{ (LessThanEqual
{-(Identifier)-}
{-(Identifier)-})-})
{-(Identifier)-})
->(LessThan
{+(Identifier)+}
{+(Identifier)+}) })

View File

@ -1,3 +1,3 @@
(Program
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })

View File

@ -1,3 +1,3 @@
(Program
{+(TextElement)+}
{-(TextElement)-})
{ (TextElement)
->(TextElement) })

View File

@ -1,5 +1,5 @@
(Program
(Subscript
(Identifier)
{+(TextElement)+}
{-(TextElement)-}))
{ (TextElement)
->(TextElement) }))

View File

@ -1,5 +1,5 @@
(Program
(Subscript
(Identifier)
{+(TextElement)+}
{-(TextElement)-}))
{ (TextElement)
->(TextElement) }))

View File

@ -1,5 +1,5 @@
(Program
(Subscript
(Identifier)
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))

View File

@ -1,5 +1,5 @@
(Program
(Subscript
(Identifier)
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))

View File

@ -10,8 +10,8 @@
(Pattern
(Float)
(
{+(Float)+}
{-(Float)-}))
{ (Float)
->(Float) }))
(Pattern
(Float)
(

View File

@ -10,8 +10,8 @@
(Pattern
(Float)
(
{+(Float)+}
{-(Float)-}))
{ (Float)
->(Float) }))
(Pattern
(Float)
(

View File

@ -3,6 +3,6 @@
(New
(Call
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))))

View File

@ -3,6 +3,6 @@
(New
(Call
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty)))))

View File

@ -5,10 +5,10 @@
(Catch
(Empty)
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Finally
(
{+(Identifier)+}
{-(Identifier)-})))
{ (Identifier)
->(Identifier) })))
(Empty))

View File

@ -5,10 +5,10 @@
(Catch
(Empty)
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Finally
(
{+(Identifier)+}
{-(Identifier)-})))
{ (Identifier)
->(Identifier) })))
(Empty))

View File

@ -1,3 +1,3 @@
(Program
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })

View File

@ -1,3 +1,3 @@
(Program
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })

View File

@ -8,8 +8,8 @@
(Identifier)
{+(Identifier)+}
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
(Identifier))
(Annotation
@ -17,8 +17,8 @@
(Function
(Identifier)
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
(Identifier))
{+(Annotation

View File

@ -14,8 +14,8 @@
(Function
(Identifier)
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
(Identifier))
(Annotation
@ -23,12 +23,12 @@
(Function
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }
{+(Identifier)+}
{+(Identifier)+}
{-(Identifier)-}
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
(Identifier))
{+(Annotation

View File

@ -8,6 +8,6 @@
(Empty))
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))

View File

@ -8,6 +8,6 @@
(Empty))
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))

View File

@ -32,9 +32,12 @@
{+(DividedBy
{+(Identifier)+}
{+(Identifier)+})+}
{+(Modulo
{ (DividedBy
{-(Identifier)-}
{-(Identifier)-})
->(Modulo
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+}) }
{+(DividedBy
{+(Identifier)+}
{+(Identifier)+})+}
@ -47,9 +50,6 @@
{+(Plus
{+(Identifier)+}
{+(Identifier)+})+}
{-(DividedBy
{-(Identifier)-}
{-(Identifier)-})-}
{-(Power
{-(Identifier)-}
{-(Identifier)-})-}

View File

@ -1,6 +1,6 @@
(Program
{-(Boolean)-}
(Boolean)
{+(Boolean)+}
{+(Boolean)+}
{-(Boolean)-})
{ (Boolean)
->(Boolean) }
{+(Boolean)+})

View File

@ -1,6 +1,6 @@
(Program
{-(Boolean)-}
(Boolean)
{+(Boolean)+}
{+(Boolean)+}
{-(Boolean)-})
{ (Boolean)
->(Boolean) }
{+(Boolean)+})

View File

@ -2,6 +2,6 @@
(Context
{-(Comment)-}
(Comment)
{+(Comment)+}
{-(Comment)-}
{ (Comment)
->(Comment) }
(Empty)))

View File

@ -2,6 +2,6 @@
(
{-(TextElement)-}
(TextElement)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(TextElement)))

View File

@ -15,8 +15,8 @@
{ (Identifier)
->(Identifier) }
(
{+(Identifier)+}
{-(Identifier)-})))
{ (Identifier)
->(Identifier) })))
{-(If
{-(Identifier)-}
{-(Call

View File

@ -12,15 +12,15 @@
([])
(Decorator
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(
{+(Identifier)+}
{-(Integer)-})
(Decorator
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(
{+(Identifier)+}
{-(Integer)-}

View File

@ -12,15 +12,15 @@
([])
(Decorator
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(
{+(Integer)+}
{-(Identifier)-})
(Decorator
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(
{+(Integer)+}
{+(Integer)+}

View File

@ -8,10 +8,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{+(
{+(Identifier)+})+}))
(Comprehension
@ -23,9 +23,9 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{-(
{-(Identifier)-})-})))

View File

@ -8,10 +8,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{-(
{-(Identifier)-})-}))
(Comprehension
@ -23,9 +23,9 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{+(
{+(Identifier)+})+})))

View File

@ -1,9 +1,9 @@
(Program
(Call
(Identifier)
{+(TextElement)+}
{ (TextElement)
->(TextElement) }
{+(Identifier)+}
{-(TextElement)-}
(Empty))
(Call
(Identifier)

View File

@ -1,8 +1,8 @@
(Program
(Call
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
{-(Identifier)-}
(Empty))
(Call

View File

@ -1,5 +1,6 @@
(Program
{+(Identifier)+}
{ (Identifier)
->(Identifier) }
{+(Plus
{+(Identifier)+}
{+(Identifier)+})+}
@ -11,7 +12,6 @@
{+(Integer)+}
{+(Integer)+}
{+(Integer)+})+}
{-(Identifier)-}
{-(
{-(Integer)-}
{-(Integer)-}

View File

@ -2,18 +2,18 @@
(Negate
{ (Float)
->(Float) })
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}

View File

@ -2,19 +2,19 @@
(Negate
{ (Float)
->(Float) })
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{ (Float)
->(Float) }
{+(Float)+}
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}

View File

@ -15,8 +15,8 @@
(ForEach
(
(Identifier)
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(Identifier)
(
(Call
@ -26,8 +26,8 @@
(ForEach
(
(Identifier)
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(Identifier)
(
(Call
@ -37,8 +37,8 @@
(
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))))
{-(ForEach
{-(

View File

@ -27,8 +27,8 @@
{+(Empty)+})+})+})+}
(ForEach
(
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(Array
(Tuple
(Integer))
@ -37,8 +37,8 @@
(Tuple
(Integer)))
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
{-(Else
{-(ForEach
{-(

View File

@ -15,13 +15,13 @@
(Annotation
(Function
(Identifier)
{+(Identifier)+}
{+(Identifier)+}
{-(Identifier)-}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
{+(Annotation
{+(Function
@ -55,8 +55,8 @@
->(Integer) })
{ (Identifier)
->(Identifier) })
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(
(Identifier)))
(Empty)))

View File

@ -18,19 +18,19 @@
(Identifier)
{+(Identifier)+}
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
(Annotation
(Function
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }
{+(Identifier)+}
{+(Identifier)+}
{-(Identifier)-}
(
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Empty))
{+(Annotation
{+(Function
@ -51,8 +51,8 @@
->(TextElement) })
{ (Identifier)
->(Identifier) })
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(
(Identifier)))
(Empty)))

View File

@ -5,10 +5,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})))
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })))
(Comprehension
{ (Identifier)
->(Plus
@ -17,7 +17,7 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-}))))
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) }))))

View File

@ -5,10 +5,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})))
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })))
(Comprehension
{ (Plus
{-(Identifier)-}
@ -17,7 +17,7 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-}))))
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) }))))

View File

@ -6,7 +6,7 @@
(Empty))
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
{-(Identifier)-}
(Empty)))

View File

@ -6,7 +6,7 @@
(Empty))
(Call
(Identifier)
{ (Identifier)
->(Identifier) }
{+(Identifier)+}
{+(Identifier)+}
{-(Identifier)-}
(Empty)))

View File

@ -1,4 +1,4 @@
(Program
{+(Identifier)+}
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) }
{+(Identifier)+})

View File

@ -1,4 +1,4 @@
(Program
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
{-(Identifier)-})

View File

@ -3,9 +3,9 @@
{ (Identifier)
->(Identifier) }
(
{+(Identifier)+}
(Identifier)
{-(Identifier)-})
{ (Identifier)
->(Identifier) }
(Identifier))
{ (If
{-(Identifier)-}
{-(

View File

@ -17,6 +17,6 @@
{+(Identifier)+})+})
(Import
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(Identifier)))

View File

@ -15,6 +15,6 @@
(Identifier)))
(Import
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
(Identifier)))

View File

@ -14,8 +14,8 @@
{ (Identifier)
->(Identifier) }
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Identifier))
(Empty))
{-(ScopeResolution

View File

@ -14,8 +14,8 @@
{ (Identifier)
->(Identifier) }
(ScopeResolution
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Identifier))
(Empty))
{+(ScopeResolution

View File

@ -2,7 +2,8 @@
(Negate
{ (Integer)
->(Integer) })
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Negate
@ -17,7 +18,6 @@
{+(Integer)+}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Negate
{-(Integer)-})-}
{-(Integer)-}

View File

@ -2,22 +2,22 @@
(Negate
{ (Integer)
->(Integer) })
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Negate
{+(Integer)+})+}
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Negate
{-(Integer)-})-}
{-(Integer)-}

View File

@ -5,10 +5,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{+(
{+(Call
{+(Identifier)+}
@ -29,9 +29,9 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{-(
{-(Identifier)-})-})))

View File

@ -5,10 +5,10 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{-(
{-(Call
{-(Identifier)-}
@ -29,9 +29,9 @@
(
(
(
{+(Identifier)+}
{-(Identifier)-})
{+(Identifier)+}
{-(Identifier)-})
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) })
{+(
{+(Identifier)+})+})))

View File

@ -1,6 +1,6 @@
(Program
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))

View File

@ -1,6 +1,6 @@
(Program
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty)))

View File

@ -1,14 +1,14 @@
(Program
(Call
(Identifier)
{+(Identifier)+}
{ (Identifier)
->(Identifier) }
(Identifier)
{-(Identifier)-}
(Empty))
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(Identifier)

View File

@ -7,8 +7,8 @@
(Empty))
(Call
(Identifier)
{+(Identifier)+}
{-(Identifier)-}
{ (Identifier)
->(Identifier) }
(Empty))
(Call
(Identifier)

View File

@ -3,17 +3,17 @@
(
(Call
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty))))
(Throw
(
(Call
(Identifier)
{+(TextElement)+}
{-(TextElement)-}
{ (TextElement)
->(TextElement) }
(Empty))
{+(Identifier)+}
{-(Identifier)-}))
{ (Identifier)
->(Identifier) }))
(Throw
([])))

Some files were not shown because too many files have changed in this diff Show More