| Copyright | (C) 2026 - Eitan Chatav |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Eitan Chatav <eitan.chatav@gmail.com> |
| Stability | provisional |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Lens.Grammar.TypeScript
Contents
Description
TypeScript's declaration files, .d.ts, like the TypeScript compiler,
in two layers: tsTokensGrammar of their tokens, by their
TsTokenCategorys, & tsGrammar of their declarations, of those tokens,
by the compiler's names of their nodes, so that they parse & print
together.
Both layers parse by parsecG & print by unparsecG, locating failures,
since tsTokensGrammar scans tokens without their trivia, as the compiler
does. tsGrammar isn't LL(1): it backtracks, by try, where TypeScript's
syntax needs more lookahead. Here, a declaration prints as tokens,
& as characters, & parses back.
>>>:set -XOverloadedStrings>>>let point = ObjectType [PropertySignature [] (PropertyIdentifier "x") False (Just (KeywordType NumberKeyword))]>>>let printed = unparsecG tsGrammar [TypeAliasDeclaration [ExportKeyword] "Point" [] point] ([] :: [TsToken])>>>let source = parsecStream (unparsecG tsTokensGrammar (parsecStream printed) ("" :: String))>>>putStr sourceexport type Point = { x: number };>>>parsecResult (parsecG tsGrammar (concat (parsecResult (parsecG tsTokensGrammar source)))) == Just [TypeAliasDeclaration [ExportKeyword] "Point" [] point]True
Synopsis
- tsGrammar :: CtxGrammar TsToken [TsDeclaration]
- tsTokenGrammar :: RegGrammar Char TsToken
- tsTokensGrammar :: CtxGrammar Char [TsToken]
- data TsDeclaration
- = TypeAliasDeclaration [TsTokenCategory] Text [TsTypeParameter] TsType
- | InterfaceDeclaration [TsTokenCategory] Text [TsTypeParameter] [TsHeritage] [TsProperty]
- | ClassDeclaration [TsTokenCategory] Text [TsTypeParameter] (Maybe TsHeritage) [TsHeritage] [TsProperty]
- | FunctionDeclaration [TsTokenCategory] Text TsSignature
- | VariableStatement [TsTokenCategory] TsTokenCategory [TsVariableDeclaration]
- | EnumDeclaration [TsTokenCategory] Text [TsEnumMember]
- | ModuleDeclaration [TsTokenCategory] TsModuleName (Maybe [TsDeclaration])
- | ImportDeclaration Bool (Maybe TsImportClause) Text
- | ImportEqualsDeclaration [TsTokenCategory] Bool Text TsModuleReference
- | ExportDeclaration Bool TsExportClause (Maybe Text)
- | ExportAssignment Bool TsEntityName
- | NamespaceExportDeclaration Text
- data TsModuleName
- data TsImportClause = TsImportClause (Maybe Text) (Maybe TsNamedBindings)
- data TsNamedBindings
- data TsImportSpecifier = TsImportSpecifier Bool (Maybe Text) Text
- data TsModuleReference
- data TsExportClause
- data TsVariableDeclaration = TsVariableDeclaration Text (Maybe TsType) (Maybe TsLiteral)
- data TsEnumMember = TsEnumMember TsPropertyName (Maybe TsLiteral)
- data TsHeritage = TsHeritage TsEntityName [TsType]
- type TsEntityName = [Text]
- data TsType
- = KeywordType TsTokenCategory
- | ThisType
- | LiteralType TsLiteral
- | ReferenceType TsEntityName [TsType]
- | ArrayType TsType
- | TupleType [TsType]
- | OptionalType TsType
- | RestType TsType
- | NamedTupleMember Bool Text Bool TsType
- | UnionType [TsType]
- | IntersectionType [TsType]
- | ParenthesizedType TsType
- | FunctionType TsSignature
- | ConstructorType Bool TsSignature
- | TypeOperator TsTokenCategory TsType
- | IndexedAccessType TsType TsType
- | TypeQuery TsEntityName [TsType]
- | ImportType Bool Text TsEntityName [TsType]
- | InferType Text (Maybe TsType)
- | TypePredicate Bool Text (Maybe TsType)
- | ObjectType [TsProperty]
- | MappedType (Maybe TsTokenCategory) Text TsType (Maybe TsType) (Maybe TsTokenCategory) TsType
- | ConditionalType TsType TsType TsType TsType
- | TemplateLiteralType Text [(TsType, Text)]
- data TsProperty
- = PropertySignature [TsTokenCategory] TsPropertyName Bool (Maybe TsType)
- | MethodSignature [TsTokenCategory] TsPropertyName Bool TsSignature
- | CallSignature TsSignature
- | ConstructSignature TsSignature
- | IndexSignature [TsTokenCategory] Text TsType TsType
- | GetAccessor [TsTokenCategory] TsPropertyName (Maybe TsType)
- | SetAccessor [TsTokenCategory] TsPropertyName TsParameter
- | Constructor [TsTokenCategory] [TsParameter]
- data TsPropertyName
- data TsLiteral
- data TsTypeParameter = TsTypeParameter [TsTokenCategory] Text (Maybe TsType) (Maybe TsType)
- data TsSignature = TsSignature [TsTypeParameter] [TsParameter] (Maybe TsType)
- data TsParameter = TsParameter Bool TsBindingName Bool (Maybe TsType)
- data TsBindingName
- data TsBindingElement = TsBindingElement Bool (Maybe TsPropertyName) TsBindingName
- data TsToken = TsToken {}
- data TsTokenCategory
- = WhitespaceTrivia
- | NewLineTrivia
- | SingleLineCommentTrivia
- | MultiLineCommentTrivia
- | Identifier
- | PrivateIdentifier
- | StringLiteral
- | NumericLiteral
- | BigIntLiteral
- | NoSubstitutionTemplateLiteral
- | TemplateHead
- | TemplateMiddle
- | TemplateTail
- | OpenBraceToken
- | CloseBraceToken
- | OpenParenToken
- | CloseParenToken
- | OpenBracketToken
- | CloseBracketToken
- | DotToken
- | DotDotDotToken
- | SemicolonToken
- | CommaToken
- | LessThanToken
- | GreaterThanToken
- | QuestionToken
- | ColonToken
- | EqualsToken
- | EqualsGreaterThanToken
- | BarToken
- | AmpersandToken
- | MinusToken
- | PlusToken
- | AsteriskToken
- | ExclamationToken
- | ClassKeyword
- | ConstKeyword
- | DefaultKeyword
- | EnumKeyword
- | ExportKeyword
- | ExtendsKeyword
- | FalseKeyword
- | FunctionKeyword
- | ImportKeyword
- | InKeyword
- | NewKeyword
- | NullKeyword
- | ThisKeyword
- | TrueKeyword
- | TypeOfKeyword
- | VarKeyword
- | VoidKeyword
- | AbstractKeyword
- | AccessorKeyword
- | AnyKeyword
- | AsKeyword
- | AssertsKeyword
- | BigIntKeyword
- | BooleanKeyword
- | ConstructorKeyword
- | DeclareKeyword
- | FromKeyword
- | GetKeyword
- | GlobalKeyword
- | ImplementsKeyword
- | InferKeyword
- | InterfaceKeyword
- | IntrinsicKeyword
- | IsKeyword
- | KeyOfKeyword
- | LetKeyword
- | ModuleKeyword
- | NamespaceKeyword
- | NeverKeyword
- | NumberKeyword
- | ObjectKeyword
- | OutKeyword
- | OverrideKeyword
- | PrivateKeyword
- | ProtectedKeyword
- | PublicKeyword
- | ReadonlyKeyword
- | RequireKeyword
- | SetKeyword
- | StaticKeyword
- | StringKeyword
- | SymbolKeyword
- | TypeKeyword
- | UndefinedKeyword
- | UniqueKeyword
- | UnknownKeyword
Grammar
tsGrammar :: CtxGrammar TsToken [TsDeclaration] Source #
The declarations of a declaration file, of tokens, by the TypeScript
compiler's syntax, printed one per line, indented within blocks, & with
object types on one line. Trivia print conventionally, & parse only
from tokens with trivia, by parseG, since tsTokensGrammar scans
without them. Its ;s print, & parse if they're there.
It's a CtxGrammar by try, rather than by monadic bonding, since it
isn't LL(1): TypeScript's syntax needs more lookahead in places,
where it backtracks by try: declarations' & members' modifiers, imports'
forms & their type & as, comma-separated lists after their first item,
members' signatures, constructors & accessors, a binding's name before
its :, type parameters' modifiers, asserts & is predicates,
function, conditional, typeof import, mapped & named tuple member types.
Printing a file, of many tokens, is linear into a stream which grows
at its end in constant time, like a Seq, rather than
a list.
tsTokenGrammar :: RegGrammar Char TsToken Source #
A token, scanned from its characters. Its trivia, whitespace,
newlines & comments, are tokens, as the scanner of the TypeScript compiler
scans without skipping them. A } is never a template's middle or tail,
which tsTokensGrammar rescans in its context, as the compiler's parser
rescans it.
A number is spelled by its digits, letters, separators & points,
as in 0xFF, 1_000.5 or 1n, but not by a signed exponent.
It's a RegGrammar, since each token's spelling is a regular language.
tsTokensGrammar :: CtxGrammar Char [TsToken] Source #
Tokens, scanned from their characters without their trivia,
as the TypeScript compiler's scanner skips trivia, & printed with them,
as tsGrammar prints them, so that tsGrammar parses by parsecG.
A } which closes a template's substitution is scanned as the template's
middle or tail, by the depth of braces within the substitutions open,
as the compiler's parser rescans it.
It's a CtxGrammar by monadic bonding: each token is scanned in the
context of the tokens before it, whose braces & templates bond, by
P.>>=, the depths that a } is scanned by.
Declarations
data TsDeclaration Source #
A declaration of a declaration file, by the TypeScript compiler's
name of its node, most with its modifiers, like export & declare.
Constructors
Instances
| Read TsDeclaration Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsDeclaration # readList :: ReadS [TsDeclaration] # | |
| Show TsDeclaration Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsDeclaration -> ShowS # show :: TsDeclaration -> String # showList :: [TsDeclaration] -> ShowS # | |
| Eq TsDeclaration Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods (==) :: TsDeclaration -> TsDeclaration -> Bool # (/=) :: TsDeclaration -> TsDeclaration -> Bool # | |
| Ord TsDeclaration Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsDeclaration -> TsDeclaration -> Ordering # (<) :: TsDeclaration -> TsDeclaration -> Bool # (<=) :: TsDeclaration -> TsDeclaration -> Bool # (>) :: TsDeclaration -> TsDeclaration -> Bool # (>=) :: TsDeclaration -> TsDeclaration -> Bool # max :: TsDeclaration -> TsDeclaration -> TsDeclaration # min :: TsDeclaration -> TsDeclaration -> TsDeclaration # | |
data TsModuleName Source #
The name of a ModuleDeclaration.
Constructors
| NamespaceName TsEntityName | namespace N.M |
| ModuleName TsEntityName | module N.M |
| ExternalModuleName Text | module "m" |
| GlobalAugmentation | global |
Instances
| Read TsModuleName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsModuleName # readList :: ReadS [TsModuleName] # | |
| Show TsModuleName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsModuleName -> ShowS # show :: TsModuleName -> String # showList :: [TsModuleName] -> ShowS # | |
| Eq TsModuleName Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsModuleName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsModuleName -> TsModuleName -> Ordering # (<) :: TsModuleName -> TsModuleName -> Bool # (<=) :: TsModuleName -> TsModuleName -> Bool # (>) :: TsModuleName -> TsModuleName -> Bool # (>=) :: TsModuleName -> TsModuleName -> Bool # max :: TsModuleName -> TsModuleName -> TsModuleName # min :: TsModuleName -> TsModuleName -> TsModuleName # | |
data TsImportClause Source #
The imports of an ImportDeclaration, by default & by name.
Constructors
| TsImportClause (Maybe Text) (Maybe TsNamedBindings) |
Instances
| Read TsImportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsImportClause # readList :: ReadS [TsImportClause] # | |
| Show TsImportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsImportClause -> ShowS # show :: TsImportClause -> String # showList :: [TsImportClause] -> ShowS # | |
| Eq TsImportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods (==) :: TsImportClause -> TsImportClause -> Bool # (/=) :: TsImportClause -> TsImportClause -> Bool # | |
| Ord TsImportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsImportClause -> TsImportClause -> Ordering # (<) :: TsImportClause -> TsImportClause -> Bool # (<=) :: TsImportClause -> TsImportClause -> Bool # (>) :: TsImportClause -> TsImportClause -> Bool # (>=) :: TsImportClause -> TsImportClause -> Bool # max :: TsImportClause -> TsImportClause -> TsImportClause # min :: TsImportClause -> TsImportClause -> TsImportClause # | |
data TsNamedBindings Source #
Imports by name.
Constructors
| NamespaceImport Text | * as n |
| NamedImports [TsImportSpecifier] | { a, b as c } |
Instances
data TsImportSpecifier Source #
type a as b, an import or export, of a type or not, renamed or not.
Constructors
| TsImportSpecifier Bool (Maybe Text) Text |
Instances
data TsModuleReference Source #
What an ImportEqualsDeclaration imports.
Constructors
| ExternalModuleReference Text | require("m") |
| EntityModuleReference TsEntityName | N.M |
Instances
data TsExportClause Source #
What an ExportDeclaration exports.
Constructors
| NamespaceExport (Maybe Text) |
|
| NamedExports [TsImportSpecifier] | { a, b as c } |
Instances
| Read TsExportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsExportClause # readList :: ReadS [TsExportClause] # | |
| Show TsExportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsExportClause -> ShowS # show :: TsExportClause -> String # showList :: [TsExportClause] -> ShowS # | |
| Eq TsExportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods (==) :: TsExportClause -> TsExportClause -> Bool # (/=) :: TsExportClause -> TsExportClause -> Bool # | |
| Ord TsExportClause Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsExportClause -> TsExportClause -> Ordering # (<) :: TsExportClause -> TsExportClause -> Bool # (<=) :: TsExportClause -> TsExportClause -> Bool # (>) :: TsExportClause -> TsExportClause -> Bool # (>=) :: TsExportClause -> TsExportClause -> Bool # max :: TsExportClause -> TsExportClause -> TsExportClause # min :: TsExportClause -> TsExportClause -> TsExportClause # | |
data TsVariableDeclaration Source #
x: T = 1, a variable, of a type or not, & a literal value or not.
Instances
data TsEnumMember Source #
A = 1, a member of an EnumDeclaration, of a literal value or not.
Constructors
| TsEnumMember TsPropertyName (Maybe TsLiteral) |
Instances
| Read TsEnumMember Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsEnumMember # readList :: ReadS [TsEnumMember] # | |
| Show TsEnumMember Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsEnumMember -> ShowS # show :: TsEnumMember -> String # showList :: [TsEnumMember] -> ShowS # | |
| Eq TsEnumMember Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsEnumMember Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsEnumMember -> TsEnumMember -> Ordering # (<) :: TsEnumMember -> TsEnumMember -> Bool # (<=) :: TsEnumMember -> TsEnumMember -> Bool # (>) :: TsEnumMember -> TsEnumMember -> Bool # (>=) :: TsEnumMember -> TsEnumMember -> Bool # max :: TsEnumMember -> TsEnumMember -> TsEnumMember # min :: TsEnumMember -> TsEnumMember -> TsEnumMember # | |
data TsHeritage Source #
N.M<T>, a class or interface which a declaration extends.
Constructors
| TsHeritage TsEntityName [TsType] |
Instances
| Read TsHeritage Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsHeritage # readList :: ReadS [TsHeritage] # readPrec :: ReadPrec TsHeritage # readListPrec :: ReadPrec [TsHeritage] # | |
| Show TsHeritage Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsHeritage -> ShowS # show :: TsHeritage -> String # showList :: [TsHeritage] -> ShowS # | |
| Eq TsHeritage Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsHeritage Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsHeritage -> TsHeritage -> Ordering # (<) :: TsHeritage -> TsHeritage -> Bool # (<=) :: TsHeritage -> TsHeritage -> Bool # (>) :: TsHeritage -> TsHeritage -> Bool # (>=) :: TsHeritage -> TsHeritage -> Bool # max :: TsHeritage -> TsHeritage -> TsHeritage # min :: TsHeritage -> TsHeritage -> TsHeritage # | |
type TsEntityName = [Text] Source #
A qualified name, N.M.x, by its identifiers.
Types
A type, by the TypeScript compiler's name of its node.
Constructors
| KeywordType TsTokenCategory |
|
| ThisType | this |
| LiteralType TsLiteral |
|
| ReferenceType TsEntityName [TsType] |
|
| ArrayType TsType | T[] |
| TupleType [TsType] | [T, U] |
| OptionalType TsType |
|
| RestType TsType |
|
| NamedTupleMember Bool Text Bool TsType |
|
| UnionType [TsType] | T | U |
| IntersectionType [TsType] | T & U |
| ParenthesizedType TsType | (T) |
| FunctionType TsSignature | <T>(x: T) => U |
| ConstructorType Bool TsSignature |
|
| TypeOperator TsTokenCategory TsType |
|
| IndexedAccessType TsType TsType | T[K] |
| TypeQuery TsEntityName [TsType] | typeof x<T> |
| ImportType Bool Text TsEntityName [TsType] |
|
| InferType Text (Maybe TsType) | infer T extends U |
| TypePredicate Bool Text (Maybe TsType) |
|
| ObjectType [TsProperty] | { x: T; y?: U } |
| MappedType (Maybe TsTokenCategory) Text TsType (Maybe TsType) (Maybe TsTokenCategory) TsType |
|
| ConditionalType TsType TsType TsType TsType | T extends U ? V : W |
| TemplateLiteralType Text [(TsType, Text)] |
|
data TsProperty Source #
A member of an ObjectType, InterfaceDeclaration or
ClassDeclaration, by the TypeScript compiler's name of its node,
with its modifiers, like readonly & static.
Constructors
| PropertySignature [TsTokenCategory] TsPropertyName Bool (Maybe TsType) |
|
| MethodSignature [TsTokenCategory] TsPropertyName Bool TsSignature |
|
| CallSignature TsSignature | <T>(x: T): U |
| ConstructSignature TsSignature | new <T>(x: T): U |
| IndexSignature [TsTokenCategory] Text TsType TsType | [k: K]: T |
| GetAccessor [TsTokenCategory] TsPropertyName (Maybe TsType) | get x(): T |
| SetAccessor [TsTokenCategory] TsPropertyName TsParameter | set x(v: T) |
| Constructor [TsTokenCategory] [TsParameter] |
|
Instances
| Read TsProperty Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsProperty # readList :: ReadS [TsProperty] # readPrec :: ReadPrec TsProperty # readListPrec :: ReadPrec [TsProperty] # | |
| Show TsProperty Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsProperty -> ShowS # show :: TsProperty -> String # showList :: [TsProperty] -> ShowS # | |
| Eq TsProperty Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsProperty Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsProperty -> TsProperty -> Ordering # (<) :: TsProperty -> TsProperty -> Bool # (<=) :: TsProperty -> TsProperty -> Bool # (>) :: TsProperty -> TsProperty -> Bool # (>=) :: TsProperty -> TsProperty -> Bool # max :: TsProperty -> TsProperty -> TsProperty # min :: TsProperty -> TsProperty -> TsProperty # | |
data TsPropertyName Source #
The name of a member.
Constructors
| PropertyIdentifier Text | x |
| PropertyString Text | "x y" |
| PropertyNumeric Text | 1 |
| PropertyPrivate Text | #x |
| ComputedPropertyName TsEntityName | [Symbol.iterator] |
Instances
| Read TsPropertyName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsPropertyName # readList :: ReadS [TsPropertyName] # | |
| Show TsPropertyName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsPropertyName -> ShowS # show :: TsPropertyName -> String # showList :: [TsPropertyName] -> ShowS # | |
| Eq TsPropertyName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods (==) :: TsPropertyName -> TsPropertyName -> Bool # (/=) :: TsPropertyName -> TsPropertyName -> Bool # | |
| Ord TsPropertyName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsPropertyName -> TsPropertyName -> Ordering # (<) :: TsPropertyName -> TsPropertyName -> Bool # (<=) :: TsPropertyName -> TsPropertyName -> Bool # (>) :: TsPropertyName -> TsPropertyName -> Bool # (>=) :: TsPropertyName -> TsPropertyName -> Bool # max :: TsPropertyName -> TsPropertyName -> TsPropertyName # min :: TsPropertyName -> TsPropertyName -> TsPropertyName # | |
A literal, of a LiteralType or a value.
Constructors
| NullLiteral | null |
| TrueLiteral | true |
| FalseLiteral | false |
| TextLiteral Text | "abc" |
| NumberLiteral Text |
|
| BigIntegerLiteral Text |
|
Instances
| Read TsLiteral Source # | |
| Show TsLiteral Source # | |
| Eq TsLiteral Source # | |
| Ord TsLiteral Source # | |
data TsTypeParameter Source #
const T extends U = V, a type parameter, with its modifiers.
Constructors
| TsTypeParameter [TsTokenCategory] Text (Maybe TsType) (Maybe TsType) |
Instances
data TsSignature Source #
<T>(x: T): U, type parameters, parameters & a return type or not.
Constructors
| TsSignature [TsTypeParameter] [TsParameter] (Maybe TsType) |
Instances
| Read TsSignature Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsSignature # readList :: ReadS [TsSignature] # readPrec :: ReadPrec TsSignature # readListPrec :: ReadPrec [TsSignature] # | |
| Show TsSignature Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsSignature -> ShowS # show :: TsSignature -> String # showList :: [TsSignature] -> ShowS # | |
| Eq TsSignature Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsSignature Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsSignature -> TsSignature -> Ordering # (<) :: TsSignature -> TsSignature -> Bool # (<=) :: TsSignature -> TsSignature -> Bool # (>) :: TsSignature -> TsSignature -> Bool # (>=) :: TsSignature -> TsSignature -> Bool # max :: TsSignature -> TsSignature -> TsSignature # min :: TsSignature -> TsSignature -> TsSignature # | |
data TsParameter Source #
...x?: T, a parameter, rest or not, optional or not.
Constructors
| TsParameter Bool TsBindingName Bool (Maybe TsType) |
Instances
| Read TsParameter Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsParameter # readList :: ReadS [TsParameter] # readPrec :: ReadPrec TsParameter # readListPrec :: ReadPrec [TsParameter] # | |
| Show TsParameter Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsParameter -> ShowS # show :: TsParameter -> String # showList :: [TsParameter] -> ShowS # | |
| Eq TsParameter Source # | |
Defined in Control.Lens.Grammar.TypeScript | |
| Ord TsParameter Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsParameter -> TsParameter -> Ordering # (<) :: TsParameter -> TsParameter -> Bool # (<=) :: TsParameter -> TsParameter -> Bool # (>) :: TsParameter -> TsParameter -> Bool # (>=) :: TsParameter -> TsParameter -> Bool # max :: TsParameter -> TsParameter -> TsParameter # min :: TsParameter -> TsParameter -> TsParameter # | |
data TsBindingName Source #
The name of a parameter, or a pattern of names.
Constructors
| BindingIdentifier Text |
|
| ObjectBindingPattern [TsBindingElement] | { a, b: c } |
| ArrayBindingPattern [TsBindingElement] | [a, ...b] |
Instances
| Read TsBindingName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods readsPrec :: Int -> ReadS TsBindingName # readList :: ReadS [TsBindingName] # | |
| Show TsBindingName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods showsPrec :: Int -> TsBindingName -> ShowS # show :: TsBindingName -> String # showList :: [TsBindingName] -> ShowS # | |
| Eq TsBindingName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods (==) :: TsBindingName -> TsBindingName -> Bool # (/=) :: TsBindingName -> TsBindingName -> Bool # | |
| Ord TsBindingName Source # | |
Defined in Control.Lens.Grammar.TypeScript Methods compare :: TsBindingName -> TsBindingName -> Ordering # (<) :: TsBindingName -> TsBindingName -> Bool # (<=) :: TsBindingName -> TsBindingName -> Bool # (>) :: TsBindingName -> TsBindingName -> Bool # (>=) :: TsBindingName -> TsBindingName -> Bool # max :: TsBindingName -> TsBindingName -> TsBindingName # min :: TsBindingName -> TsBindingName -> TsBindingName # | |
data TsBindingElement Source #
...a: b, an element of a binding pattern, rest or not.
Constructors
| TsBindingElement Bool (Maybe TsPropertyName) TsBindingName |
Instances
Tokens
A token, of a TsTokenCategory & its text, as the scanner of
the TypeScript compiler scans it, with its trivia: its text is
an identifier's name, a string's value, a number's spelling,
a template's literal, or a comment.
Constructors
| TsToken | |
Fields | |
Instances
| Categorized TsToken Source # | |||||
Defined in Control.Lens.Grammar.TypeScript Associated Types
Methods categorize :: TsToken -> Categorize TsToken # | |||||
| Read TsToken Source # | |||||
| Show TsToken Source # | |||||
| Eq TsToken Source # | |||||
| Ord TsToken Source # | |||||
Defined in Control.Lens.Grammar.TypeScript | |||||
| type Categorize TsToken Source # | |||||
Defined in Control.Lens.Grammar.TypeScript | |||||
data TsTokenCategory Source #
The categories of TsTokens, by the TypeScript compiler's names.
Constructors