1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Merge remote-tracking branch 'origin/master' into bidistribute

This commit is contained in:
Timothy Clem 2017-12-13 09:14:05 -08:00
commit 8e8d2fb41e
45 changed files with 642 additions and 453 deletions

View File

@ -19,6 +19,7 @@ library
, Analysis.CyclomaticComplexity
, Analysis.Decorator
, Analysis.Declaration
, Analysis.IdentifierName
-- Semantic assignment
, Assigning.Assignment
, Assigning.Assignment.Table

View File

@ -1,9 +1,12 @@
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeOperators #-}
{-# LANGUAGE DataKinds, DefaultSignatures, GeneralizedNewtypeDeriving, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, UndecidableInstances #-}
module Analysis.CyclomaticComplexity
( cyclomaticComplexityAlgebra
( CyclomaticComplexity(..)
, HasCyclomaticComplexity
, cyclomaticComplexityAlgebra
) where
import Data.Algebra (FAlgebra)
import Data.Aeson
import Data.Proxy
import qualified Data.Syntax.Declaration as Declaration
import qualified Data.Syntax.Statement as Statement
import Data.Term
@ -11,16 +14,103 @@ import Data.Union
-- | The cyclomatic complexity of a (sub)term.
newtype CyclomaticComplexity = CyclomaticComplexity Int
deriving (Enum, Eq, Num, Ord, Show)
deriving (Enum, Eq, Num, Ord, Show, ToJSON)
-- | Compute the cyclomatic complexity of a (sub)term, measured as the number places where control exits scope, e.g. returns and yields.
--
-- TODO: Explicit returns at the end of methods should only count once.
-- TODO: Explicit returns at the end of methods or functions should only count once.
-- TODO: Anonymous functions should not increase parent scopes complexity.
-- TODO: Inner functions should not increase parent scopes complexity.
cyclomaticComplexityAlgebra :: (Declaration.Method :< fs, Statement.Return :< fs, Statement.Yield :< fs, Apply Foldable fs, Apply Functor fs) => FAlgebra (Term (Union fs) a) CyclomaticComplexity
cyclomaticComplexityAlgebra (In _ union) = case union of
_ | Just Declaration.Method{} <- prj union -> succ (sum union)
_ | Just Statement.Return{} <- prj union -> succ (sum union)
_ | Just Statement.Yield{} <- prj union -> succ (sum union)
_ -> sum union
-- | An f-algebra producing a 'CyclomaticComplexity' for syntax nodes corresponding to their summary cyclomatic complexity, defaulting to the sum of their contents cyclomatic complexities.
--
-- Customizing this for a given syntax type involves two steps:
--
-- 1. Defining a 'CustomHasCyclomaticComplexity' instance for the type.
-- 2. Adding the type to the 'CyclomaticComplexityStrategy' type family.
--
-- If youre getting errors about missing a 'CustomHasCyclomaticComplexity' instance for your syntax type, you probably forgot step 1.
--
-- If youre getting 'Nothing' for your syntax node at runtime, you probably forgot step 2.
cyclomaticComplexityAlgebra :: (Foldable syntax, HasCyclomaticComplexity syntax) => TermF syntax ann CyclomaticComplexity -> CyclomaticComplexity
cyclomaticComplexityAlgebra (In _ syntax) = toCyclomaticComplexity syntax
-- | Types for which we can produce a 'CyclomaticComplexity'. There is exactly one instance of this typeclass; adding customized 'CyclomaticComplexity's for a new type is done by defining an instance of 'CustomHasCyclomaticComplexity' instead.
--
-- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap.
class HasCyclomaticComplexity syntax where
-- | Compute a 'CyclomaticComplexity' for a syntax type using its 'CustomHasCyclomaticComplexity' instance, if any, or else falling back to the default definition (which simply returns the sum of any contained cyclomatic complexities).
toCyclomaticComplexity :: syntax CyclomaticComplexity -> CyclomaticComplexity
-- | Define 'toCyclomaticComplexity' using the 'CustomHasCyclomaticComplexity' instance for a type if there is one or else use the default definition.
--
-- This instance determines whether or not there is an instance for @syntax@ by looking it up in the 'CyclomaticComplexityStrategy' type family. Thus producing a 'CyclomaticComplexity' for a node requires both defining a 'CustomHasCyclomaticComplexity' instance _and_ adding a definition for the type to the 'CyclomaticComplexityStrategy' type family to return 'Custom'.
--
-- Note that since 'CyclomaticComplexityStrategy' has a fallback case for its final entry, this instance will hold for all types of kind @* -> *@. Thus, this must be the only instance of 'HasCyclomaticComplexity', as any other instance would be indistinguishable.
instance (CyclomaticComplexityStrategy syntax ~ strategy, HasCyclomaticComplexityWithStrategy strategy syntax) => HasCyclomaticComplexity syntax where
toCyclomaticComplexity = toCyclomaticComplexityWithStrategy (Proxy :: Proxy strategy)
-- | Types for which we can produce a customized 'CyclomaticComplexity'.
class CustomHasCyclomaticComplexity syntax where
-- | Produce a customized 'CyclomaticComplexity' for a given syntax node.
customToCyclomaticComplexity :: syntax CyclomaticComplexity -> CyclomaticComplexity
-- | Because we perform the same operation wherever we use the custom strategy, we can define the default method for all instances.
default customToCyclomaticComplexity :: Foldable syntax => syntax CyclomaticComplexity -> CyclomaticComplexity
customToCyclomaticComplexity = succ . sum
instance CustomHasCyclomaticComplexity Declaration.Function
instance CustomHasCyclomaticComplexity Declaration.Method
instance CustomHasCyclomaticComplexity Statement.Catch
instance CustomHasCyclomaticComplexity Statement.DoWhile
instance CustomHasCyclomaticComplexity Statement.Else
instance CustomHasCyclomaticComplexity Statement.For
instance CustomHasCyclomaticComplexity Statement.ForEach
instance CustomHasCyclomaticComplexity Statement.If
instance CustomHasCyclomaticComplexity Statement.Pattern
instance CustomHasCyclomaticComplexity Statement.While
-- | Produce a 'CyclomaticComplexity' for 'Union's using the 'HasCyclomaticComplexity' instance & therefore using a 'CustomHasCyclomaticComplexity' instance when one exists & the type is listed in 'CyclomaticComplexityStrategy'.
instance Apply HasCyclomaticComplexity fs => CustomHasCyclomaticComplexity (Union fs) where
customToCyclomaticComplexity = apply (Proxy :: Proxy HasCyclomaticComplexity) toCyclomaticComplexity
-- | A strategy for defining a 'HasCyclomaticComplexity' instance. Intended to be promoted to the kind level using @-XDataKinds@.
data Strategy = Default | Custom
-- | Produce a 'CyclomaticComplexity' for a syntax node using either the 'Default' or 'Custom' strategy.
--
-- You should probably be using 'CustomHasCyclomaticComplexity' instead of this class; and you should not define new instances of this class.
class HasCyclomaticComplexityWithStrategy (strategy :: Strategy) syntax where
toCyclomaticComplexityWithStrategy :: proxy strategy -> syntax CyclomaticComplexity -> CyclomaticComplexity
-- | A predicate on syntax types selecting either the 'Custom' or 'Default' strategy.
--
-- Only entries for which we want to use the 'Custom' strategy should be listed, with the exception of the final entry which maps all other types onto the 'Default' strategy.
--
-- If youre seeing errors about missing a 'CustomHasCyclomaticComplexity' instance for a given type, youve probably listed it in here but not defined a 'CustomHasCyclomaticComplexity' instance for it, or else youve listed the wrong type in here. Conversely, if your 'customHasCyclomaticComplexity' method is never being called, you may have forgotten to list the type in here.
type family CyclomaticComplexityStrategy syntax where
CyclomaticComplexityStrategy Declaration.Function = 'Custom
CyclomaticComplexityStrategy Declaration.Method = 'Custom
CyclomaticComplexityStrategy Statement.Catch = 'Custom
CyclomaticComplexityStrategy Statement.DoWhile = 'Custom
CyclomaticComplexityStrategy Statement.Else = 'Custom
CyclomaticComplexityStrategy Statement.For = 'Custom
CyclomaticComplexityStrategy Statement.ForEach = 'Custom
CyclomaticComplexityStrategy Statement.If = 'Custom
CyclomaticComplexityStrategy Statement.Pattern = 'Custom
CyclomaticComplexityStrategy Statement.While = 'Custom
CyclomaticComplexityStrategy (Union fs) = 'Custom
CyclomaticComplexityStrategy a = 'Default
-- | The 'Default' strategy takes the sum without incrementing.
instance Foldable syntax => HasCyclomaticComplexityWithStrategy 'Default syntax where
toCyclomaticComplexityWithStrategy _ = sum
-- | The 'Custom' strategy delegates the selection of the strategy to the 'CustomHasCyclomaticComplexity' instance for the type.
instance CustomHasCyclomaticComplexity syntax => HasCyclomaticComplexityWithStrategy 'Custom syntax where
toCyclomaticComplexityWithStrategy _ = customToCyclomaticComplexity

View File

@ -0,0 +1,60 @@
{-# LANGUAGE DataKinds, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, TypeOperators, UndecidableInstances #-}
module Analysis.IdentifierName
( IdentifierName(..)
, IdentifierLabel(..)
, identifierLabel
) where
import Data.Aeson
import Data.ByteString
import Data.JSON.Fields
import Data.Proxy
import Data.Term
import Data.Text.Encoding (decodeUtf8)
import Data.Union
import qualified Data.Syntax
-- | Compute a 'IdentifierLabel' label for a 'Term'.
identifierLabel :: IdentifierName syntax => TermF syntax a b -> Maybe IdentifierLabel
identifierLabel (In _ s) = IdentifierLabel <$> (identifierName s)
newtype IdentifierLabel = IdentifierLabel ByteString
deriving (Show)
instance ToJSONFields IdentifierLabel where
toJSONFields (IdentifierLabel s) = [ "name" .= decodeUtf8 s ]
-- | A typeclass to retrieve the name of syntax identifiers.
--
-- This typeclass employs the Advanced Overlap techniques designed by Oleg Kiselyov & Simon Peyton Jones: https://wiki.haskell.org/GHC/AdvancedOverlap; see also src/Analysis/Declaration.hs for discussion of the details of the mechanism.
class IdentifierName syntax where
identifierName :: syntax a -> Maybe ByteString
instance (IdentifierNameStrategy syntax ~ strategy, IdentifierNameWithStrategy strategy syntax) => IdentifierName syntax where
identifierName = identifierNameWithStrategy (Proxy :: Proxy strategy)
class CustomIdentifierName syntax where
customIdentifierName :: syntax a -> Maybe ByteString
instance Apply IdentifierName fs => CustomIdentifierName (Union fs) where
customIdentifierName = apply (Proxy :: Proxy IdentifierName) identifierName
instance CustomIdentifierName Data.Syntax.Identifier where
customIdentifierName (Data.Syntax.Identifier name) = Just name
data Strategy = Default | Custom
type family IdentifierNameStrategy syntax where
IdentifierNameStrategy (Union _) = 'Custom
IdentifierNameStrategy Data.Syntax.Identifier = 'Custom
IdentifierNameStrategy syntax = 'Default
class IdentifierNameWithStrategy (strategy :: Strategy) syntax where
identifierNameWithStrategy :: proxy strategy -> syntax a -> Maybe ByteString
instance IdentifierNameWithStrategy 'Default syntax where
identifierNameWithStrategy _ _ = Nothing
instance (CustomIdentifierName syntax) => IdentifierNameWithStrategy 'Custom syntax where
identifierNameWithStrategy _ = customIdentifierName

View File

@ -105,7 +105,7 @@ defaultOptions = Options
}
defaultP, defaultQ :: Int
defaultP = 2
defaultP = 0
defaultQ = 3
@ -125,9 +125,9 @@ defaultFeatureVectorDecorator
defaultFeatureVectorDecorator getLabel = featureVectorDecorator . pqGramDecorator getLabel defaultP defaultQ
-- | Annotates a term with a feature vector at each node, parameterized by stem length, base width, and feature vector dimensions.
featureVectorDecorator :: (Foldable f, Functor f, Hashable label) => Term f (Record (Gram label ': fields)) -> Term f (Record (FeatureVector ': fields))
featureVectorDecorator = cata (\ (In (gram :. rest) functor) ->
termIn (foldl' addSubtermVector (unitVector (hash gram)) functor :. rest) functor)
featureVectorDecorator :: (Foldable f, Functor f, Hashable label) => Term f (Record (label ': fields)) -> Term f (Record (FeatureVector ': fields))
featureVectorDecorator = cata (\ (In (label :. rest) functor) ->
termIn (foldl' addSubtermVector (unitVector (hash label)) functor :. rest) functor)
where addSubtermVector v term = addVectors v (rhead (termAnnotation term))
-- | Annotates a term with the corresponding p,q-gram at each node.

View File

@ -373,7 +373,7 @@ fallThroughStatement :: Assignment
fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier <$> source)) <*> emptyTerm)
functionDeclaration :: Assignment
functionDeclaration = makeTerm <$> (symbol FunctionDeclaration <|> symbol FuncLiteral) <*> children (mkFunctionDeclaration <$> (identifier <|> emptyTerm) <*> manyTerm parameters <*> (types <|> identifier <|> returnParameters <|> emptyTerm) <*> (block <|> emptyTerm))
functionDeclaration = makeTerm <$> (symbol FunctionDeclaration <|> symbol FuncLiteral) <*> children (mkFunctionDeclaration <$> (term identifier <|> emptyTerm) <*> manyTerm parameters <*> (term types <|> term identifier <|> term returnParameters <|> emptyTerm) <*> (term block <|> emptyTerm))
where
mkFunctionDeclaration name' params' types' block' = Declaration.Function [types'] name' params' block'
returnParameters = makeTerm <$> symbol Parameters <*> children (manyTerm expression)
@ -388,7 +388,7 @@ indexExpression :: Assignment
indexExpression = makeTerm <$> symbol IndexExpression <*> children (Expression.Subscript <$> expression <*> manyTerm expression)
methodDeclaration :: Assignment
methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> fieldIdentifier <*> manyTerm parameters <*> ((makeTerm <$> location <*> (manyTermsTill expression (void (symbol Block)))) <|> emptyTerm) <*> (block <|> emptyTerm))
methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> term fieldIdentifier <*> manyTerm parameters <*> ((makeTerm <$> location <*> (manyTermsTill expression (void (symbol Block)))) <|> emptyTerm) <*> (term block <|> emptyTerm))
where
receiver = symbol Parameters *> children ((symbol ParameterDeclaration *> children expressions) <|> expressions)
mkTypedMethodDeclaration receiver' name' parameters' type'' body' = Declaration.Method [type''] receiver' name' parameters' body'

View File

@ -8,6 +8,7 @@ module Semantic
) where
import Analysis.ConstructorName (ConstructorName, constructorLabel)
import Analysis.IdentifierName (IdentifierName, identifierLabel)
import Analysis.Declaration (HasDeclaration, declarationAlgebra, syntaxDeclarationAlgebra)
import Analysis.Decorator (syntaxIdentifierAlgebra)
import Control.Exception
@ -49,10 +50,10 @@ parseBlobs renderer = fmap toOutput . distributeFoldMap (parseBlob renderer)
-- | A task to parse a 'Blob' and render the resulting 'Term'.
parseBlob :: TermRenderer output -> Blob -> Task output
parseBlob renderer blob@Blob{..}
| Just (SomeParser parser) <- blobLanguage >>= someParser (Proxy :: Proxy '[ConstructorName, HasDeclaration, Foldable, Functor, ToJSONFields1])
| Just (SomeParser parser) <- blobLanguage >>= someParser (Proxy :: Proxy '[ConstructorName, IdentifierName, HasDeclaration, Foldable, Functor, ToJSONFields1])
= parse parser blob >>= case renderer of
ToCTermRenderer -> decorate (declarationAlgebra blob) >=> render (renderToCTerm blob)
JSONTermRenderer -> decorate constructorLabel >=> render (renderJSONTerm blob)
JSONTermRenderer -> decorate constructorLabel >=> decorate identifierLabel >=> render (renderJSONTerm blob)
SExpressionTermRenderer -> decorate constructorLabel . (Nil <$) >=> render renderSExpressionTerm
TagsTermRenderer -> decorate (declarationAlgebra blob) >=> render (renderToTags blob)
@ -75,11 +76,11 @@ diffBlobPairs renderer = fmap toOutput . distributeFoldMap (diffBlobPair rendere
-- | A task to parse a pair of 'Blob's, diff them, and render the 'Diff'.
diffBlobPair :: DiffRenderer output -> BlobPair -> Task output
diffBlobPair renderer blobs
| Just (SomeParser parser) <- effectiveLanguage >>= qualify >>= someParser (Proxy :: Proxy '[ConstructorName, Diffable, Eq1, GAlign, HasDeclaration, Show1, ToJSONFields1, Traversable])
| Just (SomeParser parser) <- effectiveLanguage >>= qualify >>= someParser (Proxy :: Proxy '[ConstructorName, IdentifierName, Diffable, Eq1, GAlign, HasDeclaration, Show1, ToJSONFields1, Traversable])
= case renderer of
OldToCDiffRenderer -> run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob)) diffTerms renderToCDiff
ToCDiffRenderer -> run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob)) diffTerms renderToCDiff
JSONDiffRenderer -> run ( parse parser) diffTerms renderJSONDiff
JSONDiffRenderer -> run ( parse parser >=> decorate constructorLabel >=> decorate identifierLabel) diffTerms renderJSONDiff
SExpressionDiffRenderer -> run ( parse parser >=> decorate constructorLabel . (Nil <$)) diffTerms (const renderSExpressionDiff)
| Just parser <- effectiveLanguage >>= syntaxParserForLanguage
@ -96,7 +97,8 @@ diffBlobPair renderer blobs
qualify language | OldToCDiffRenderer <- renderer = guard (language `elem` aLaCarteLanguages) *> Just language
| otherwise = Just language
aLaCarteLanguages
= [ Language.JSX
= [ Language.Go
, Language.JSX
, Language.JavaScript
, Language.Markdown
, Language.Python

View File

@ -37,3 +37,16 @@ diffWithParser :: (HasField fields Data.Span.Span,
diffWithParser parser = run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob))
where
run parse blobs = bidistributeFor (runJoin blobs) parse parse >>= diffTermPair diffTerms
diffBlobWithParser :: (HasField fields Data.Span.Span,
HasField fields Range,
Eq1 syntax, Show1 syntax,
Traversable syntax, Functor syntax,
Foldable syntax, Diffable syntax,
GAlign syntax, HasDeclaration syntax)
=> Parser (Term syntax (Record fields))
-> Blob
-> Task (Term syntax (Record (Maybe Declaration : fields)))
diffBlobWithParser parser = run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob))
where
run parse sourceBlob = parse sourceBlob

View File

@ -27,6 +27,7 @@ module Data.Functor.Listable
, ListableSyntax
) where
import Analysis.CyclomaticComplexity
import Analysis.Declaration
import qualified Category
import Control.Monad.Free as Free
@ -356,6 +357,9 @@ instance Listable Declaration where
\/ cons3 FunctionDeclaration
\/ cons2 (\ a b -> ErrorDeclaration a b Nothing)
instance Listable CyclomaticComplexity where
tiers = cons1 CyclomaticComplexity
instance Listable Language.Language where
tiers
= cons0 Language.Go

