mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Rename Data.Syntax.Assignment to Assigning.Assignment.
This commit is contained in:
parent
062d9cbfa9
commit
9bfd64905d
@ -13,7 +13,9 @@ cabal-version: >=1.10
|
|||||||
|
|
||||||
library
|
library
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
exposed-modules: Category
|
exposed-modules: Assigning.Assignment
|
||||||
|
, Assigning.Assignment.Table
|
||||||
|
, Category
|
||||||
, Data.Align.Generic
|
, Data.Align.Generic
|
||||||
, Data.Blob
|
, Data.Blob
|
||||||
, Data.Diff
|
, Data.Diff
|
||||||
@ -32,8 +34,6 @@ library
|
|||||||
, Data.Span
|
, Data.Span
|
||||||
, Data.SplitDiff
|
, Data.SplitDiff
|
||||||
, Data.Syntax
|
, Data.Syntax
|
||||||
, Data.Syntax.Assignment
|
|
||||||
, Data.Syntax.Assignment.Table
|
|
||||||
, Data.Syntax.Comment
|
, Data.Syntax.Comment
|
||||||
, Data.Syntax.Declaration
|
, Data.Syntax.Declaration
|
||||||
, Data.Syntax.Expression
|
, Data.Syntax.Expression
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
-- AST symbols are classified by their 'symbolType' as either 'Regular', 'Anonymous', or 'Auxiliary'. 'Auxiliary' never appears in ASTs; 'Regular' is for the symbols of explicitly named productions in the grammar, and 'Anonymous' is for unnamed productions of content such as tokens. Most of the time, assignments are only concerned with the named productions, and thus will be using 'Regular' symbols. Therefore, when matching a committed choice of all-'Regular' symbols, nodes with 'Anonymous' symbols will be skipped. However, in some cases grammars don’t provide a named symbol for e.g. every kind of infix operator, and thus the only way to differentiate between them is by means of a 'symbol' rule for an 'Anonymous' token. In these cases, and before every other kind of assignment, the 'Anonymous' nodes will not be skipped so that matching can succeed.
|
-- AST symbols are classified by their 'symbolType' as either 'Regular', 'Anonymous', or 'Auxiliary'. 'Auxiliary' never appears in ASTs; 'Regular' is for the symbols of explicitly named productions in the grammar, and 'Anonymous' is for unnamed productions of content such as tokens. Most of the time, assignments are only concerned with the named productions, and thus will be using 'Regular' symbols. Therefore, when matching a committed choice of all-'Regular' symbols, nodes with 'Anonymous' symbols will be skipped. However, in some cases grammars don’t provide a named symbol for e.g. every kind of infix operator, and thus the only way to differentiate between them is by means of a 'symbol' rule for an 'Anonymous' token. In these cases, and before every other kind of assignment, the 'Anonymous' nodes will not be skipped so that matching can succeed.
|
||||||
--
|
--
|
||||||
-- Therefore, in addition to the rule of thumb for committed choices (see above), try to match 'Regular' symbols up front, and only match 'Anonymous' ones in the middle of a chain. That will ensure that you don’t have to make redundant effort to explicitly skip 'Anonymous' nodes ahead of multiple alternatives, and can instead rely on them being automatically skipped except when explicitly required.
|
-- Therefore, in addition to the rule of thumb for committed choices (see above), try to match 'Regular' symbols up front, and only match 'Anonymous' ones in the middle of a chain. That will ensure that you don’t have to make redundant effort to explicitly skip 'Anonymous' nodes ahead of multiple alternatives, and can instead rely on them being automatically skipped except when explicitly required.
|
||||||
module Data.Syntax.Assignment
|
module Assigning.Assignment
|
||||||
-- Types
|
-- Types
|
||||||
( Assignment
|
( Assignment
|
||||||
, Location
|
, Location
|
||||||
@ -95,6 +95,7 @@ module Data.Syntax.Assignment
|
|||||||
, module Parsers
|
, module Parsers
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Assigning.Assignment.Table as Table
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad ((<=<), guard)
|
import Control.Monad ((<=<), guard)
|
||||||
import Control.Monad.Error.Class hiding (Error)
|
import Control.Monad.Error.Class hiding (Error)
|
||||||
@ -112,7 +113,6 @@ import Data.Maybe
|
|||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Semigroup
|
import Data.Semigroup
|
||||||
import qualified Data.Source as Source (Source, slice, sourceBytes)
|
import qualified Data.Source as Source (Source, slice, sourceBytes)
|
||||||
import qualified Data.Syntax.Assignment.Table as Table
|
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import GHC.Stack
|
import GHC.Stack
|
||||||
import qualified Info
|
import qualified Info
|
@ -1,4 +1,4 @@
|
|||||||
module Data.Syntax.Assignment.Table
|
module Assigning.Assignment.Table
|
||||||
( Table(tableAddresses)
|
( Table(tableAddresses)
|
||||||
, singleton
|
, singleton
|
||||||
, fromListWith
|
, fromListWith
|
@ -1,6 +1,7 @@
|
|||||||
{-# LANGUAGE DeriveAnyClass, GADTs, TypeOperators #-}
|
{-# LANGUAGE DeriveAnyClass, GADTs, TypeOperators #-}
|
||||||
module Data.Syntax where
|
module Data.Syntax where
|
||||||
|
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Diffing.Algorithm hiding (Empty)
|
import Diffing.Algorithm hiding (Empty)
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad.Error.Class hiding (Error)
|
import Control.Monad.Error.Class hiding (Error)
|
||||||
@ -19,7 +20,6 @@ import Data.Range
|
|||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Semigroup
|
import Data.Semigroup
|
||||||
import Data.Span
|
import Data.Span
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import Data.Union
|
import Data.Union
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
|
@ -6,11 +6,11 @@ module Language.JSON.Assignment
|
|||||||
, Term)
|
, Term)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
import Assigning.Assignment hiding (Assignment, Error)
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Syntax (makeTerm, parseError)
|
import Data.Syntax (makeTerm, parseError)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import qualified Data.Syntax.Literal as Literal
|
import qualified Data.Syntax.Literal as Literal
|
||||||
import qualified Data.Term as Term
|
import qualified Data.Term as Term
|
||||||
import Data.Union
|
import Data.Union
|
||||||
|
@ -6,14 +6,14 @@ module Language.Markdown.Assignment
|
|||||||
, Language.Markdown.Assignment.Term
|
, Language.Markdown.Assignment.Term
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Assigning.Assignment hiding (Assignment, Error)
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import qualified CMarkGFM
|
import qualified CMarkGFM
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import Data.Functor (void)
|
import Data.Functor (void)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Syntax (makeTerm)
|
import Data.Syntax (makeTerm)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import Data.Term as Term (Term(..), TermF(..), termFAnnotation, termFOut, termIn)
|
import Data.Term as Term (Term(..), TermF(..), termFAnnotation, termFOut, termIn)
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
import Data.Text.Encoding (encodeUtf8)
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
|
@ -6,14 +6,14 @@ module Language.Python.Assignment
|
|||||||
, Term
|
, Term
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Assigning.Assignment hiding (Assignment, Error)
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Data.Functor (void)
|
import Data.Functor (void)
|
||||||
import Data.List.NonEmpty (some1)
|
import Data.List.NonEmpty (some1)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm1, parseError, postContextualize)
|
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm1, parseError, postContextualize)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import qualified Data.Syntax.Comment as Comment
|
import qualified Data.Syntax.Comment as Comment
|
||||||
import qualified Data.Syntax.Declaration as Declaration
|
import qualified Data.Syntax.Declaration as Declaration
|
||||||
import qualified Data.Syntax.Expression as Expression
|
import qualified Data.Syntax.Expression as Expression
|
||||||
|
@ -6,14 +6,14 @@ module Language.Ruby.Assignment
|
|||||||
, Term
|
, Term
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Assigning.Assignment hiding (Assignment, Error)
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Functor (void)
|
import Data.Functor (void)
|
||||||
import Data.List.NonEmpty (some1)
|
import Data.List.NonEmpty (some1)
|
||||||
import Data.Syntax (contextualize, postContextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm1)
|
import Data.Syntax (contextualize, postContextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm1)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import qualified Data.Syntax.Comment as Comment
|
import qualified Data.Syntax.Comment as Comment
|
||||||
import qualified Data.Syntax.Declaration as Declaration
|
import qualified Data.Syntax.Declaration as Declaration
|
||||||
import qualified Data.Syntax.Expression as Expression
|
import qualified Data.Syntax.Expression as Expression
|
||||||
|
@ -6,12 +6,12 @@ module Language.TypeScript.Assignment
|
|||||||
, Term
|
, Term
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Assigning.Assignment hiding (Assignment, Error)
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Data.Maybe (fromMaybe, catMaybes)
|
import Data.Maybe (fromMaybe, catMaybes)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Syntax (emptyTerm, handleError, parseError, infixContext, makeTerm, makeTerm', makeTerm1, contextualize, postContextualize)
|
import Data.Syntax (emptyTerm, handleError, parseError, infixContext, makeTerm, makeTerm', makeTerm1, contextualize, postContextualize)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import qualified Data.Syntax.Comment as Comment
|
import qualified Data.Syntax.Comment as Comment
|
||||||
import qualified Data.Syntax.Declaration as Declaration
|
import qualified Data.Syntax.Declaration as Declaration
|
||||||
import qualified Data.Syntax.Expression as Expression
|
import qualified Data.Syntax.Expression as Expression
|
||||||
|
@ -20,7 +20,7 @@ import Data.Kind
|
|||||||
import Data.Ix
|
import Data.Ix
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import Data.Syntax.Assignment
|
import Assigning.Assignment
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import Data.Union
|
import Data.Union
|
||||||
import Foreign.Ptr
|
import Foreign.Ptr
|
||||||
|
@ -9,7 +9,7 @@ import CMarkGFM
|
|||||||
import Data.Ix
|
import Data.Ix
|
||||||
import Data.Source
|
import Data.Source
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import qualified Data.Syntax.Assignment as A (AST, Node(..))
|
import qualified Assigning.Assignment as A (AST, Node(..))
|
||||||
import Info
|
import Info
|
||||||
import TreeSitter.Language (Symbol(..), SymbolType(..))
|
import TreeSitter.Language (Symbol(..), SymbolType(..))
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ module Parser.TreeSitter
|
|||||||
, parseToAST
|
, parseToAST
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Assigning.Assignment as A
|
||||||
import Category
|
import Category
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad ((<=<))
|
import Control.Monad ((<=<))
|
||||||
@ -15,7 +16,6 @@ import Data.Range
|
|||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Source
|
import Data.Source
|
||||||
import Data.Span
|
import Data.Span
|
||||||
import qualified Data.Syntax.Assignment as A
|
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import Data.Text (Text, pack)
|
import Data.Text (Text, pack)
|
||||||
import Language
|
import Language
|
||||||
|
@ -25,6 +25,7 @@ module Semantic.Task
|
|||||||
, runTaskWithOptions
|
, runTaskWithOptions
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Assigning.Assignment as Assignment
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad.Error.Class
|
import Control.Monad.Error.Class
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
@ -41,7 +42,6 @@ import Data.Functor.Both as Both hiding (snd)
|
|||||||
import Data.Functor.Foldable (cata)
|
import Data.Functor.Foldable (cata)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import qualified Data.Syntax.Assignment as Assignment
|
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import Data.Union
|
import Data.Union
|
||||||
import Decorator (RAlgebra, decoratorWithAlgebra)
|
import Decorator (RAlgebra, decoratorWithAlgebra)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
module Data.Syntax.Assignment.Spec where
|
module Data.Syntax.Assignment.Spec where
|
||||||
|
|
||||||
|
import Assigning.Assignment
|
||||||
import Data.Bifunctor (first)
|
import Data.Bifunctor (first)
|
||||||
import Data.ByteString.Char8 as B (ByteString, length, words)
|
import Data.ByteString.Char8 as B (ByteString, length, words)
|
||||||
import Data.Ix
|
import Data.Ix
|
||||||
@ -8,7 +9,6 @@ import Data.Range
|
|||||||
import Data.Semigroup ((<>))
|
import Data.Semigroup ((<>))
|
||||||
import Data.Source
|
import Data.Source
|
||||||
import Data.Span
|
import Data.Span
|
||||||
import Data.Syntax.Assignment
|
|
||||||
import Data.Term
|
import Data.Term
|
||||||
import GHC.Stack (getCallStack)
|
import GHC.Stack (getCallStack)
|
||||||
import Prelude hiding (words)
|
import Prelude hiding (words)
|
||||||
|
Loading…
Reference in New Issue
Block a user