View File

@ -44,8 +44,8 @@ parseFixtures =
pathMode' = Right [("test/fixtures/ruby/and-or.A.rb", Just Ruby), ("test/fixtures/ruby/and-or.B.rb", Just Ruby)]
sExpressionParseTreeOutput = "(Program\n (And\n (Identifier)\n (Identifier)))\n"
jsonParseTreeOutput = "[{\"filePath\":\"test/fixtures/ruby/and-or.A.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"And\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,12]}}],\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,12]}}],\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,1]}},\"language\":\"Ruby\"}]\n"
jsonParseTreeOutput' = "[{\"filePath\":\"test/fixtures/ruby/and-or.A.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"And\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,12]}}],\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,12]}}],\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,1]}},\"language\":\"Ruby\"},{\"filePath\":\"test/fixtures/ruby/and-or.B.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"Or\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[7,10],\"sourceSpan\":{\"start\":[1,8],\"end\":[1,11]}}],\"sourceRange\":[0,10],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,11]}},{\"category\":\"And\",\"children\":[{\"category\":\"Or\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[11,12],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,2]}},{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[16,17],\"sourceSpan\":{\"start\":[2,6],\"end\":[2,7]}}],\"sourceRange\":[11,17],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,7]}},{\"category\":\"Identifier\",\"children\":[],\"sourceRange\":[22,23],\"sourceSpan\":{\"start\":[2,12],\"end\":[2,13]}}],\"sourceRange\":[11,23],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,13]}}],\"sourceRange\":[0,24],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},\"language\":\"Ruby\"}]\n"
jsonParseTreeOutput = "[{\"filePath\":\"test/fixtures/ruby/and-or.A.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"And\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"name\":\"foo\",\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"bar\",\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,12]}}],\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,12]}}],\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,1]}},\"language\":\"Ruby\"}]\n"
jsonParseTreeOutput' = "[{\"filePath\":\"test/fixtures/ruby/and-or.A.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"And\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"name\":\"foo\",\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"bar\",\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,12]}}],\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,12]}}],\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,1]}},\"language\":\"Ruby\"},{\"filePath\":\"test/fixtures/ruby/and-or.B.rb\",\"programNode\":{\"category\":\"Program\",\"children\":[{\"category\":\"Or\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"name\":\"foo\",\"sourceRange\":[0,3],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,4]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"bar\",\"sourceRange\":[7,10],\"sourceSpan\":{\"start\":[1,8],\"end\":[1,11]}}],\"sourceRange\":[0,10],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,11]}},{\"category\":\"And\",\"children\":[{\"category\":\"Or\",\"children\":[{\"category\":\"Identifier\",\"children\":[],\"name\":\"a\",\"sourceRange\":[11,12],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,2]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"b\",\"sourceRange\":[16,17],\"sourceSpan\":{\"start\":[2,6],\"end\":[2,7]}}],\"sourceRange\":[11,17],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,7]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"c\",\"sourceRange\":[22,23],\"sourceSpan\":{\"start\":[2,12],\"end\":[2,13]}}],\"sourceRange\":[11,23],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,13]}}],\"sourceRange\":[0,24],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}},\"language\":\"Ruby\"}]\n"
emptyJsonParseTreeOutput = "[]\n"
tocOutput = "{\"changes\":{\"test/fixtures/ruby/method-declaration.A.rb\":[{\"span\":{\"start\":[1,1],\"end\":[2,4]},\"category\":\"Method\",\"term\":\"foo\",\"changeType\":\"unchanged\"}]},\"errors\":{}}\n"
@ -58,6 +58,6 @@ diffFixtures =
]
where pathMode = Right [both ("test/fixtures/ruby/method-declaration.A.rb", Just Ruby) ("test/fixtures/ruby/method-declaration.B.rb", Just Ruby)]
jsonOutput = "{\"diff\":{\"merge\":{\"after\":{\"sourceRange\":[0,21],\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}},\"children\":[{\"merge\":{\"after\":{\"sourceRange\":[0,20],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,4]}},\"children\":[{\"merge\":{\"after\":{\"sourceRange\":[0,0],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,1]}},\"children\":[],\"before\":{\"sourceRange\":[0,0],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,1]}}}},{\"patch\":{\"replace\":[{\"children\":[],\"sourceRange\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}},{\"children\":[],\"sourceRange\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}}]}},{\"patch\":{\"insert\":{\"children\":[],\"sourceRange\":[8,9],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,10]}}}},{\"merge\":{\"after\":{\"sourceRange\":[13,16],\"sourceSpan\":{\"start\":[2,3],\"end\":[2,6]}},\"children\":[{\"patch\":{\"insert\":{\"children\":[],\"sourceRange\":[13,16],\"sourceSpan\":{\"start\":[2,3],\"end\":[2,6]}}}}],\"before\":{\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,4]}}}}],\"before\":{\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}}}],\"before\":{\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}}}},\"paths\":[\"test/fixtures/ruby/method-declaration.A.rb\",\"test/fixtures/ruby/method-declaration.B.rb\"]}\n"
jsonOutput = "{\"diff\":{\"merge\":{\"after\":{\"category\":\"Program\",\"sourceRange\":[0,21],\"sourceSpan\":{\"start\":[1,1],\"end\":[4,1]}},\"children\":[{\"merge\":{\"after\":{\"category\":\"Method\",\"sourceRange\":[0,20],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,4]}},\"children\":[{\"merge\":{\"after\":{\"category\":\"Empty\",\"sourceRange\":[0,0],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,1]}},\"children\":[],\"before\":{\"category\":\"Empty\",\"sourceRange\":[0,0],\"sourceSpan\":{\"start\":[1,1],\"end\":[1,1]}}}},{\"patch\":{\"replace\":[{\"category\":\"Identifier\",\"children\":[],\"name\":\"foo\",\"sourceRange\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}},{\"category\":\"Identifier\",\"children\":[],\"name\":\"bar\",\"sourceRange\":[4,7],\"sourceSpan\":{\"start\":[1,5],\"end\":[1,8]}}]}},{\"patch\":{\"insert\":{\"category\":\"Identifier\",\"children\":[],\"name\":\"a\",\"sourceRange\":[8,9],\"sourceSpan\":{\"start\":[1,9],\"end\":[1,10]}}}},{\"merge\":{\"after\":{\"category\":\"\",\"sourceRange\":[13,16],\"sourceSpan\":{\"start\":[2,3],\"end\":[2,6]}},\"children\":[{\"patch\":{\"insert\":{\"category\":\"Identifier\",\"children\":[],\"name\":\"baz\",\"sourceRange\":[13,16],\"sourceSpan\":{\"start\":[2,3],\"end\":[2,6]}}}}],\"before\":{\"category\":\"[]\",\"sourceRange\":[8,11],\"sourceSpan\":{\"start\":[2,1],\"end\":[2,4]}}}}],\"before\":{\"category\":\"Method\",\"sourceRange\":[0,11],\"sourceSpan\":{\"start\":[1,1],\"end\":[2,4]}}}}],\"before\":{\"category\":\"Program\",\"sourceRange\":[0,12],\"sourceSpan\":{\"start\":[1,1],\"end\":[3,1]}}}},\"paths\":[\"test/fixtures/ruby/method-declaration.A.rb\",\"test/fixtures/ruby/method-declaration.B.rb\"]}\n"
sExpressionOutput = "(Program\n (Method\n (Empty)\n { (Identifier)\n ->(Identifier) }\n {+(Identifier)+}\n (\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"

View File

@ -13,7 +13,7 @@
(
{ (Integer)
->(Integer) }
{+(Integer)+}
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) })))))
{-(Integer)-})))))

View File

@ -13,7 +13,7 @@
(
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) })))))
{+(Integer)+}
{+(Integer)+}
{-(Integer)-}
{-(Integer)-})))))

View File

@ -25,11 +25,13 @@
(
(Integer)
(Integer))))
{+(Assignment
{+(Identifier)+}
{+(Times
{+(Identifier)+}
{+(Integer)+})+})+}
(Assignment
{ (Identifier)
->(Identifier) }
(Times
{ (Identifier)
->(Identifier) }
(Integer)))
{+(Assignment
{+(Identifier)+}
{+(Plus
@ -45,16 +47,24 @@
{+(RShift
{+(Identifier)+}
{+(Integer)+})+})+}
{+(Assignment
{+(Identifier)+}
{+(DividedBy
(Assignment
{ (Identifier)
->(Identifier) }
{ (Plus
{-(Identifier)-}
{-(Integer)-})
->(DividedBy
{+(Identifier)+}
{+(Integer)+})+})+}
{+(Assignment
{+(Identifier)+}
{+(BXOr
{+(Integer)+}) })
(Assignment
{ (Identifier)
->(Identifier) }
{ (LShift
{-(Identifier)-}
{-(Integer)-})
->(BXOr
{+(Identifier)+}
{+(Integer)+})+})+}
{+(Integer)+}) })
{+(Assignment
{+(Identifier)+}
{+(Modulo
@ -78,21 +88,6 @@
{+(KeyValue
{+(Identifier)+}
{+(Integer)+})+})+})+})+})+})+}
{-(Assignment
{-(Identifier)-}
{-(Times
{-(Identifier)-}
{-(Integer)-})-})-}
{-(Assignment
{-(Identifier)-}
{-(Plus
{-(Identifier)-}
{-(Integer)-})-})-}
{-(Assignment
{-(Identifier)-}
{-(LShift
{-(Identifier)-}
{-(Integer)-})-})-}
{-(Assignment
{-(Identifier)-}
{-(RShift

View File

@ -25,19 +25,18 @@
(
(Integer)
(Integer))))
(Assignment
{ (Identifier)
->(Identifier) }
(Times
{ (Identifier)
->(Identifier) }
(Integer)))
{+(Assignment
{+(Identifier)+}
{+(Times
{+(Plus
{+(Identifier)+}
{+(Integer)+})+})+}
(Assignment
(Identifier)
{ (Times
{-(Identifier)-}
{-(Integer)-})
->(Plus
{+(Identifier)+}
{+(Integer)+}) })
{+(Assignment
{+(Identifier)+}
{+(LShift

View File

@ -22,9 +22,11 @@
->(Identifier) }
{ (Identifier)
->(Identifier) }))
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+}
(Equal
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{+(Not
{+(Equal
{+(Identifier)+}
@ -74,9 +76,6 @@
{+(BAnd
{+(Identifier)+}
{+(Identifier)+})+}
{-(Equal
{-(Identifier)-}
{-(Identifier)-})-}
{-(Not
{-(Equal
{-(Identifier)-}

View File

@ -22,9 +22,11 @@
->(Identifier) }
{ (Identifier)
->(Identifier) }))
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+}
(Equal
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) })
{+(Not
{+(Equal
{+(Identifier)+}
@ -74,9 +76,6 @@
{+(BAnd
{+(Identifier)+}
{+(Identifier)+})+}
{-(Equal
{-(Identifier)-}
{-(Identifier)-})-}
{-(Not
{-(Equal
{-(Identifier)-}

View File

@ -6,36 +6,51 @@
(Identifier)
([])
(
(Slice
(Identifier)
{ (Integer)
->(Integer) }
(Empty)
(Empty))
(Slice
(Identifier)
(Empty)
{ (Integer)
->(Integer) }
(Empty))
(Slice
(Identifier)
{ (Empty)
->(Integer) }
{ (Empty)
->(Integer) }
(Empty))
(Slice
(Identifier)
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) })
{+(Slice
{+(Identifier)+}
{+(Integer)+}
{+(Empty)+}
{+(Empty)+})+}
{+(Slice
{+(Identifier)+}
{+(Empty)+}
{+(Integer)+}
{+(Empty)+})+}
{+(Slice
{+(Identifier)+}
{+(Integer)+}
{+(Integer)+}
{+(Empty)+})+}
(Slice
{ (Identifier)
->(Identifier) }
(Integer)
(Integer)
(Empty)))))
{ (Empty)
->(Integer) }
{ (Empty)
->(Integer) })
{+(Slice
{+(Identifier)+}
{+(Integer)+}
{+(Integer)+}
{+(Empty)+})+}
{-(Slice
{-(Identifier)-}
{-(Empty)-}
{-(Integer)-}
{-(Empty)-})-}
{-(Slice
{-(Identifier)-}
{-(Empty)-}
{-(Empty)-}
{-(Empty)-})-}
{-(Slice
{-(Identifier)-}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-})-}
{-(Slice
{-(Identifier)-}
{-(Integer)-}
{-(Integer)-}
{-(Empty)-})-})))

View File

@ -6,36 +6,51 @@
(Identifier)
([])
(
(Slice
(Identifier)
{ (Integer)
->(Integer) }
(Empty)
(Empty))
(Slice
(Identifier)
(Empty)
{ (Integer)
->(Integer) }
(Empty))
(Slice
(Identifier)
{ (Integer)
->(Empty) }
{ (Integer)
->(Empty) }
(Empty))
(Slice
(Identifier)
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) })
{+(Slice
{+(Identifier)+}
{+(Integer)+}
{+(Empty)+}
{+(Empty)+})+}
{+(Slice
{+(Identifier)+}
{+(Empty)+}
{+(Integer)+}
{+(Empty)+})+}
{+(Slice
{+(Identifier)+}
{+(Empty)+}
{+(Empty)+}
{+(Empty)+})+}
(Slice
{ (Identifier)
->(Identifier) }
(Integer)
(Integer)
(Empty)))))
{ (Empty)
->(Integer) }
{ (Empty)
->(Integer) })
{+(Slice
{+(Identifier)+}
{+(Integer)+}
{+(Integer)+}
{+(Empty)+})+}
{-(Slice
{-(Identifier)-}
{-(Empty)-}
{-(Integer)-}
{-(Empty)-})-}
{-(Slice
{-(Identifier)-}
{-(Integer)-}
{-(Integer)-}
{-(Empty)-})-}
{-(Slice
{-(Identifier)-}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-})-}
{-(Slice
{-(Identifier)-}
{-(Integer)-}
{-(Integer)-}
{-(Empty)-})-})))

View File

@ -8,24 +8,33 @@
(
{ (Identifier)
->(Identifier) }
(Negate
{ (Identifier)
->(Identifier) })
(Not
(ReceiveOperator
{ (Identifier)
->(Identifier) }))
(Pointer
(Call
{ (Identifier)
->(Identifier) }
(Empty)))
(Complement
{ (Identifier)
->(Identifier) })
(Reference
{ (Identifier)
->(Identifier) })
(ReceiveOperator
{ (Identifier)
->(Identifier) }))))
{+(Negate
{+(Identifier)+})+}
{+(Not
{+(ReceiveOperator
{+(Identifier)+})+})+}
{+(Pointer
{+(Call
{+(Identifier)+}
{+(Empty)+})+})+}
{+(Complement
{+(Identifier)+})+}
{+(Reference
{+(Identifier)+})+}
{+(ReceiveOperator
{+(Identifier)+})+}
{-(Negate
{-(Identifier)-})-}
{-(Not
{-(ReceiveOperator
{-(Identifier)-})-})-}
{-(Pointer
{-(Call
{-(Identifier)-}
{-(Empty)-})-})-}
{-(Complement
{-(Identifier)-})-}
{-(Reference
{-(Identifier)-})-}
{-(ReceiveOperator
{-(Identifier)-})-})))

View File

@ -8,24 +8,33 @@
(
{ (Identifier)
->(Identifier) }
(Negate
{ (Identifier)
->(Identifier) })
(Not
(ReceiveOperator
{ (Identifier)
->(Identifier) }))
(Pointer
(Call
{ (Identifier)
->(Identifier) }
(Empty)))
(Complement
{ (Identifier)
->(Identifier) })
(Reference
{ (Identifier)
->(Identifier) })
(ReceiveOperator
{ (Identifier)
->(Identifier) }))))
{+(Negate
{+(Identifier)+})+}
{+(Not
{+(ReceiveOperator
{+(Identifier)+})+})+}
{+(Pointer
{+(Call
{+(Identifier)+}
{+(Empty)+})+})+}
{+(Complement
{+(Identifier)+})+}
{+(Reference
{+(Identifier)+})+}
{+(ReceiveOperator
{+(Identifier)+})+}
{-(Negate
{-(Identifier)-})-}
{-(Not
{-(ReceiveOperator
{-(Identifier)-})-})-}
{-(Pointer
{-(Call
{-(Identifier)-}
{-(Empty)-})-})-}
{-(Complement
{-(Identifier)-})-}
{-(Reference
{-(Identifier)-})-}
{-(ReceiveOperator
{-(Identifier)-})-})))

View File

@ -1,30 +1,22 @@
(Program
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(ExportClause
{-(ImportExportSpecifier
@ -73,15 +65,15 @@
(Identifier)
{ (Empty)
->(Identifier) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}))
(Empty))))
(Export
{ (Identifier)
->(Identifier) })

View File

@ -1,28 +1,22 @@
(Program
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(ExportClause
{+(ImportExportSpecifier
@ -71,11 +65,14 @@
(Identifier)
{ (Identifier)
->(Empty) })
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
@ -119,18 +116,14 @@
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty)))
{ (TextElement)
->(TextElement) })
(Export

View File

@ -10,14 +10,18 @@
{ (Identifier)
->(Identifier) }
(Integer))
(Assignment
{ (
{+(Assignment
{+(Identifier)+}
{+(
{+(Integer)+}
{+(Integer)+})+})+}
{-(Assignment
{-(
{-(Identifier)-}
{-(Identifier)-})
->(Identifier) }
(
(Integer)
(Integer)))
{-(Identifier)-})-}
{-(
{-(Integer)-}
{-(Integer)-})-})-}
{-(Assignment
{-(Identifier)-}
{-(

View File

@ -10,13 +10,14 @@
{-(Integer)-}
(Integer)
{+(Integer)+}))
(Assignment
{ (Identifier)
->(Identifier) }
{ (Integer)
->(
{+(Assignment
{+(Identifier)+}
{+(
{+(Integer)+}
{+(Integer)+}) })
{+(Integer)+})+})+}
{-(Assignment
{-(Identifier)-}
{-(Integer)-})-}
{-(Assignment
{-(Identifier)-}
{-(

View File

@ -7,21 +7,21 @@
->(RShift
{+(Identifier)+}
{+(Integer)+}) })
(Assignment
{ (Identifier)
->(Identifier) }
{ (RShift
{-(Identifier)-}
{-(Integer)-})
->(DividedBy
{+(Assignment
{+(Identifier)+}
{+(DividedBy
{+(Identifier)+}
{+(Integer)+}) })
{+(Integer)+})+})+}
(Assignment
{ (Identifier)
->(Identifier) }
{ (DividedBy
(Identifier)
{ (RShift
{-(Identifier)-}
{-(Integer)-})
->(Plus
{+(Identifier)+}
{+(Integer)+}) }))
{+(Integer)+}) })
{-(Assignment
{-(Identifier)-}
{-(DividedBy
{-(Identifier)-}
{-(Integer)-})-})-})

View File

@ -7,21 +7,23 @@
->(Plus
{+(Identifier)+}
{+(Integer)+}) })
(Assignment
{ (Identifier)
->(Identifier) }
{ (DividedBy
{-(Identifier)-}
{-(Integer)-})
->(RShift
{+(Assignment
{+(Identifier)+}
{+(RShift
{+(Identifier)+}
{+(Integer)+}) })
(Assignment
{ (Identifier)
->(Identifier) }
{ (Plus
{-(Identifier)-}
{-(Integer)-})
->(DividedBy
{+(Integer)+})+})+}
{+(Assignment
{+(Identifier)+}
{+(DividedBy
{+(Identifier)+}
{+(Integer)+}) }))
{+(Integer)+})+})+}
{-(Assignment
{-(Identifier)-}
{-(DividedBy
{-(Identifier)-}
{-(Integer)-})-})-}
{-(Assignment
{-(Identifier)-}
{-(Plus
{-(Identifier)-}
{-(Integer)-})-})-})

View File

@ -26,18 +26,21 @@
(Modulo
(Identifier)
(Identifier))
{+(Power
{+(Identifier)+}
{+(Identifier)+})+}
{+(DividedBy
{+(Identifier)+}
{+(Identifier)+})+}
{ (DividedBy
{-(Identifier)-}
{-(Identifier)-})
->(Modulo
->(Power
{+(Identifier)+}
{+(Identifier)+}) }
{ (Power
{-(Identifier)-}
{-(Identifier)-})
->(DividedBy
{+(Identifier)+}
{+(Identifier)+}) }
{+(Modulo
{+(Identifier)+}
{+(Identifier)+})+}
{+(DividedBy
{+(Identifier)+}
{+(Identifier)+})+}
@ -50,9 +53,6 @@
{+(Plus
{+(Identifier)+}
{+(Identifier)+})+}
{-(Power
{-(Identifier)-}
{-(Identifier)-})-}
{-(BOr
{-(Identifier)-}
{-(Identifier)-})-}

View File

@ -26,12 +26,18 @@
(Modulo
(Identifier)
(Identifier))
{+(DividedBy
{ (Power
{-(Identifier)-}
{-(Identifier)-})
->(DividedBy
{+(Identifier)+}
{+(Identifier)+})+}
{+(Power
{+(Identifier)+}) }
{ (DividedBy
{-(Identifier)-}
{-(Identifier)-})
->(Power
{+(Identifier)+}
{+(Identifier)+})+}
{+(Identifier)+}) }
{+(BOr
{+(Identifier)+}
{+(Identifier)+})+}
@ -47,12 +53,6 @@
{+(RShift
{+(Identifier)+}
{+(Identifier)+})+}
{-(Power
{-(Identifier)-}
{-(Identifier)-})-}
{-(DividedBy
{-(Identifier)-}
{-(Identifier)-})-}
{-(Modulo
{-(Identifier)-}
{-(Identifier)-})-}

View File

@ -5,40 +5,38 @@
{+(LessThanEqual
{+(Identifier)+}
{+(Identifier)+})+}
{+(Not
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+})+}
{+(GreaterThanEqual
{+(Identifier)+}
{+(Identifier)+})+}
{+(GreaterThan
{+(Identifier)+}
{+(Identifier)+})+}
(Not
(Equal
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
{+(GreaterThanEqual
{+(Identifier)+}
{+(Identifier)+})+}
{+(GreaterThan
{+(Identifier)+}
{+(Identifier)+})+}
{+(Not
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+})+}
{+(Member
{+(Identifier)+}
{+(Identifier)+})+}
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+}
{+(Not
{+(Member
{+(Identifier)+}
{+(Identifier)+})+})+}
(Not
(Member
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }))
{+(Not
{+(Equal
{+(Identifier)+}
{+(Identifier)+})+})+}
{-(Not
{-(Member
{-(Identifier)-}
{-(Identifier)-})-})-}
{-(Equal
{-(Identifier)-}
{-(Identifier)-})-}

View File

@ -7,13 +7,13 @@
{+(Float)+}
{+(Float)+}
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{+(Float)+}
{-(Float)-}
{-(Float)-}
{-(Float)-}

View File

@ -6,10 +6,8 @@
->(Float) }
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
{ (Float)
->(Float) }
{+(Float)+}
{+(Float)+}
{+(Float)+}
{ (Float)
->(Float) }
@ -19,4 +17,6 @@
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-}
{-(Float)-})

View File

@ -9,14 +9,14 @@
{+(Negate
{+(Integer)+})+}
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{-(Integer)-}
{-(Integer)-}
{-(Negate
{-(Integer)-})-}

View File

@ -9,15 +9,15 @@
{+(Negate
{+(Integer)+})+}
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{ (Integer)
->(Integer) }
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{-(Integer)-}
{-(Negate
{-(Integer)-})-}
{-(Integer)-}

View File

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

View File

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

View File

@ -1,11 +1,10 @@
(Program
{+(Complement
{+(Identifier)+})+}
{+(Negate
{+(Identifier)+})+}
{+(Identifier)+}
{-(Negate
{-(Identifier)-})-}
{-(Identifier)-}
(Negate
{ (Identifier)
->(Identifier) })
{ (Identifier)
->(Identifier) }
{-(Complement
{-(Identifier)-})-})

View File

@ -3,10 +3,10 @@
{+(TextElement)+}
{+(TextElement)+}
{+(TextElement)+}
{ (TextElement)
->(TextElement) }
{ (TextElement)
->(TextElement) }
{+(TextElement)+}
{+(TextElement)+}
{-(TextElement)-}
{-(TextElement)-}
{-(TextElement)-}
{-(TextElement)-}
{-(TextElement)-}

View File

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

View File

@ -1,20 +1,23 @@
(Program
(Hash
(KeyValue
{ (Symbol)
->(Identifier) }
{ (TextElement)
->(TextElement) })
(KeyValue
{ (Symbol)
->(Identifier) }
{ (Integer)
->(Integer) })
(KeyValue
{ (TextElement)
->(Identifier) }
{ (Boolean)
->(Boolean) })
{+(KeyValue
{+(Identifier)+}
{+(TextElement)+})+}
{+(KeyValue
{+(Identifier)+}
{+(Integer)+})+}
{+(KeyValue
{+(Identifier)+}
{+(Boolean)+})+}
{-(KeyValue
{-(Symbol)-}
{-(TextElement)-})-}
{-(KeyValue
{-(Symbol)-}
{-(Integer)-})-}
{-(KeyValue
{-(TextElement)-}
{-(Boolean)-})-}
{-(KeyValue
{-(Symbol)-}
{-(Integer)-})-})

View File

@ -1,23 +1,25 @@
(Program
(Hash
(KeyValue
{ (Identifier)
->(Symbol) }
{ (TextElement)
->(TextElement) })
(KeyValue
{ (Identifier)
->(Symbol) }
{ (Integer)
->(Integer) })
{+(KeyValue
{+(Symbol)+}
{+(TextElement)+})+}
{+(KeyValue
{+(Symbol)+}
{+(Integer)+})+}
(KeyValue
{ (Identifier)
->(TextElement) }
{ (Boolean)
{ (TextElement)
->(Boolean) })
{+(KeyValue
{+(Symbol)+}
{+(Integer)+})+})
{+(Integer)+})+}
{-(KeyValue
{-(Identifier)-}
{-(Integer)-})-}
{-(KeyValue
{-(Identifier)-}
{-(Boolean)-})-})
{+(Hash)+}
{+(Hash
{+(Context

View File

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

View File

@ -3,13 +3,13 @@
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{+(Integer)+}
{ (Integer)
->(Integer) }
{ (Integer)
->(Integer) }
{+(Float)+}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Integer)-}
{-(Float)-})

View File

@ -1,7 +1,7 @@
(Program
{ (Symbol)
->(Symbol) }
{+(Symbol)+}
{ (Symbol)
->(Symbol) }
{+(Symbol)+}
{-(Symbol)-}
{-(Symbol)-})

View File

@ -1,7 +1,7 @@
(Program
{+(Symbol)+}
{ (Symbol)
->(Symbol) }
{ (Symbol)
->(Symbol) }
{+(Symbol)+}
{+(Symbol)+}
{-(Symbol)-}
{-(Symbol)-})

View File

@ -1,30 +1,22 @@
(Program
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(ExportClause
{-(ImportExportSpecifier
@ -73,15 +65,15 @@
(Identifier)
{ (Empty)
->(Identifier) })
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}))
(Empty))))
(Export
{ (Identifier)
->(Identifier) })

View File

@ -1,28 +1,22 @@
(Program
(Export
(ExportClause
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))))
(Export
(ExportClause
{+(ImportExportSpecifier
@ -71,11 +65,14 @@
(Identifier)
{ (Identifier)
->(Empty) })
(Assignment
(Empty)
{ (Identifier)
->(Identifier) }
(Empty))
{+(Assignment
{+(Empty)+}
{+(Identifier)+}
{+(Empty)+})+}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
{-(Empty)-})-}
{-(Assignment
{-(Empty)-}
{-(Identifier)-}
@ -119,18 +116,14 @@
{ (Identifier)
->(Identifier) }
(Empty))
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{+(ImportExportSpecifier
{+(Identifier)+}
{+(Empty)+})+}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-}
{-(ImportExportSpecifier
{-(Identifier)-}
{-(Empty)-})-})
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty))
(ImportExportSpecifier
{ (Identifier)
->(Identifier) }
(Empty)))
{ (TextElement)
->(TextElement) })
(Export