Documentation
¶
Index ¶
- Constants
- Variables
- func CheckRefDup(r1, r2 *Ref) bool
- func IsBothEnum(r1, r2 *Ref) bool
- func IsBothFnTypDec(r1, r2 *Ref) bool
- func IsBothItf(r1, r2 *Ref) bool
- func IsBothTyp(r1, r2 *Ref) bool
- func IsBothVal(r1, r2 *Ref) bool
- func IsCallableClass(r1, r2 *Ref) bool
- func IsClsAndIft(r1, r2 *Ref) bool
- func IsCtxKeyword(str string) bool
- func IsDecimalDigit(c rune) bool
- func IsEnumAndVal(r1, r2 *Ref) bool
- func IsHexDigit(c rune) bool
- func IsIdPart(c rune) bool
- func IsIdStart(c rune) bool
- func IsKeyword(str string) bool
- func IsName(tok *Token, name string, canContainsEscape bool) bool
- func IsNodeInParen(node Node) bool
- func IsOctalDigit(c rune) bool
- func IsOneOfNs(r1, r2 *Ref) bool
- func IsSingleEscapeChar(c rune) bool
- func IsStrictKeyword(str string) bool
- func NodeIsBigint(node Node, s *span.Source) bool
- func NodeText(node Node, s *span.Source) string
- func NodeToFloat(node Node, s *span.Source) float64
- func ParseBigint(t string) *big.Int
- func ParseFloat(t string) float64
- func TokRawText(t *Token, s *span.Source) string
- func TokText(t *Token, s *span.Source) string
- type ACC_MOD
- type ArrLit
- type ArrPat
- type ArrowFn
- func (n *ArrowFn) Async() bool
- func (n *ArrowFn) Body() Node
- func (n *ArrowFn) ExpRet() bool
- func (n *ArrowFn) Expr() bool
- func (n *ArrowFn) OuterParen() span.Range
- func (n *ArrowFn) Params() []Node
- func (n *ArrowFn) Range() span.Range
- func (n *ArrowFn) Rets() []Node
- func (n *ArrowFn) SetOuterParen(rng span.Range)
- func (n *ArrowFn) SetTypInfo(ti *TypInfo)
- func (n *ArrowFn) TypInfo() *TypInfo
- func (n *ArrowFn) Type() NodeType
- type AssignExpr
- func (n *AssignExpr) Lhs() Node
- func (n *AssignExpr) Op() TokenValue
- func (n *AssignExpr) OpName() string
- func (n *AssignExpr) OuterParen() span.Range
- func (n *AssignExpr) Range() span.Range
- func (n *AssignExpr) Rhs() Node
- func (n *AssignExpr) SetOuterParen(rng span.Range)
- func (n *AssignExpr) SetTypInfo(ti *TypInfo)
- func (n *AssignExpr) TypInfo() *TypInfo
- func (n *AssignExpr) Type() NodeType
- type AssignPat
- type BinExpr
- type BindKind
- type BlockStmt
- type BoolLit
- type BrkStmt
- type CallExpr
- func (n *CallExpr) Args() []Node
- func (n *CallExpr) Callee() Node
- func (n *CallExpr) Optional() bool
- func (n *CallExpr) OuterParen() span.Range
- func (n *CallExpr) Range() span.Range
- func (n *CallExpr) SetOuterParen(rng span.Range)
- func (n *CallExpr) SetTypInfo(ti *TypInfo)
- func (n *CallExpr) TypInfo() *TypInfo
- func (n *CallExpr) Type() NodeType
- type Catch
- type ChainExpr
- type ClassBody
- type ClassDec
- func (n *ClassDec) Abstract() bool
- func (n *ClassDec) Body() Node
- func (n *ClassDec) Declare() bool
- func (n *ClassDec) Id() Node
- func (n *ClassDec) Implements() []Node
- func (n *ClassDec) Range() span.Range
- func (n *ClassDec) SetTypInfo(ti *TypInfo)
- func (n *ClassDec) Super() Node
- func (n *ClassDec) SuperTypArgs() Node
- func (n *ClassDec) TypInfo() *TypInfo
- func (n *ClassDec) TypParams() Node
- func (n *ClassDec) Type() NodeType
- type ClsTypInfo
- type CondExpr
- type ContStmt
- type DebugStmt
- type Decorator
- type DoWhileStmt
- type ESVersion
- type EmptyStmt
- type ErrTypArgMissingGT
- type ExportDec
- func (n *ExportDec) All() bool
- func (n *ExportDec) Dec() Node
- func (n *ExportDec) Default() bool
- func (n *ExportDec) Kind() string
- func (n *ExportDec) Range() span.Range
- func (n *ExportDec) Specs() []Node
- func (n *ExportDec) Src() Node
- func (n *ExportDec) TsTyp() bool
- func (n *ExportDec) Type() NodeType
- type ExportSpec
- type ExprStmt
- type Feature
- type Field
- type FixedOfstErr
- type FnDec
- func (n *FnDec) Async() bool
- func (n *FnDec) Body() Node
- func (n *FnDec) ExpRet() bool
- func (n *FnDec) Generator() bool
- func (n *FnDec) Id() Node
- func (n *FnDec) IsSig() bool
- func (n *FnDec) OuterParen() span.Range
- func (n *FnDec) Params() []Node
- func (n *FnDec) Range() span.Range
- func (n *FnDec) Rets() []Node
- func (n *FnDec) SetOuterParen(rng span.Range)
- func (n *FnDec) SetTypInfo(ti *TypInfo)
- func (n *FnDec) TypInfo() *TypInfo
- func (n *FnDec) Type() NodeType
- type ForInOfStmt
- type ForStmt
- type HTMLEntity
- type Ident
- func (n *Ident) ContainsEscape() bool
- func (n *Ident) IsPrivate() bool
- func (n *Ident) OuterParen() span.Range
- func (n *Ident) Range() span.Range
- func (n *Ident) SetOuterParen(rng span.Range)
- func (n *Ident) SetTypInfo(ti *TypInfo)
- func (n *Ident) TypInfo() *TypInfo
- func (n *Ident) Type() NodeType
- func (n *Ident) Val() string
- type IfStmt
- type IllegalEscapeInfo
- type ImportCall
- type ImportDec
- type ImportSpec
- type InParenNode
- type JsxAttr
- type JsxClose
- type JsxElem
- type JsxEmpty
- type JsxExprSpan
- type JsxIdent
- type JsxMember
- type JsxNsName
- type JsxOpen
- type JsxSpreadAttr
- type JsxSpreadChild
- type JsxText
- type LabelStmt
- type Lexer
- func (l *Lexer) AddMode(mode LexerModeKind)
- func (l *Lexer) CurMode() *LexerMode
- func (l *Lexer) DiscardState()
- func (l *Lexer) EraseMode(mode LexerModeKind)
- func (l *Lexer) FinRng(rng span.Range) span.Range
- func (l *Lexer) IsLineTerminator(c rune) bool
- func (l *Lexer) IsMode(mode LexerModeKind) bool
- func (l *Lexer) Next() *Token
- func (l *Lexer) NextRevise(v TokenValue) *Token
- func (l *Lexer) Peek() *Token
- func (l *Lexer) Peek2nd() *Token
- func (l *Lexer) PeekGrow() *Token
- func (l *Lexer) PeekStmtBegin() *Token
- func (l *Lexer) PopMode() *LexerMode
- func (l *Lexer) PopState()
- func (l *Lexer) PrevTok() TokenValue
- func (l *Lexer) PrevTokRng() span.Range
- func (l *Lexer) PushMode(mode LexerModeKind, inherit bool)
- func (l *Lexer) PushState()
- func (l *Lexer) Rng() span.Range
- type LexerError
- type LexerMode
- type LexerModeKind
- type LexerState
- type MemberExpr
- func (n *MemberExpr) Compute() bool
- func (n *MemberExpr) Obj() Node
- func (n *MemberExpr) Optional() bool
- func (n *MemberExpr) OuterParen() span.Range
- func (n *MemberExpr) Prop() Node
- func (n *MemberExpr) Range() span.Range
- func (n *MemberExpr) SetOuterParen(rng span.Range)
- func (n *MemberExpr) Type() NodeType
- type MetaProp
- type Method
- func (n *Method) Computed() bool
- func (n *Method) Declare() bool
- func (n *Method) HasBody() bool
- func (n *Method) Key() Node
- func (n *Method) Kind() string
- func (n *Method) PropKind() PropKind
- func (n *Method) Range() span.Range
- func (n *Method) SetTypInfo(ti *TypInfo)
- func (n *Method) Static() bool
- func (n *Method) TypInfo() *TypInfo
- func (n *Method) Type() NodeType
- func (n *Method) Val() Node
- type ModifierNameLoc
- type NewExpr
- func (n *NewExpr) Args() []Node
- func (n *NewExpr) Callee() Node
- func (n *NewExpr) OuterParen() span.Range
- func (n *NewExpr) Range() span.Range
- func (n *NewExpr) SetOuterParen(rng span.Range)
- func (n *NewExpr) SetTypInfo(ti *TypInfo)
- func (n *NewExpr) TypInfo() *TypInfo
- func (n *NewExpr) Type() NodeType
- type Node
- type NodeType
- type NodeWithTypInfo
- type NullLit
- type NumLit
- type ObjLit
- type ObjPat
- type ParenExpr
- type Parser
- func (p *Parser) Ast() Node
- func (p *Parser) Lexer() *Lexer
- func (p *Parser) NodeText(n Node) string
- func (p *Parser) PostCmts(stmt Node) []span.Range
- func (p *Parser) PrevCmts(stmt Node) []span.Range
- func (p *Parser) Prog() (Node, error)
- func (p *Parser) RngText(rng span.Range) string
- func (p *Parser) Setup(src *span.Source, opts *ParserOpts)
- func (p *Parser) Source() *span.Source
- func (p *Parser) Symtab() *SymTab
- func (p *Parser) TokText(t *Token) string
- type ParserError
- type ParserOpts
- type Prog
- type Prop
- type PropKind
- type Ref
- type RefDefType
- type RegLit
- type RestPat
- type RetStmt
- type Scope
- func (s *Scope) AddKind(kind ScopeKind) *Scope
- func (s *Scope) AddLocal(ref *Ref, name string, checkDup bool) bool
- func (s *Scope) BindingOf(name string) *Ref
- func (s *Scope) DelLocal(ref *Ref)
- func (s *Scope) EraseKind(kind ScopeKind) *Scope
- func (s *Scope) GetLabel(name string) Node
- func (s *Scope) HasLabel(name string) bool
- func (s *Scope) HasName(name string) bool
- func (s *Scope) IsKind(kind ScopeKind) bool
- func (s *Scope) Local(name string) *Ref
- func (s *Scope) OuterFn() *Scope
- func (s *Scope) OuterScope() *Scope
- func (s *Scope) UpperCls() *Scope
- func (s *Scope) UpperFn() *Scope
- func (s *Scope) UpperLoop() *Scope
- func (s *Scope) UpperScope(kinds *[]ScopeKind) *Scope
- type ScopeKind
- type SeqExpr
- type Spread
- type StaticBlock
- type StrLit
- type Super
- type SwitchCase
- type SwitchStmt
- type SymTab
- type ThisExpr
- type ThrowStmt
- type TokExtIdent
- type TokExtRegexp
- type TokExtStr
- type TokExtTplSpan
- type Token
- func (t *Token) CanBePropKey() (bool, bool)
- func (t *Token) ContainsEscape() bool
- func (t *Token) ErrMsg() string
- func (t *Token) HasLegacyOctalEscapeSeq() bool
- func (t *Token) IsBin(notIn bool, ts bool) TokenValue
- func (t *Token) IsCtxKw() bool
- func (t *Token) IsKw() bool
- func (t *Token) IsLegal() bool
- func (t *Token) IsLit(in bool) bool
- func (t *Token) IsPlainTpl() bool
- func (t *Token) IsUnary() bool
- func (t *Token) Kind() *TokenKind
- func (t *Token) Len() uint32
- func (t *Token) Val() TokenValue
- type TokenKind
- type TokenValue
- type TokensBuf
- type TplExpr
- type TryStmt
- type TsArr
- type TsCallSig
- type TsCheckParamOpts
- type TsCondType
- func (n *TsCondType) CheckTyp() Node
- func (n *TsCondType) ExtTyp() Node
- func (n *TsCondType) FalseTyp() Node
- func (n *TsCondType) OuterParen() span.Range
- func (n *TsCondType) Range() span.Range
- func (n *TsCondType) SetOuterParen(rng span.Range)
- func (n *TsCondType) TrueTyp() Node
- func (n *TsCondType) Type() NodeType
- type TsDec
- type TsEnum
- type TsEnumMember
- type TsExportAssign
- type TsFnTyp
- type TsIdxAccess
- type TsIdxSig
- type TsImportAlias
- type TsImportRequire
- type TsImportType
- type TsInterface
- type TsInterfaceBody
- type TsIntersectTyp
- type TsLit
- type TsMapped
- func (n *TsMapped) Key() Node
- func (n *TsMapped) Name() Node
- func (n *TsMapped) Optional() int
- func (n *TsMapped) OptionalFmt() interface{}
- func (n *TsMapped) OuterParen() span.Range
- func (n *TsMapped) Range() span.Range
- func (n *TsMapped) Readonly() int
- func (n *TsMapped) ReadonlyFmt() interface{}
- func (n *TsMapped) SetOuterParen(rng span.Range)
- func (n *TsMapped) Type() NodeType
- func (n *TsMapped) Val() Node
- type TsNS
- type TsNewSig
- type TsNoNull
- type TsNsName
- type TsObj
- type TsOpt
- type TsParam
- type TsParamsDec
- type TsParamsInst
- type TsParen
- type TsPredef
- type TsProp
- func (n *TsProp) Computed() bool
- func (n *TsProp) IsMethod() bool
- func (n *TsProp) Key() Node
- func (n *TsProp) Kind() PropKind
- func (n *TsProp) Method() *TsCallSig
- func (n *TsProp) Optional() bool
- func (n *TsProp) Range() span.Range
- func (n *TsProp) Readonly() bool
- func (n *TsProp) Type() NodeType
- func (n *TsProp) Val() Node
- type TsRef
- type TsRest
- type TsRoughParam
- type TsThis
- type TsTuple
- type TsTupleNamedMember
- type TsTypAnnot
- type TsTypAssert
- type TsTypDec
- type TsTypInfer
- type TsTypOp
- type TsTypPredicate
- func (n *TsTypPredicate) Asserts() bool
- func (n *TsTypPredicate) Name() Node
- func (n *TsTypPredicate) OuterParen() span.Range
- func (n *TsTypPredicate) Range() span.Range
- func (n *TsTypPredicate) SetOuterParen(rng span.Range)
- func (n *TsTypPredicate) Typ() Node
- func (n *TsTypPredicate) Type() NodeType
- type TsTypQuery
- type TsUnionTyp
- type TypInfo
- func (ti *TypInfo) Abstract() bool
- func (ti *TypInfo) AccMod() ACC_MOD
- func (ti *TypInfo) BeginRng() span.Range
- func (ti *TypInfo) Clone() *TypInfo
- func (ti *TypInfo) Declare() bool
- func (n *TypInfo) Decorators() []Node
- func (ti *TypInfo) Definite() bool
- func (ti *TypInfo) Implements() []Node
- func (ti *TypInfo) Not(rng span.Range)
- func (ti *TypInfo) Optional() bool
- func (ti *TypInfo) Override() bool
- func (ti *TypInfo) Ques() span.Range
- func (ti *TypInfo) Readonly() bool
- func (ti *TypInfo) SetAbstract(flag bool)
- func (ti *TypInfo) SetAccMod(accMod ACC_MOD)
- func (ti *TypInfo) SetBeginRng(rng span.Range)
- func (ti *TypInfo) SetDeclare(flag bool)
- func (ti *TypInfo) SetImplements(nodes []Node)
- func (ti *TypInfo) SetNot(rng span.Range)
- func (ti *TypInfo) SetOverride(flag bool)
- func (ti *TypInfo) SetQues(rng span.Range)
- func (ti *TypInfo) SetReadonly(flag bool)
- func (ti *TypInfo) SetSuperTypArgs(node Node)
- func (ti *TypInfo) SetTypAnnot(node Node)
- func (ti *TypInfo) SetTypArgs(node Node)
- func (ti *TypInfo) SetTypParams(node Node)
- func (ti *TypInfo) SuperTypArgs() Node
- func (ti *TypInfo) TypAnnot() *TsTypAnnot
- func (ti *TypInfo) TypArgs() Node
- func (ti *TypInfo) TypParams() Node
- type UnaryExpr
- func (n *UnaryExpr) Arg() Node
- func (n *UnaryExpr) Op() TokenValue
- func (n *UnaryExpr) OpName() string
- func (n *UnaryExpr) OpText() string
- func (n *UnaryExpr) OuterParen() span.Range
- func (n *UnaryExpr) Range() span.Range
- func (n *UnaryExpr) SetOuterParen(rng span.Range)
- func (n *UnaryExpr) Type() NodeType
- type UpdateExpr
- func (n *UpdateExpr) Arg() Node
- func (n *UpdateExpr) Op() TokenValue
- func (n *UpdateExpr) OpText() string
- func (n *UpdateExpr) OuterParen() span.Range
- func (n *UpdateExpr) Prefix() bool
- func (n *UpdateExpr) Range() span.Range
- func (n *UpdateExpr) SetOuterParen(rng span.Range)
- func (n *UpdateExpr) Type() NodeType
- type VarDec
- type VarDecStmt
- type WhileStmt
- type WithStmt
- type YieldExpr
Constants ¶
const ( ERR_UNEXPECTED_CHAR = "Unexpected character" ERR_UNEXPECTED_TOKEN = "Unexpected token" ERR_TPL_UNEXPECTED_TOKEN_TYPE = "Unexpected token `%s`" ERR_UNTERMINATED_COMMENT = "Unterminated comment" ERR_UNTERMINATED_REGEXP = "Unterminated regular expression" ERR_UNTERMINATED_STR = "Unterminated string constant" ERR_INVALID_REGEXP_FLAG = "Invalid regular expression flag" ERR_IDENT_AFTER_NUMBER = "Identifier directly after number" ERR_INVALID_NUMBER = "Invalid number" ERR_TPL_EXPECT_NUM_RADIX = "Expected number in radix %s" ERR_LEGACY_OCTAL_IN_STRICT_MODE = "Octal literals are not allowed in strict mode" ERR_TPL_LEGACY_OCTAL_ESCAPE_IN = "Octal escape sequences are not allowed in template strings" ERR_LEGACY_OCTAL_ESCAPE_IN_STRICT_MODE = "Octal escape sequences are not allowed in strict mode" ERR_EXPECTING_UNICODE_ESCAPE = "Expecting Unicode escape sequence \\uXXXX" ERR_CODEPOINT_OUT_OF_BOUNDS = "Code point out of bounds" ERR_BAD_ESCAPE_SEQ = "Bad character escape sequence" ERR_BAD_RUNE = "Bad character" ERR_UNTERMINATED_TPL = "Unterminated template" ERR_INVALID_UNICODE_ESCAPE = "Invalid Unicode escape" ERR_ILLEGAL_RETURN = "Illegal return" ERR_ILLEGAL_BREAK = "Illegal break" ERR_DUP_LABEL = "Label `%s` already declared" ERR_UNDEF_LABEL = "Undefined label `%s`" ERR_ILLEGAL_CONTINUE = "Illegal continue" ERR_MULTI_DEFAULT = "Multiple default clauses" ERR_ASSIGN_TO_RVALUE = "Assigning to rvalue" ERR_INVALID_META_PROP = "The only valid meta property for new is `new.target`" ERR_META_PROP_OUTSIDE_FN = "`new.target` can only be used in functions" ERR_DUP_BINDING = "Must have a single binding" ERR_TPL_BINDING_RESERVED_WORD = "Invalid binding `%s`" ERR_AWAIT_AS_DEFAULT_VALUE = "Await expression cannot be a default value" ERR_AWAIT_IN_FORMAL_PARAMS = "Await expression can't be used in parameter" ERR_TPL_ASSIGN_TO_RESERVED_WORD_IN_STRICT_MODE = "Assigning to `%s` in strict mode" ERR_FOR_IN_LOOP_HAS_INIT = "for-in loop variable declaration may not have an initializer" ERR_FOR_OF_LOOP_HAS_INIT = "for-of loop variable declaration may not have an initializer" ERR_STRICT_DIRECTIVE_AFTER_NOT_SIMPLE = "Illegal 'use strict' directive in function with non-simple parameter list" ERR_DUP_PARAM_NAME = "Parameter name clash" ERR_TRAILING_COMMA = "Unexpected trailing comma" ERR_REST_ELEM_MUST_LAST = "Rest element must be last element" ERR_DELETE_LOCAL_IN_STRICT = "Deleting local variable in strict mode" ERR_REDEF_PROP = "Redefinition of property" ERR_ILLEGAL_NEWLINE_AFTER_THROW = "Illegal newline after throw" ERR_CONST_DEC_INIT_REQUIRED = "Const declarations require an initialization value" ERR_TPL_FORBIDDEN_LEXICAL_NAME = "%s is disallowed as a lexically bound name" ERR_GETTER_SHOULD_NO_PARAM = "Getter must not have any formal parameters" ERR_SETTER_SHOULD_ONE_PARAM = "Setter must have exactly one formal parameter" ERR_ESCAPE_IN_KEYWORD = "Keyword must not contain escaped characters" ERR_WITH_STMT_IN_STRICT = "Strict mode code may not include a with statement" ERR_CLASS_NAME_REQUIRED = "Class name is required" ERR_SHORTHAND_PROP_ASSIGN_NOT_IN_DESTRUCT = "Shorthand property assignments are valid only in destructuring patterns" ERR_REST_ARG_NOT_SIMPLE = "Invalid rest operator's argument" ERR_REST_ARG_NOT_BINDING_PATTERN = "Binding pattern is not permitted as rest operator's argument" ERR_REST_IN_SETTER = "Setter cannot use rest params" ERR_INVALID_PAREN_ASSIGN_PATTERN = "Invalid parenthesized assignment pattern" ERR_OBJ_PATTERN_CANNOT_FN = "Object pattern can't contain getter or setter" ERR_INVALID_DESTRUCTING_TARGET = "Invalid destructuring assignment target" ERR_REST_CANNOT_SET_DEFAULT = "Rest elements cannot have a default value" ERR_MALFORMED_ARROW_PARAM = "Malformed arrow function parameter list" ERR_AWAIT_OUTSIDE_ASYNC = "Cannot use keyword 'await' outside an async function" ERR_AWAIT_AS_NAME_IN_ASYNC = "Can not use 'await' as identifier inside an async function" ERR_EXPORT_NOT_DEFINED = "Export `%s` is not defined" ERR_DUP_EXPORT = "Duplicate export `%s`" ERR_FN_IN_SINGLE_STMT_CTX = "function declarations can't appear in single-statement context" ERR_STATIC_PROP_PROTOTYPE = "Classes can't have a static field named `prototype`" ERR_YIELD_CANNOT_BE_DEFAULT_VALUE = "Yield expression cannot be a default value" ERR_YIELD_IN_FORMAL_PARAMS = "Yield expression can't be used in parameter" ERR_SUPER_CALL_OUTSIDE_CTOR = "super() call outside constructor of a subclass" ERR_SUPER_OUTSIDE_CLASS = "'super' is only allowed in object methods and classes" ERR_CTOR_CANNOT_HAVE_MODIFIER = "Constructor can't have get/set modifier" ERR_CTOR_CANNOT_BE_GENERATOR = "Constructor can't be a generator" ERR_CTOR_CANNOT_BE_ASYNC = "Constructor can't be a async" ERR_CTOR_CANNOT_BE_Field = "Classes can't have a field named `constructor`" ERR_CTOR_DUP = "Duplicate constructor in the same class" ERR_COMPUTE_PROP_MISSING_INIT = "A computed property name must have property initialization" ERR_IMPORT_EXPORT_SHOULD_AT_TOP_LEVEL = "'import' and 'export' may only appear at the top level" ERR_COMPLEX_BINDING_MISSING_INIT = "Complex binding patterns require an initialization value" ERR_LHS_OF_FOR_OF_CANNOT_ASYNC = "The left-hand side of a for-of loop may not be 'async'" ERR_TPL_UNARY_IMMEDIATELY_BEFORE_POW = "Unary operator `%s` used immediately before exponentiation expression" ERR_TPL_ID_DUP_DEF = "Identifier `%s` has already been declared" ERR_UNEXPECTED_PVT_FIELD = "Unexpected private field" ERR_DELETE_PVT_FIELD = "Private fields can not be deleted" ERR_TPL_ALONE_PVT_FIELD = "Private field `%s` must be declared in an enclosing class" ERR_OPT_EXPR_IN_NEW = "Invalid optional chain from new expression" ERR_OPT_EXPR_IN_TAG = "Invalid tagged template on optional chain" ERR_NULLISH_MIXED_WITH_LOGIC = "Cannot use unparenthesized `??` within logic expressions" ERR_NUM_SEP_BEGIN = "Numeric separator is not allowed at the first of digits" ERR_NUM_SEP_END = "Numeric separator is not allowed at the last of digits" ERR_NUM_SEP_DUP = "Only one underscore is allowed as numeric separator" ERR_NUM_SEP_IN_LEGACY_OCTAL = "Numeric separator is not allowed in legacy octal numeric literals" ERR_ILLEGAL_IMPORT_PROP = "The only valid meta property for import is `import.meta`" ERR_META_PROP_CONTAINS_ESCAPE = "Meta property can not contain escaped characters" ERR_DYNAMIC_IMPORT_CANNOT_NEW = "Cannot use new with `import()`" ERR_DECORATOR_INVALID_POSITION = "Leading decorators must be attached to a class declaration" // JSX related errors ERR_UNTERMINATED_JSX_CONTENTS = "Unterminated JSX contents" ERR_TPL_UNBALANCED_JSX_TAG = "Expected corresponding JSX closing tag for <%s>" ERR_JSX_ADJACENT_ELEM_SHOULD_BE_WRAPPED = "Adjacent JSX elements must be wrapped in an enclosing tag" ERR_TPL_JSX_HTML_UNESCAPED_ENTITY = "Unexpected `%s`, HTML entity " ERR_TPL_JSX_UNDEFINED_HTML_ENTITY = "Undefined HTML entity `%s`" // TS related errors ERR_THIS_CANNOT_BE_OPTIONAL = "The `this` parameter cannot be optional" ERR_ILLEGAL_PARAMETER_MODIFIER = "A parameter property is only allowed in a constructor implementation" ERR_CTOR_CANNOT_WITH_TYPE_PARAMS = "Type parameters cannot appear on a constructor declaration" ERR_FN_SIG_MISSING_IMPL = "Function implementation is missing or not immediately following the declaration" ERR_TPL_INVALID_FN_IMPL_NAME = "Function implementation name must be `%s`" ERR_TPL_USE_TYP_AS_VALUE = "`%s` only refers to a type, but is being used as a value here" ERR_ASYNC_IN_AMBIENT = "`async` modifier cannot be used in an ambient context" ERR_INIT_IN_ALLOWED_CTX = "Initializers are not allowed in ambient contexts" ERR_IMPL_IN_AMBIENT_CTX = "An implementation cannot be declared in ambient contexts" ERR_UNEXPECTED_TYPE_ANNOTATION = "Unexpected type annotation" ERR_ABSTRACT_MIXED_WITH_STATIC = "`static` modifier cannot be used with `abstract` modifier" ERR_DECLARE_MIXED_WITH_OVERRIDE = "`declare` modifier cannot be used with `override` modifier" ERR_BARE_ABSTRACT_PROPERTY = "Abstract methods can only appear within an abstract class" ERR_ABSTRACT_METHOD_WITH_IMPL = "Method cannot have an implementation because it's marked abstract" ERR_ABSTRACT_PROP_WITH_INIT = "Property cannot have an initializer because it's marked abstract" ERR_OVERRIDE_METHOD_DYNAMIC_NAME = "Method overload name must refer to an expression whose type is a literal type or a `unique symbol` type" ERR_TPL_INVALID_MODIFIER_ORDER = "`%s` modifier must precede `%s` modifier" ERR_ILLEGAL_DECLARE_IN_CLASS = "`declare` modifier cannot appear on class elements of this kind" ERR_EMPTY_TYPE_PARAM_LIST = "Type parameter list cannot be empty" ERR_EXTEND_LIST_EMPTY = "`extends` list cannot be empty" ERR_IMPLEMENT_LIST_EMPTY = "`implements` list cannot be empty" ERR_METHOD_CANNOT_READONLY = "Class methods cannot have the `readonly` modifier" ERR_TPL_IDX_SIG_CANNOT_HAVE_MODIFIER = "Index signatures cannot have the `%s` modifier" ERR_TPL_IDX_SIG_CANNOT_HAVE_ACCESS = "Index signatures cannot have an accessibility modifier `%s`" ERR_OVERRIDE_ON_CTOR = "`override` modifier cannot appear on a constructor declaration" ERR_OVERRIDE_IN_NO_EXTEND = "This member cannot have an `override` modifier because its containing class does not extend another class" ERR_PARAM_PROP_WITH_BINDING_PATTERN = "A parameter property may not be declared using a binding pattern" ERR_PVT_ELEM_WITH_ABSTRACT = "Private elements cannot have the `abstract` modifier" ERR_TPL_PVT_ELEM_WITH_ACCESS_MODIFIER = "Private elements cannot have an accessibility modifier `%s`" ERR_JSX_TS_LT_AMBIGUITY = "This syntax is reserved in `JSX`. Use an `as` expression instead" ERR_EXPORT_DECLARE_MISSING_DECLARATION = "`declare` must be followed by an ambient declaration" ERR_GETTER_SETTER_WITH_THIS_PARAM = "`get` and `set` accessors cannot declare `this` parameters" ERR_BINDING_PATTERN_REQUIRE_IN_IMPL = "A binding pattern parameter cannot be optional in an implementation signature" ERR_IMPORT_REQUIRE_STR_LIT_DESERVED = "String literal expected" ERR_IMPORT_TYPE_IN_IMPORT_ALIAS = "An import alias can not use `import type`" ERR_ABSTRACT_AT_INVALID_POSITION = "`abstract` modifier can only appear on a class, method, or property declaration" ERR_ACCESSOR_WITH_TYPE_PARAMS = "An accessor cannot have type parameters" ERR_GETTER_WITH_PARAMS = "A `get` accessor cannot have parameters" ERR_SETTER_WITH_PARAM_OPTIONAL = "A `set` accessor cannot have an optional parameter" ERR_SETTER_MISSING_PARAM = "A `set` accessor must have exactly one parameter" ERR_SETTER_WITH_REST_PARAM = "A `set` accessor cannot have rest parameter" ERR_SETTER_WITH_RET_TYP = "A `set` accessor cannot have a return type annotation" ERR_TPL_MODIFIER_ON_TYPE_MEMBER = "`%s` modifier cannot appear on a type member" ERR_ONLY_AMBIENT_MOD_WITH_STR_NAME = "Only ambient modules can use quoted names" ERR_STATIC_BLOCK_WITH_MODIFIER = "Static class blocks cannot have any modifier" ERR_TYPE_ARG_EMPTY = "Type argument list cannot be empty" ERR_EXPORT_DUP_TYPE_MODIFIER = "The `type` modifier cannot be used on a named export when `export type` is used on its export statement" ERR_IMPORT_TYP_MIX_NAMED = "A type-only import can specify a default import or named bindings, but not both" ERR_IMPORT_ARG_SHOULD_BE_STR = "Argument in a type import must be a string literal" ERR_INVALID_RO_MODIFIER_IN_TS_OBJ = "`readonly` modifier can only appear on a property declaration or index signature" ERR_READONLY_ONLY_PERMITTED_ON_ARRAY_TUPLE = "`readonly` type modifier is only permitted on array and tuple literal types" ERR_REST_TYPE_SHOULD_BE_ARRAY = "A rest element type must be an array type" ERR_TUPLE_NAMED_SHOULD_ALL_NAMED = "Tuple members must all have names or all not have names" ERR_TUPLE_LABEL_SHOULD_BE_SIMPLE = "Tuple members must be labeled with a simple identifier" ERR_TUPLE_OPT_SHOULD_AFTER_REQUIRED = "A required element cannot follow an optional element" )
const TOKENS_BUF_LEN = 5
Variables ¶
var CtxKeywords = make(map[string]TokenValue)
var HTMLEntities = map[string]HTMLEntity{}/* 2125 elements not displayed */
var HTMLEntityNames = map[string]bool{}/* 1511 elements not displayed */
var Keywords = make(map[string]TokenValue)
var MaxHTMLEntityName int = 33
var StrictKeywords = make(map[string]TokenValue)
var TokenKinds = [T_TOKEN_DEF_END + 1]*TokenKind{}/* 141 elements not displayed */
order should be as same as `TokenValue`
Functions ¶
func CheckRefDup ¶
caller should ensure both `r1` and `r2` have the same name
func IsBothEnum ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
this method is used to allow stmts:
``` const enum Foo {} const enum Foo {} ```
func IsBothFnTypDec ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
this method is used to allow stmts:
``` declare function f(): void; declare function f<T>(): T; ```
func IsBothItf ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
this method is used to allow stmts:
``` interface A {} interface A {} ```
func IsBothTyp ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
func IsBothVal ¶
caller should ensure both `r1` and `r2` match below rules: - be def rather than ref - have the same name
func IsCallableClass ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
this method is used to allow stmts:
``` declare class C { } function C() { } ```
func IsClsAndIft ¶
caller should ensure both `r1` and `r2` match below rules: - are def rather than ref - have the same name
this method is used to allow stmts:
``` class A {} interface A {} ```
func IsCtxKeyword ¶
func IsDecimalDigit ¶
func IsEnumAndVal ¶
func IsHexDigit ¶
func IsNodeInParen ¶ added in v0.0.10
func IsOctalDigit ¶
func IsSingleEscapeChar ¶
func IsStrictKeyword ¶
func ParseBigint ¶ added in v0.0.10
func ParseFloat ¶ added in v0.0.10
Types ¶
type ArrLit ¶
type ArrLit struct {
// contains filtered or unexported fields
}
#[visitor(Elems)]
func (*ArrLit) OuterParen ¶
func (*ArrLit) SetOuterParen ¶
func (*ArrLit) SetTypInfo ¶
type ArrPat ¶
type ArrPat struct {
// contains filtered or unexported fields
}
#[visitor(Elems)]
func (*ArrPat) OuterParen ¶
func (*ArrPat) SetOuterParen ¶
func (*ArrPat) SetTypInfo ¶
type ArrowFn ¶
type ArrowFn struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Params,Body)]
func (*ArrowFn) OuterParen ¶
func (*ArrowFn) SetOuterParen ¶
func (*ArrowFn) SetTypInfo ¶
type AssignExpr ¶
type AssignExpr struct {
// contains filtered or unexported fields
}
#[visitor(Lhs,Rhs)]
func (*AssignExpr) Lhs ¶
func (n *AssignExpr) Lhs() Node
func (*AssignExpr) Op ¶
func (n *AssignExpr) Op() TokenValue
func (*AssignExpr) OpName ¶ added in v0.0.10
func (n *AssignExpr) OpName() string
func (*AssignExpr) OuterParen ¶
func (n *AssignExpr) OuterParen() span.Range
func (*AssignExpr) Range ¶ added in v0.0.10
func (n *AssignExpr) Range() span.Range
func (*AssignExpr) Rhs ¶
func (n *AssignExpr) Rhs() Node
func (*AssignExpr) SetOuterParen ¶
func (n *AssignExpr) SetOuterParen(rng span.Range)
func (*AssignExpr) SetTypInfo ¶
func (n *AssignExpr) SetTypInfo(ti *TypInfo)
func (*AssignExpr) TypInfo ¶
func (n *AssignExpr) TypInfo() *TypInfo
func (*AssignExpr) Type ¶
func (n *AssignExpr) Type() NodeType
type AssignPat ¶
type AssignPat struct {
// contains filtered or unexported fields
}
#[visitor(Lhs,Rhs)]
func (*AssignPat) OuterParen ¶
func (*AssignPat) SetTypInfo ¶
type BinExpr ¶
type BinExpr struct {
// contains filtered or unexported fields
}
#[visitor(Lhs,Rhs)]
func (*BinExpr) Op ¶
func (n *BinExpr) Op() TokenValue
func (*BinExpr) OuterParen ¶
func (*BinExpr) SetOuterParen ¶
type BlockStmt ¶
type BlockStmt struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Body)]
type BoolLit ¶
type BoolLit struct {
// contains filtered or unexported fields
}
func (*BoolLit) OuterParen ¶
func (*BoolLit) SetOuterParen ¶
func (*BoolLit) SetTypInfo ¶
type CallExpr ¶
type CallExpr struct {
// contains filtered or unexported fields
}
#[visitor(Callee,Args)]
func (*CallExpr) OuterParen ¶
func (*CallExpr) SetOuterParen ¶
func (*CallExpr) SetTypInfo ¶
type Catch ¶
type Catch struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Param,Body)]
type ChainExpr ¶
type ChainExpr struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
type ClassBody ¶
type ClassBody struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Elems)]
type ClassDec ¶
type ClassDec struct {
// contains filtered or unexported fields
}
#[visitor(Id,Super,Body)]
func (*ClassDec) SetTypInfo ¶
func (*ClassDec) SuperTypArgs ¶
type ClsTypInfo ¶
type ClsTypInfo struct {
// contains filtered or unexported fields
}
type CondExpr ¶
type CondExpr struct {
// contains filtered or unexported fields
}
#[visitor(Test,Cons,Alt)]
func (*CondExpr) OuterParen ¶
func (*CondExpr) SetOuterParen ¶
type ContStmt ¶
type ContStmt struct {
// contains filtered or unexported fields
}
#[visitor(Label)]
type Decorator ¶
type Decorator struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
type DoWhileStmt ¶
type DoWhileStmt struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Body,Test)]
func (*DoWhileStmt) Body ¶
func (n *DoWhileStmt) Body() Node
func (*DoWhileStmt) Range ¶ added in v0.0.10
func (n *DoWhileStmt) Range() span.Range
func (*DoWhileStmt) Test ¶
func (n *DoWhileStmt) Test() Node
func (*DoWhileStmt) Type ¶
func (n *DoWhileStmt) Type() NodeType
type ESVersion ¶
type ESVersion int
const ( ES5 ESVersion = 2009 // https://262.ecma-international.org/5.1/ ES6 ESVersion = iota + 2014 // https://262.ecma-international.org/6.0/ ES7 // https://262.ecma-international.org/7.0/ ES8 // https://262.ecma-international.org/8.0/ ES9 // https://262.ecma-international.org/9.0/ ES10 // https://262.ecma-international.org/10.0/ ES11 // https://262.ecma-international.org/11.0/ ES12 // https://262.ecma-international.org/12.0/ ES13 // https://262.ecma-international.org/13.0/ )
type ErrTypArgMissingGT ¶
type ErrTypArgMissingGT struct {
// contains filtered or unexported fields
}
indicates the closing `>` is missing, so the processed `<` should be considered as the LessThan operator. produced in `tsTypArgs`
func (ErrTypArgMissingGT) Error ¶
func (e ErrTypArgMissingGT) Error() string
type ExportDec ¶
type ExportDec struct {
// contains filtered or unexported fields
}
#[visitor(Dec,Specs,Src)]
type ExportSpec ¶
type ExportSpec struct {
// contains filtered or unexported fields
}
#[visitor(Local,Id)]
func (*ExportSpec) Id ¶
func (n *ExportSpec) Id() Node
func (*ExportSpec) Kind ¶
func (n *ExportSpec) Kind() string
func (*ExportSpec) Local ¶
func (n *ExportSpec) Local() Node
func (*ExportSpec) NameSpace ¶
func (n *ExportSpec) NameSpace() bool
func (*ExportSpec) Range ¶ added in v0.0.10
func (n *ExportSpec) Range() span.Range
func (*ExportSpec) TsTyp ¶
func (n *ExportSpec) TsTyp() bool
func (*ExportSpec) Type ¶
func (n *ExportSpec) Type() NodeType
type Feature ¶
type Feature uint64
const ( FEAT_NONE Feature = 0 FEAT_STRICT Feature = 1 << iota FEAT_GLOBAL_ASYNC FEAT_LET_CONST // from es6 FEAT_SPREAD // from es6 FEAT_BINDING_PATTERN // from es6 FEAT_BINDING_REST_ELEM // from es6 FEAT_MODULE // from es6 FEAT_IMPORT_DEC // from es6 FEAT_EXPORT_DEC // from es6 FEAT_META_PROPERTY // from es6 FEAT_POW // from es7 FEAT_BINDING_REST_ELEM_NESTED // from es7 FEAT_ASYNC_AWAIT // from es8 FEAT_BAD_ESCAPE_IN_TAGGED_TPL // from es9 FEAT_ASYNC_GENERATOR // from es9 FEAT_ASYNC_ITERATION // from es9 FEAT_OPT_CATCH_PARAM // from es10 FEAT_JSON_SUPER_SET // from es10 FEAT_CLASS_PRV // from es11 FEAT_OPT_EXPR // from es11 FEAT_NULLISH // from es11 FEAT_BIGINT // from es11 FEAT_DYNAMIC_IMPORT // from es11 FEAT_EXPORT_ALL_AS_NS // from es11 FEAT_NUM_SEP // from es12 FEAT_LOGIC_ASSIGN // from es12 FEAT_CLASS_PUB_FIELD // from es13 FEAT_CLASS_PRIV_FIELD // from es13 FEAT_JSX FEAT_JSX_NS // not found where in the spec says that the flags of regexp is needed to check // even though it's implemented in some other parsers, so flag `FEAT_CHK_REGEXP_FLAGS` // is opt-in in mole FEAT_CHK_REGEXP_FLAGS FEAT_REGEXP_UNICODE // from es6 FEAT_REGEXP_STICKY // from es6 FEAT_REGEXP_DOT_ALL // from es8 FEAT_REGEXP_HAS_INDICES // from es10 FEAT_TS FEAT_DTS FEAT_DECORATOR )
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
#[visitor(Key,Val)]
func (*Field) SetTypInfo ¶
type FixedOfstErr ¶ added in v0.0.10
type FixedOfstErr struct {
// contains filtered or unexported fields
}
type FnDec ¶
type FnDec struct {
// contains filtered or unexported fields
}
#[visitor(Id,PUSH_SCOPE,Params,Body)]
func (*FnDec) OuterParen ¶
func (*FnDec) SetOuterParen ¶
func (*FnDec) SetTypInfo ¶
type ForInOfStmt ¶
type ForInOfStmt struct {
// contains filtered or unexported fields
}
#[visitor(Left,Right,Body)]
func (*ForInOfStmt) Await ¶
func (n *ForInOfStmt) Await() bool
func (*ForInOfStmt) Body ¶
func (n *ForInOfStmt) Body() Node
func (*ForInOfStmt) In ¶
func (n *ForInOfStmt) In() bool
func (*ForInOfStmt) Left ¶
func (n *ForInOfStmt) Left() Node
func (*ForInOfStmt) Range ¶ added in v0.0.10
func (n *ForInOfStmt) Range() span.Range
func (*ForInOfStmt) Right ¶
func (n *ForInOfStmt) Right() Node
func (*ForInOfStmt) Type ¶
func (n *ForInOfStmt) Type() NodeType
type ForStmt ¶
type ForStmt struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Init,Test,Update,Body)]
type HTMLEntity ¶
type Ident ¶
type Ident struct {
// contains filtered or unexported fields
}
func (*Ident) ContainsEscape ¶
func (*Ident) OuterParen ¶
func (*Ident) SetOuterParen ¶
func (*Ident) SetTypInfo ¶
type IfStmt ¶
type IfStmt struct {
// contains filtered or unexported fields
}
#[visitor(Test,Cons,Alt)]
type IllegalEscapeInfo ¶
type ImportCall ¶
type ImportCall struct {
// contains filtered or unexported fields
}
#[visitor(Src)]
func (*ImportCall) OuterParen ¶
func (n *ImportCall) OuterParen() span.Range
func (*ImportCall) Range ¶ added in v0.0.10
func (n *ImportCall) Range() span.Range
func (*ImportCall) SetOuterParen ¶
func (n *ImportCall) SetOuterParen(rng span.Range)
func (*ImportCall) Src ¶
func (n *ImportCall) Src() Node
func (*ImportCall) Type ¶
func (n *ImportCall) Type() NodeType
type ImportDec ¶
type ImportDec struct {
// contains filtered or unexported fields
}
#[visitor(Specs,Src)]
type ImportSpec ¶
type ImportSpec struct {
// contains filtered or unexported fields
}
#[visitor(Local,Id)]
func (*ImportSpec) Default ¶
func (n *ImportSpec) Default() bool
func (*ImportSpec) Id ¶
func (n *ImportSpec) Id() Node
func (*ImportSpec) Kind ¶
func (n *ImportSpec) Kind() string
func (*ImportSpec) Local ¶
func (n *ImportSpec) Local() Node
func (*ImportSpec) NameSpace ¶
func (n *ImportSpec) NameSpace() bool
func (*ImportSpec) Range ¶ added in v0.0.10
func (n *ImportSpec) Range() span.Range
func (*ImportSpec) TsTyp ¶
func (n *ImportSpec) TsTyp() bool
func (*ImportSpec) Type ¶
func (n *ImportSpec) Type() NodeType
type JsxAttr ¶
type JsxAttr struct {
// contains filtered or unexported fields
}
#[visitor(Name,Val)]
type JsxElem ¶
type JsxElem struct {
// contains filtered or unexported fields
}
https://github.com/facebook/jsx/blob/main/AST.md#jsx-element
#[visitor(Open,Children,Close)]
func (*JsxElem) IsFragment ¶
type JsxExprSpan ¶
type JsxExprSpan struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
func (*JsxExprSpan) Expr ¶
func (n *JsxExprSpan) Expr() Node
func (*JsxExprSpan) Range ¶ added in v0.0.10
func (n *JsxExprSpan) Range() span.Range
func (*JsxExprSpan) Type ¶
func (n *JsxExprSpan) Type() NodeType
type JsxIdent ¶
type JsxIdent struct {
// contains filtered or unexported fields
}
func (*JsxIdent) OuterParen ¶
func (*JsxIdent) SetOuterParen ¶
func (*JsxIdent) SetTypInfo ¶
type JsxMember ¶
type JsxMember struct {
// contains filtered or unexported fields
}
#[visitor(Obj,Prop)]
func (*JsxMember) SetTypInfo ¶
type JsxOpen ¶
type JsxOpen struct {
// contains filtered or unexported fields
}
#[visitor(Name,Attrs)]
type JsxSpreadAttr ¶
type JsxSpreadAttr struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*JsxSpreadAttr) Arg ¶
func (n *JsxSpreadAttr) Arg() Node
func (*JsxSpreadAttr) Range ¶ added in v0.0.10
func (n *JsxSpreadAttr) Range() span.Range
func (*JsxSpreadAttr) Type ¶
func (n *JsxSpreadAttr) Type() NodeType
type JsxSpreadChild ¶
type JsxSpreadChild struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
func (*JsxSpreadChild) Expr ¶
func (n *JsxSpreadChild) Expr() Node
func (*JsxSpreadChild) Range ¶ added in v0.0.10
func (n *JsxSpreadChild) Range() span.Range
func (*JsxSpreadChild) Type ¶
func (n *JsxSpreadChild) Type() NodeType
type LabelStmt ¶
type LabelStmt struct {
// contains filtered or unexported fields
}
#[visitor(Label,Body)]
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) AddMode ¶
func (l *Lexer) AddMode(mode LexerModeKind)
func (*Lexer) DiscardState ¶
func (l *Lexer) DiscardState()
func (*Lexer) EraseMode ¶
func (l *Lexer) EraseMode(mode LexerModeKind)
func (*Lexer) IsLineTerminator ¶
func (*Lexer) IsMode ¶
func (l *Lexer) IsMode(mode LexerModeKind) bool
func (*Lexer) NextRevise ¶
func (l *Lexer) NextRevise(v TokenValue) *Token
for tokens like `in` and `of`, they are firstly read as names and then switched to keywords by the parser according to its context, so it's necessary to revise the `prtVal` of lexer to the corresponding of that keywords for satisfying the further lookahead
func (*Lexer) Peek2nd ¶
guard the peeked buffer has at least 2 tokens, return the 2nd if the guarding is succeeded otherwise return the `EOF_TOK`
func (*Lexer) PeekStmtBegin ¶
func (*Lexer) PrevTok ¶
func (l *Lexer) PrevTok() TokenValue
func (*Lexer) PrevTokRng ¶ added in v0.0.10
func (*Lexer) PushMode ¶
func (l *Lexer) PushMode(mode LexerModeKind, inherit bool)
type LexerError ¶
type LexerError struct {
// contains filtered or unexported fields
}
func (*LexerError) Error ¶
func (e *LexerError) Error() string
type LexerModeKind ¶
type LexerModeKind int
const ( LM_NONE LexerModeKind = 0 LM_STRICT LexerModeKind = 1 << iota LM_TEMPLATE // for inline spans can tell they are in template string LM_TEMPLATE_TAGGED LM_ASYNC LM_GENERATOR LM_CLASS_BODY LM_CLASS_CTOR LM_NEW LM_JSX LM_JSX_CHILD LM_JSX_ATTR LM_TS LM_TS_TYP_ARG )
type LexerState ¶
type LexerState struct {
// contains filtered or unexported fields
}
consider the ambiguities introduced by TS grammar like `<`:
```ts a < b // binExpr a<b>() // callExpr ```
for dealing with above problem, parser should store its state when the first `<` is met before performing the `argList` processing, the stored state will be restored if the `argList` processing was failed or be discarded if `argList` was succeeded
type MemberExpr ¶
type MemberExpr struct {
// contains filtered or unexported fields
}
#[visitor(Obj,Prop)]
func (*MemberExpr) Compute ¶
func (n *MemberExpr) Compute() bool
func (*MemberExpr) Obj ¶
func (n *MemberExpr) Obj() Node
func (*MemberExpr) Optional ¶
func (n *MemberExpr) Optional() bool
func (*MemberExpr) OuterParen ¶
func (n *MemberExpr) OuterParen() span.Range
func (*MemberExpr) Prop ¶
func (n *MemberExpr) Prop() Node
func (*MemberExpr) Range ¶ added in v0.0.10
func (n *MemberExpr) Range() span.Range
func (*MemberExpr) SetOuterParen ¶
func (n *MemberExpr) SetOuterParen(rng span.Range)
func (*MemberExpr) Type ¶
func (n *MemberExpr) Type() NodeType
type MetaProp ¶
type MetaProp struct {
// contains filtered or unexported fields
}
#[visitor(Meta,Prop)]
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
#[visitor(Key,Val)]
func (*Method) SetTypInfo ¶
type ModifierNameLoc ¶
type ModifierNameLoc struct {
// contains filtered or unexported fields
}
type NewExpr ¶
type NewExpr struct {
// contains filtered or unexported fields
}
#[visitor(Callee,Args)]
func (*NewExpr) OuterParen ¶
func (*NewExpr) SetOuterParen ¶
func (*NewExpr) SetTypInfo ¶
type Node ¶
AST nodes are referred to [ESTree](https://github.com/estree/estree/blob/master/es5.md) with some variants:
- flattened struct is used instead of inheritance
- fields are not fully described as they are claimed in ESTree, eg. the field names in this file are shorter then their equivalent of ESTree. for the requirement what the ESTree compatible output is needed, use the `estree` package to do the transformation
func DecoratorsOf ¶
type NodeType ¶
type NodeType uint16
const ( N_ILLEGAL NodeType = iota N_PROG // #[visitor(Prog)] N_STMT_BEGIN N_STMT_EMPTY N_STMT_EXPR // #[visitor(ExprStmt)] N_STMT_VAR_DEC // #[visitor(VarDecStmt)] N_STMT_FN // #[visitor(FnDec)] N_STMT_BLOCK // #[visitor(BlockStmt)] N_STMT_DO_WHILE // #[visitor(DoWhileStmt)] N_STMT_WHILE // #[visitor(WhileStmt)] N_STMT_FOR // #[visitor(ForStmt)] N_STMT_FOR_IN_OF // #[visitor(ForInOfStmt)] N_STMT_IF // #[visitor(IfStmt)] N_STMT_SWITCH // #[visitor(SwitchStmt)] N_STMT_BRK // #[visitor(BrkStmt)] N_STMT_CONT // #[visitor(ContStmt)] N_STMT_LABEL // #[visitor(LabelStmt)] N_STMT_RET // #[visitor(RetStmt)] N_STMT_THROW // #[visitor(ThrowStmt)] N_STMT_TRY // #[visitor(TryStmt)] N_STMT_DEBUG // #[visitor(DebugStmt)] N_STMT_WITH // #[visitor(WithStmt)] N_STMT_CLASS // #[visitor(ClassDec)] N_STMT_IMPORT // #[visitor(ImportDec)] N_STMT_EXPORT // #[visitor(ExportDec)] N_STMT_END N_EXPR_BEGIN N_LIT_BEGIN N_LIT_NULL // #[visitor(NullLit)] N_LIT_BOOL // #[visitor(BoolLit)] N_LIT_NUM // #[visitor(NumLit)] N_LIT_STR // #[visitor(StrLit)] N_LIT_ARR // #[visitor(ArrLit)] N_LIT_OBJ // #[visitor(ObjLit)] N_LIT_REGEXP // #[visitor(RegLit)] N_LIT_END N_EXPR_NEW // #[visitor(NewExpr)] N_EXPR_MEMBER // #[visitor(MemberExpr)] N_EXPR_CALL // #[visitor(CallExpr)] N_EXPR_BIN // #[visitor(BinExpr)] N_EXPR_UNARY // #[visitor(UnaryExpr)] N_EXPR_UPDATE // #[visitor(UpdateExpr)] N_EXPR_COND // #[visitor(CondExpr)] N_EXPR_ASSIGN // #[visitor(AssignExpr)] N_EXPR_FN // #[visitor(FnDec)] N_EXPR_THIS // #[visitor(ThisExpr)] N_EXPR_PAREN // #[visitor(ParenExpr)] N_EXPR_ARROW // #[visitor(ArrowFn)] N_EXPR_SEQ // #[visitor(SeqExpr)] N_EXPR_CLASS // #[visitor(ClassDec)] N_EXPR_TPL // #[visitor(TplExpr)] N_EXPR_YIELD // #[visitor(YieldExpr)] N_EXPR_CHAIN // #[visitor(ChainExpr)] N_JSX_ELEM // #[visitor(JsxElem)] N_NAME // #[visitor(Ident)] N_IMPORT_CALL // #[visitor(ImportCall)] N_META_PROP // #[visitor(MetaProp)] N_DECORATOR // #[visitor(Decorator)] N_SPREAD // #[visitor(Spread)] N_EXPR_END N_VAR_DEC // #[visitor(VarDec)] N_PAT_REST // #[visitor(RestPat)] N_PAT_ARRAY // #[visitor(ArrPat)] N_PAT_ASSIGN // #[visitor(AssignPat)] N_PAT_OBJ // #[visitor(ObjPat)] N_PROP // #[visitor(Prop)] N_SWITCH_CASE // #[visitor(SwitchCase)] N_CATCH // #[visitor(Catch)] N_CLASS_BODY // #[visitor(ClassBody)] N_STATIC_BLOCK // #[visitor(StaticBlock)] N_METHOD // #[visitor(Method)] N_FIELD // #[visitor(Field)] N_SUPER // #[visitor(Super)] N_IMPORT_SPEC // #[visitor(ImportSpec)] N_EXPORT_SPEC // #[visitor(ExportSpec)] N_JSX_BEGIN N_JSX_ID // #[visitor(JsxIdent)] N_JSX_MEMBER // #[visitor(JsxMember)] N_JSX_NS // #[visitor(JsxNsName)] N_JSX_ATTR_SPREAD // #[visitor(JsxSpreadAttr)] N_JSX_CHILD_SPREAD // #[visitor(JsxSpreadChild)] N_JSX_OPEN // #[visitor(JsxOpen)] N_JSX_CLOSE // #[visitor(JsxClose)] N_JSX_EMPTY // #[visitor(JsxEmpty)] N_JSX_EXPR_SPAN // #[visitor(JsxExprSpan)] N_JSX_TXT // #[visitor(JsxText)] N_JSX_ATTR // #[visitor(JsxAttr)] N_JSX_END N_TS_BEGIN N_TS_TYP_ANNOT // #[visitor(TsTypAnnot)] N_TS_ANY // #[visitor(TsPredef)] N_TS_NUM // #[visitor(TsPredef)] N_TS_BOOL // #[visitor(TsPredef)] N_TS_STR // #[visitor(TsPredef)] N_TS_SYM // #[visitor(TsPredef)] N_TS_OBJ // #[visitor(TsPredef)] N_TS_VOID // #[visitor(TsPredef)] N_TS_NEVER // #[visitor(TsPredef)] N_TS_UNKNOWN // #[visitor(TsPredef)] N_TS_UNDEF // #[visitor(TsPredef)] N_TS_BIGINT // #[visitor(TsPredef)] N_TS_INTRINSIC // #[visitor(TsPredef)] N_TS_NULL // #[visitor(TsPredef)] N_TS_LIT // #[visitor(TsLit)] N_TS_REF // #[visitor(TsRef)] N_TS_LIT_OBJ // #[visitor(TsObj)] N_TS_ARR // #[visitor(TsArr)] N_TS_IDX_ACCESS // #[visitor(TsIdxAccess)] N_TS_TUPLE // #[visitor(TsTuple)] N_TS_REST // #[visitor(TsRest)] N_TS_TUPLE_NAMED_MEMBER // #[visitor(TsTupleNamedMember)] N_TS_OPT // #[visitor(TsOpt)] N_TS_TYP_QUERY // #[visitor(TsTypQuery)] N_TS_COND // #[visitor(TsCondType)] N_TS_TYP_OP // #[visitor(TsTypOp)] N_TS_MAPPED // #[visitor(TsMapped)] N_TS_TYP_INFER // #[visitor(TsTypInfer)] N_TS_PAREN // #[visitor(TsParen)] N_TS_THIS // #[visitor(TsThis)] N_TS_NS_NAME // #[visitor(TsNsName)] N_TS_PARAM // #[visitor(TsParam)] N_TS_PARAM_DEC // #[visitor(TsParamsDec)] N_TS_PARAM_INST // #[visitor(TsParamsInst)] N_TS_PROP // #[visitor(TsProp)] N_TS_CALL_SIG // #[visitor(TsCallSig)] N_TS_NEW_SIG // #[visitor(TsNewSig)] N_TS_IDX_SIG // #[visitor(TsIdxSig)] N_TS_FN_TYP // #[visitor(TsFnTyp)] N_TS_NEW // #[visitor(TsNewSig)] N_TS_UNION_TYP // #[visitor(TsUnionTyp)] N_TS_INTERSECT_TYP // #[visitor(TsIntersectTyp)] N_TS_ROUGH_PARAM // #[visitor(TsRoughParam)] N_TS_TYP_ASSERT // #[visitor(TsTypAssert)] N_TS_TYP_DEC // #[visitor(TsTypDec)] N_TS_INTERFACE // #[visitor(TsInterface)] N_TS_INTERFACE_BODY // #[visitor(TsInterfaceBody)] N_TS_ENUM // #[visitor(TsEnum)] N_TS_ENUM_MEMBER // #[visitor(TsEnumMember)] N_TS_IMPORT_ALIAS // #[visitor(TsImportAlias)] N_TS_NAMESPACE // #[visitor(TsNS)] N_TS_IMPORT_REQUIRE // #[visitor(TsImportRequire)] N_TS_IMPORT_TYP // #[visitor(TsImportType)] N_TS_EXPORT_ASSIGN // #[visitor(TsExportAssign)] N_TS_DEC_VAR_DEC // #[visitor(TsDec)] N_TS_DEC_FN // #[visitor(TsDec)] N_TS_DEC_ENUM // #[visitor(TsDec)] N_TS_DEC_CLASS // #[visitor(TsDec)] N_TS_DEC_NS // #[visitor(TsDec)] N_TS_DEC_MODULE // #[visitor(TsDec)] N_TS_DEC_GLOBAL // #[visitor(TsDec)] N_TS_DEC_INTERFACE // #[visitor(TsDec)] N_TS_DEC_TYP_DEC // #[visitor(TsDec)] N_TS_TYP_PREDICATE // #[visitor(TsTypPredicate)] N_TS_NO_NULL // #[visitor(TsNoNull)] N_TS_END N_NODE_DEF_END )
type NodeWithTypInfo ¶
type NullLit ¶
type NullLit struct {
// contains filtered or unexported fields
}
func (*NullLit) SetOuterParen ¶
func (*NullLit) SetTypInfo ¶
type NumLit ¶
type NumLit struct {
// contains filtered or unexported fields
}
func (*NumLit) OuterParen ¶
func (*NumLit) SetOuterParen ¶
type ObjLit ¶
type ObjLit struct {
// contains filtered or unexported fields
}
#[visitor(Props)]
func (*ObjLit) OuterParen ¶
func (*ObjLit) SetOuterParen ¶
func (*ObjLit) SetTypInfo ¶
type ObjPat ¶
type ObjPat struct {
// contains filtered or unexported fields
}
#[visitor(Props)]
func (*ObjPat) OuterParen ¶
func (*ObjPat) SetOuterParen ¶
func (*ObjPat) SetTypInfo ¶
type ParenExpr ¶
type ParenExpr struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
func (*ParenExpr) OuterParen ¶
func (*ParenExpr) SetOuterParen ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
parser is one-pass mode and returns the first error in which either syntax-error or semantic-error
it supports below syntaxes out-of-box by setting the `ParserOpts.Feature`:
- ecmascript up to 2020 - jsx - typescript
an AST couple with a Symtab will be constructed after the source is processed successfully
type ParserError ¶
type ParserError struct {
// contains filtered or unexported fields
}
func (*ParserError) Error ¶
func (e *ParserError) Error() string
func (*ParserError) MarshalJSON ¶
func (e *ParserError) MarshalJSON() ([]byte, error)
type ParserOpts ¶
func NewParserOpts ¶
func NewParserOpts() *ParserOpts
func (*ParserOpts) Clone ¶
func (o *ParserOpts) Clone() *ParserOpts
func (*ParserOpts) MergeJson ¶
func (o *ParserOpts) MergeJson(obj map[string]interface{})
type Ref ¶
type RefDefType ¶
type RefDefType uint32
const ( RDT_NONE RefDefType = 0 RDT_FN RefDefType = 1 << iota RDT_PVT_FIELD RDT_CLASS RDT_IMPORT RDT_ENUM RDT_CONST_ENUM RDT_ITF RDT_NS RDT_TYPE )
func (RefDefType) IsPureTyp ¶
func (t RefDefType) IsPureTyp() bool
func (RefDefType) IsPureVal ¶
func (t RefDefType) IsPureVal() bool
func (RefDefType) IsTyp ¶
func (t RefDefType) IsTyp() bool
func (RefDefType) IsVal ¶
func (t RefDefType) IsVal() bool
func (RefDefType) Off ¶
func (t RefDefType) Off(flag RefDefType) RefDefType
func (RefDefType) On ¶
func (t RefDefType) On(flag RefDefType) RefDefType
type RegLit ¶
type RegLit struct {
// contains filtered or unexported fields
}
func (*RegLit) OuterParen ¶
func (*RegLit) SetOuterParen ¶
func (*RegLit) SetTypInfo ¶
type RestPat ¶
type RestPat struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*RestPat) OuterParen ¶
func (*RestPat) SetOuterParen ¶
type Scope ¶
type Scope struct { // an auto-increment number which is generated according // the depth-first walk over the entire AST Id int Kind ScopeKind // the Node which introduces this Scope, only usable after the scope is post-process since // the Node has not been resolved before the scope leave, eg. `p.fnDec“ can also return `ArrowFn` Node Up *Scope Down []*Scope // labels can be redefined in their defined scope // so slice type used here Labels []Node // `IsBind` of the elems of the `scope.Refs` are all `true`, // `IsBind` of their children are `true` means `rebind` Refs map[string]*Ref // exports declared at this scope Exports []*ExportDec // contains filtered or unexported fields }
func (*Scope) OuterScope ¶
func (*Scope) UpperScope ¶
type ScopeKind ¶
type ScopeKind uint64
const ( SPK_NONE ScopeKind = 0 SPK_LOOP_DIRECT ScopeKind = 1 << iota SPK_LOOP_INDIRECT SPK_SWITCH SPK_SWITCH_INDIRECT SPK_STRICT SPK_STRICT_DIR SPK_TRY SPK_TRY_INDIRECT SPK_CATCH SPK_BLOCK SPK_GLOBAL SPK_INTERIM SPK_FUNC SPK_FUNC_INDIRECT SPK_ARROW SPK_ASYNC SPK_GENERATOR SPK_PAREN SPK_CLASS SPK_CLASS_INDIRECT SPK_CLASS_EXTEND_SUPER SPK_CLASS_HAS_SUPER SPK_CTOR SPK_LEXICAL_DEC SPK_SHORTHAND_PROP SPK_METHOD SPK_NOT_IN SPK_PROP_NAME SPK_FORMAL_PARAMS SPK_ABSTRACT_CLASS SPK_TS_DECLARE SPK_TS_MODULE SPK_TS_MODULE_INDIRECT SPK_TS_INTERFACE SPK_TS_MAY_INTRINSIC )
type SeqExpr ¶
type SeqExpr struct {
// contains filtered or unexported fields
}
#[visitor(Elems)]
func (*SeqExpr) OuterParen ¶
func (*SeqExpr) SetOuterParen ¶
type Spread ¶
type Spread struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*Spread) OuterParen ¶
func (*Spread) SetOuterParen ¶
func (*Spread) SetTypInfo ¶
type StaticBlock ¶
type StaticBlock struct {
// contains filtered or unexported fields
}
#[visitor(Body)]
func (*StaticBlock) Body ¶
func (n *StaticBlock) Body() []Node
func (*StaticBlock) Range ¶ added in v0.0.10
func (n *StaticBlock) Range() span.Range
func (*StaticBlock) SetTypInfo ¶
func (n *StaticBlock) SetTypInfo(ti *TypInfo)
func (*StaticBlock) TypInfo ¶
func (n *StaticBlock) TypInfo() *TypInfo
func (*StaticBlock) Type ¶
func (n *StaticBlock) Type() NodeType
type StrLit ¶
type StrLit struct {
// contains filtered or unexported fields
}
func (*StrLit) OuterParen ¶
func (*StrLit) SetOuterParen ¶
func (*StrLit) SetTypInfo ¶
type Super ¶
type Super struct {
// contains filtered or unexported fields
}
func (*Super) OuterParen ¶
func (*Super) SetOuterParen ¶
func (*Super) SetTypInfo ¶
type SwitchCase ¶
type SwitchCase struct {
// contains filtered or unexported fields
}
#[visitor(Test,Cons)]
func (*SwitchCase) Cons ¶
func (n *SwitchCase) Cons() []Node
func (*SwitchCase) Range ¶ added in v0.0.10
func (n *SwitchCase) Range() span.Range
func (*SwitchCase) Test ¶
func (n *SwitchCase) Test() Node
func (*SwitchCase) Type ¶
func (n *SwitchCase) Type() NodeType
type SwitchStmt ¶
type SwitchStmt struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Test,Cases)]
func (*SwitchStmt) Cases ¶
func (n *SwitchStmt) Cases() []Node
func (*SwitchStmt) Range ¶ added in v0.0.10
func (n *SwitchStmt) Range() span.Range
func (*SwitchStmt) Test ¶
func (n *SwitchStmt) Test() Node
func (*SwitchStmt) Type ¶
func (n *SwitchStmt) Type() NodeType
type SymTab ¶
type SymTab struct { Externals []string Scopes map[int]*Scope Root *Scope Cur *Scope // contains filtered or unexported fields }
func (*SymTab) EnterScope ¶
`settled` to increase the scope id, otherwise the new entered scope will be treated as a temporary one
func (*SymTab) HasExternal ¶
func (*SymTab) LeaveScope ¶
type ThisExpr ¶
type ThisExpr struct {
// contains filtered or unexported fields
}
func (*ThisExpr) OuterParen ¶
func (*ThisExpr) SetOuterParen ¶
func (*ThisExpr) SetTypInfo ¶
type ThrowStmt ¶
type ThrowStmt struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
type TokExtIdent ¶
type TokExtIdent struct {
ContainsEscape bool
}
type TokExtRegexp ¶
type TokExtRegexp struct {
// contains filtered or unexported fields
}
type TokExtTplSpan ¶
type TokExtTplSpan struct { Plain bool // from ES2018 and later the tagged template can contain // illegal escape sequence, here records loc of the illegal // sequence to report lexer error under ES2018 // see more details about that from: ES2018 revision of illegal escape sequences // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals IllegalEscape *IllegalEscapeInfo // contains filtered or unexported fields }
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func (*Token) CanBePropKey ¶
func (*Token) ContainsEscape ¶
func (*Token) HasLegacyOctalEscapeSeq ¶
func (*Token) IsPlainTpl ¶
func (*Token) Val ¶
func (t *Token) Val() TokenValue
type TokenKind ¶
type TokenKind struct { Value TokenValue Name string Pcd int RightAssoc bool // reference [acorn](https://github.com/acornjs/acorn/blob/master/acorn/src/tokentype.js) // `beforeExpr` is attached to each token to indicate that the slashes after those // tokens would be the beginning of regexps if the value of `beforeExpr` are `true`, works at // tokenizing phase BeforeExpr bool // `StartExpr` is attached to each token to indicate the token itself is the beginning of an expr, // it's used when parsing the argument of `yield` StartExpr bool }
type TokenValue ¶
type TokenValue int
const ( T_ILLEGAL TokenValue = iota T_EOF T_COMMENT // literals T_NULL T_TRUE T_FALSE T_NUM T_STRING T_TPL_HEAD T_TPL_SPAN T_TPL_TAIL T_NAME T_NAME_PVT // keywords // https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#prod-ReservedWord T_KEYWORD_BEGIN T_BREAK T_CASE T_CATCH T_CLASS T_CONTINUE T_DEBUGGER T_DEFAULT T_DO T_ELSE T_ENUM T_EXPORT T_EXTENDS T_FINALLY T_FOR T_FUNC T_IF T_IMPORT T_NEW T_RETURN T_SUPER T_SWITCH T_THIS T_THROW T_TRY T_VAR T_WHILE T_WITH T_KEYWORD_END // contextual keywords T_CTX_KEYWORD_BEGIN // token treated as keyword in strict mode T_CTX_KEYWORD_STRICT_BEGIN T_LET T_CONST T_STATIC T_IMPLEMENTS T_INTERFACE T_PACKAGE T_PRIVATE T_PROTECTED T_PUBLIC T_YIELD T_CTX_KEYWORD_STRICT_END T_AS T_ASYNC T_AWAIT T_FROM T_GET T_META T_OF T_SET T_TARGET T_CTX_KEYWORD_END T_REGEXP T_BACK_QUOTE T_BRACE_L T_BRACE_R T_PAREN_L T_PAREN_R T_BRACKET_L T_BRACKET_R T_DOT T_DOT_TRI T_SEMI T_COMMA T_HOOK T_COLON T_INC T_DEC T_OPT_CHAIN T_ARROW T_BIN_OP_BEGIN T_NULLISH // relational T_LT T_GT T_LTE T_GTE // equality T_EQ T_NE T_EQ_S T_NE_S // bitwise T_LSH T_RSH T_RSH_U T_BIT_OR T_BIT_XOR T_BIT_AND T_OR T_AND T_INSTANCE_OF T_IN T_ADD T_SUB T_MUL T_DIV T_MOD T_POW T_BIN_OP_END // unary T_UNARY_OP_BEGIN T_TYPE_OF T_VOID T_DELETE T_NOT T_BIT_NOT T_UNARY_OP_END // assignment T_ASSIGN_BEGIN T_ASSIGN T_ASSIGN_ADD T_ASSIGN_SUB T_ASSIGN_NULLISH T_ASSIGN_OR T_ASSIGN_AND T_ASSIGN_BIT_OR T_ASSIGN_BIT_XOR T_ASSIGN_BIT_AND T_ASSIGN_BIT_LSH T_ASSIGN_BIT_RSH T_ASSIGN_BIT_RSH_U T_ASSIGN_MUL T_ASSIGN_DIV T_ASSIGN_MOD T_ASSIGN_POW T_ASSIGN_END T_JSX_TXT T_HYPHEN T_TS_AS T_TS_NO_NULL T_AT T_TOKEN_DEF_END )
type TplExpr ¶
type TplExpr struct {
// contains filtered or unexported fields
}
there is no information kept to describe the program order of the quasis and expressions according to below link descries how the quasis and expression are being walk over: https://opensource.apple.com/source/WebInspectorUI/WebInspectorUI-7602.2.14.0.5/UserInterface/Workers/Formatter/ESTreeWalker.js.auto.html some meaningless output should be taken into its estree result, such as put first quasis as a empty string if the first element in `elems` is a expression
#[visitor(Tag,Elems)]
func (*TplExpr) OuterParen ¶
func (*TplExpr) SetOuterParen ¶
type TryStmt ¶
type TryStmt struct {
// contains filtered or unexported fields
}
#[visitor(Try,Catch,Fin)]
type TsArr ¶
type TsArr struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsArr) OuterParen ¶
func (*TsArr) SetOuterParen ¶
type TsCallSig ¶
type TsCallSig struct {
// contains filtered or unexported fields
}
#[visitor(TypParams,Params,RetTyp)]
type TsCheckParamOpts ¶
type TsCheckParamOpts struct {
// contains filtered or unexported fields
}
func NewTsCheckParamOpts ¶
func NewTsCheckParamOpts() *TsCheckParamOpts
type TsCondType ¶
type TsCondType struct {
// contains filtered or unexported fields
}
#[visitor(CheckTyp,ExtTyp,TrueTyp,FalseTyp)]
func (*TsCondType) CheckTyp ¶
func (n *TsCondType) CheckTyp() Node
func (*TsCondType) ExtTyp ¶
func (n *TsCondType) ExtTyp() Node
func (*TsCondType) FalseTyp ¶
func (n *TsCondType) FalseTyp() Node
func (*TsCondType) OuterParen ¶
func (n *TsCondType) OuterParen() span.Range
func (*TsCondType) Range ¶ added in v0.0.10
func (n *TsCondType) Range() span.Range
func (*TsCondType) SetOuterParen ¶
func (n *TsCondType) SetOuterParen(rng span.Range)
func (*TsCondType) TrueTyp ¶
func (n *TsCondType) TrueTyp() Node
func (*TsCondType) Type ¶
func (n *TsCondType) Type() NodeType
type TsEnum ¶
type TsEnum struct {
// contains filtered or unexported fields
}
#[visitor(Id,Members)]
type TsEnumMember ¶
type TsEnumMember struct {
// contains filtered or unexported fields
}
#[visitor(Key,Val)]
func (*TsEnumMember) Key ¶
func (n *TsEnumMember) Key() Node
func (*TsEnumMember) Range ¶ added in v0.0.10
func (n *TsEnumMember) Range() span.Range
func (*TsEnumMember) Type ¶
func (n *TsEnumMember) Type() NodeType
func (*TsEnumMember) Val ¶
func (n *TsEnumMember) Val() Node
type TsExportAssign ¶
type TsExportAssign struct {
// contains filtered or unexported fields
}
#[visitor(Expr)]
func (*TsExportAssign) Expr ¶
func (n *TsExportAssign) Expr() Node
func (*TsExportAssign) Range ¶ added in v0.0.10
func (n *TsExportAssign) Range() span.Range
func (*TsExportAssign) Type ¶
func (n *TsExportAssign) Type() NodeType
type TsFnTyp ¶
type TsFnTyp struct {
// contains filtered or unexported fields
}
#[visitor(TypParams,Params,RetTyp)]
func (*TsFnTyp) OuterParen ¶
func (*TsFnTyp) SetOuterParen ¶
type TsIdxAccess ¶
type TsIdxAccess struct {
// contains filtered or unexported fields
}
#[visitor(Obj,Idx)]
func (*TsIdxAccess) Idx ¶
func (n *TsIdxAccess) Idx() Node
func (*TsIdxAccess) Obj ¶
func (n *TsIdxAccess) Obj() Node
func (*TsIdxAccess) OuterParen ¶
func (n *TsIdxAccess) OuterParen() span.Range
func (*TsIdxAccess) Range ¶ added in v0.0.10
func (n *TsIdxAccess) Range() span.Range
func (*TsIdxAccess) SetOuterParen ¶
func (n *TsIdxAccess) SetOuterParen(rng span.Range)
func (*TsIdxAccess) Type ¶
func (n *TsIdxAccess) Type() NodeType
type TsIdxSig ¶
type TsIdxSig struct {
// contains filtered or unexported fields
}
#[visitor(Key,KeyType,Val)]
type TsImportAlias ¶
type TsImportAlias struct {
// contains filtered or unexported fields
}
#[visitor(Name,Val)]
func (*TsImportAlias) Export ¶
func (n *TsImportAlias) Export() bool
func (*TsImportAlias) Name ¶
func (n *TsImportAlias) Name() Node
func (*TsImportAlias) Range ¶ added in v0.0.10
func (n *TsImportAlias) Range() span.Range
func (*TsImportAlias) Type ¶
func (n *TsImportAlias) Type() NodeType
func (*TsImportAlias) Val ¶
func (n *TsImportAlias) Val() Node
type TsImportRequire ¶
type TsImportRequire struct {
// contains filtered or unexported fields
}
#[visitor(Name,Expr)]
func (*TsImportRequire) Expr ¶
func (n *TsImportRequire) Expr() Node
func (*TsImportRequire) Name ¶
func (n *TsImportRequire) Name() Node
func (*TsImportRequire) OuterParen ¶
func (n *TsImportRequire) OuterParen() span.Range
func (*TsImportRequire) Range ¶ added in v0.0.10
func (n *TsImportRequire) Range() span.Range
func (*TsImportRequire) SetOuterParen ¶
func (n *TsImportRequire) SetOuterParen(rng span.Range)
func (*TsImportRequire) Type ¶
func (n *TsImportRequire) Type() NodeType
type TsImportType ¶
type TsImportType struct {
// contains filtered or unexported fields
}
#[visitor(Arg,Qualifier,TypArg)]
func (*TsImportType) Arg ¶
func (n *TsImportType) Arg() Node
func (*TsImportType) OuterParen ¶
func (n *TsImportType) OuterParen() span.Range
func (*TsImportType) Qualifier ¶
func (n *TsImportType) Qualifier() Node
func (*TsImportType) Range ¶ added in v0.0.10
func (n *TsImportType) Range() span.Range
func (*TsImportType) SetOuterParen ¶
func (n *TsImportType) SetOuterParen(rng span.Range)
func (*TsImportType) TypArg ¶
func (n *TsImportType) TypArg() Node
func (*TsImportType) Type ¶
func (n *TsImportType) Type() NodeType
type TsInterface ¶
type TsInterface struct {
// contains filtered or unexported fields
}
#[visitor(Id,TypParams,Supers,Body)]
func (*TsInterface) Body ¶
func (n *TsInterface) Body() Node
func (*TsInterface) Id ¶
func (n *TsInterface) Id() Node
func (*TsInterface) Range ¶ added in v0.0.10
func (n *TsInterface) Range() span.Range
func (*TsInterface) Supers ¶
func (n *TsInterface) Supers() []Node
func (*TsInterface) TypParams ¶
func (n *TsInterface) TypParams() Node
func (*TsInterface) Type ¶
func (n *TsInterface) Type() NodeType
type TsInterfaceBody ¶
type TsInterfaceBody struct {
// contains filtered or unexported fields
}
#[visitor(Body)]
func (*TsInterfaceBody) Body ¶
func (n *TsInterfaceBody) Body() []Node
func (*TsInterfaceBody) Range ¶ added in v0.0.10
func (n *TsInterfaceBody) Range() span.Range
func (*TsInterfaceBody) Type ¶
func (n *TsInterfaceBody) Type() NodeType
type TsIntersectTyp ¶
type TsIntersectTyp struct {
// contains filtered or unexported fields
}
#[visitor(Elems)]
func (*TsIntersectTyp) Elems ¶
func (n *TsIntersectTyp) Elems() []Node
func (*TsIntersectTyp) OuterParen ¶
func (n *TsIntersectTyp) OuterParen() span.Range
func (*TsIntersectTyp) Range ¶ added in v0.0.10
func (n *TsIntersectTyp) Range() span.Range
func (*TsIntersectTyp) SetOuterParen ¶
func (n *TsIntersectTyp) SetOuterParen(rng span.Range)
func (*TsIntersectTyp) Type ¶
func (n *TsIntersectTyp) Type() NodeType
type TsLit ¶
type TsLit struct {
// contains filtered or unexported fields
}
#[visitor(Lit)]
func (*TsLit) OuterParen ¶
func (*TsLit) SetOuterParen ¶
type TsMapped ¶
type TsMapped struct {
// contains filtered or unexported fields
}
#[visitor(Name,Key,Val)]
func (*TsMapped) OptionalFmt ¶
func (n *TsMapped) OptionalFmt() interface{}
func (*TsMapped) OuterParen ¶
func (*TsMapped) ReadonlyFmt ¶
func (n *TsMapped) ReadonlyFmt() interface{}
func (*TsMapped) SetOuterParen ¶
type TsNewSig ¶
type TsNewSig struct {
// contains filtered or unexported fields
}
#[visitor(TypParams,Params,RetTyp)]
type TsNoNull ¶
type TsNoNull struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsNoNull) OuterParen ¶
func (*TsNoNull) SetOuterParen ¶
type TsNsName ¶
type TsNsName struct {
// contains filtered or unexported fields
}
#[visitor(Lhs,Rhs)]
func (*TsNsName) OuterParen ¶
func (*TsNsName) SetOuterParen ¶
type TsObj ¶
type TsObj struct {
// contains filtered or unexported fields
}
#[visitor(Props)]
func (*TsObj) OuterParen ¶
func (*TsObj) SetOuterParen ¶
type TsParam ¶
type TsParam struct {
// contains filtered or unexported fields
}
#[visitor(Name,Cons,Default)]
type TsParamsDec ¶
type TsParamsDec struct {
// contains filtered or unexported fields
}
#[visitor(Params)]
func (*TsParamsDec) Params ¶
func (n *TsParamsDec) Params() []Node
func (*TsParamsDec) Range ¶ added in v0.0.10
func (n *TsParamsDec) Range() span.Range
func (*TsParamsDec) Type ¶
func (n *TsParamsDec) Type() NodeType
type TsParamsInst ¶
type TsParamsInst struct {
// contains filtered or unexported fields
}
#[visitor(Params)]
func (*TsParamsInst) Params ¶
func (n *TsParamsInst) Params() []Node
func (*TsParamsInst) Range ¶ added in v0.0.10
func (n *TsParamsInst) Range() span.Range
func (*TsParamsInst) Type ¶
func (n *TsParamsInst) Type() NodeType
type TsParen ¶
type TsParen struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsParen) OuterParen ¶
func (*TsParen) SetOuterParen ¶
type TsPredef ¶
type TsPredef struct {
// contains filtered or unexported fields
}
func (*TsPredef) OuterParen ¶
func (*TsPredef) SetOuterParen ¶
type TsRef ¶
type TsRef struct {
// contains filtered or unexported fields
}
#[visitor(Name,Args)]
func (*TsRef) OuterParen ¶
func (*TsRef) ParamsInst ¶
func (*TsRef) SetOuterParen ¶
type TsRoughParam ¶
type TsRoughParam struct {
// contains filtered or unexported fields
}
func (*TsRoughParam) Range ¶ added in v0.0.10
func (n *TsRoughParam) Range() span.Range
func (*TsRoughParam) Type ¶
func (n *TsRoughParam) Type() NodeType
type TsThis ¶
type TsThis struct {
// contains filtered or unexported fields
}
func (*TsThis) OuterParen ¶
func (*TsThis) SetOuterParen ¶
type TsTuple ¶
type TsTuple struct {
// contains filtered or unexported fields
}
#[visitor(Args)]
func (*TsTuple) OuterParen ¶
func (*TsTuple) SetOuterParen ¶
type TsTupleNamedMember ¶
type TsTupleNamedMember struct {
// contains filtered or unexported fields
}
#[visitor(Label,Val)]
func (*TsTupleNamedMember) Label ¶
func (n *TsTupleNamedMember) Label() Node
func (*TsTupleNamedMember) Opt ¶
func (n *TsTupleNamedMember) Opt() bool
func (*TsTupleNamedMember) Range ¶ added in v0.0.10
func (n *TsTupleNamedMember) Range() span.Range
func (*TsTupleNamedMember) Type ¶
func (n *TsTupleNamedMember) Type() NodeType
func (*TsTupleNamedMember) Val ¶
func (n *TsTupleNamedMember) Val() Node
type TsTypAnnot ¶
type TsTypAnnot struct {
// contains filtered or unexported fields
}
#[visitor(TsTyp)]
func NewTsTypAnnot ¶
func NewTsTypAnnot(typ Node) *TsTypAnnot
func (*TsTypAnnot) Range ¶ added in v0.0.10
func (n *TsTypAnnot) Range() span.Range
func (*TsTypAnnot) TsTyp ¶
func (n *TsTypAnnot) TsTyp() Node
func (*TsTypAnnot) Type ¶
func (n *TsTypAnnot) Type() NodeType
type TsTypAssert ¶
type TsTypAssert struct {
// contains filtered or unexported fields
}
#[visitor(Typ,Expr)]
func (*TsTypAssert) Expr ¶
func (n *TsTypAssert) Expr() Node
func (*TsTypAssert) OuterParen ¶
func (n *TsTypAssert) OuterParen() span.Range
func (*TsTypAssert) Range ¶ added in v0.0.10
func (n *TsTypAssert) Range() span.Range
func (*TsTypAssert) SetOuterParen ¶
func (n *TsTypAssert) SetOuterParen(rng span.Range)
func (*TsTypAssert) Typ ¶
func (n *TsTypAssert) Typ() Node
func (*TsTypAssert) Type ¶
func (n *TsTypAssert) Type() NodeType
type TsTypDec ¶
type TsTypDec struct {
// contains filtered or unexported fields
}
#[visitor(Id,TypParams)]
type TsTypInfer ¶
type TsTypInfer struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsTypInfer) Arg ¶
func (n *TsTypInfer) Arg() Node
func (*TsTypInfer) OuterParen ¶
func (n *TsTypInfer) OuterParen() span.Range
func (*TsTypInfer) Range ¶ added in v0.0.10
func (n *TsTypInfer) Range() span.Range
func (*TsTypInfer) SetOuterParen ¶
func (n *TsTypInfer) SetOuterParen(rng span.Range)
func (*TsTypInfer) Type ¶
func (n *TsTypInfer) Type() NodeType
type TsTypOp ¶
type TsTypOp struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsTypOp) OuterParen ¶
func (*TsTypOp) SetOuterParen ¶
type TsTypPredicate ¶
type TsTypPredicate struct {
// contains filtered or unexported fields
}
[assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions) and [type-predicates](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) have almost the same syntax so they'll share the same definition by using `assert` to distinguish them
#[visitor(Name,Typ)]
func (*TsTypPredicate) Asserts ¶
func (n *TsTypPredicate) Asserts() bool
func (*TsTypPredicate) Name ¶
func (n *TsTypPredicate) Name() Node
func (*TsTypPredicate) OuterParen ¶
func (n *TsTypPredicate) OuterParen() span.Range
func (*TsTypPredicate) Range ¶ added in v0.0.10
func (n *TsTypPredicate) Range() span.Range
func (*TsTypPredicate) SetOuterParen ¶
func (n *TsTypPredicate) SetOuterParen(rng span.Range)
func (*TsTypPredicate) Typ ¶
func (n *TsTypPredicate) Typ() Node
func (*TsTypPredicate) Type ¶
func (n *TsTypPredicate) Type() NodeType
type TsTypQuery ¶
type TsTypQuery struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*TsTypQuery) Arg ¶
func (n *TsTypQuery) Arg() Node
func (*TsTypQuery) OuterParen ¶
func (n *TsTypQuery) OuterParen() span.Range
func (*TsTypQuery) Range ¶ added in v0.0.10
func (n *TsTypQuery) Range() span.Range
func (*TsTypQuery) SetOuterParen ¶
func (n *TsTypQuery) SetOuterParen(rng span.Range)
func (*TsTypQuery) Type ¶
func (n *TsTypQuery) Type() NodeType
type TsUnionTyp ¶
type TsUnionTyp struct {
// contains filtered or unexported fields
}
#[visitor(Elems)]
func (*TsUnionTyp) Elems ¶
func (n *TsUnionTyp) Elems() []Node
func (*TsUnionTyp) OuterParen ¶
func (n *TsUnionTyp) OuterParen() span.Range
func (*TsUnionTyp) Range ¶ added in v0.0.10
func (n *TsUnionTyp) Range() span.Range
func (*TsUnionTyp) SetOuterParen ¶
func (n *TsUnionTyp) SetOuterParen(rng span.Range)
func (*TsUnionTyp) Type ¶
func (n *TsUnionTyp) Type() NodeType
type TypInfo ¶
type TypInfo struct {
// contains filtered or unexported fields
}
func NewTypInfo ¶
func NewTypInfo() *TypInfo
func (*TypInfo) Decorators ¶
func (*TypInfo) Implements ¶
func (*TypInfo) SetAbstract ¶
func (*TypInfo) SetBeginRng ¶ added in v0.0.10
func (*TypInfo) SetDeclare ¶
func (*TypInfo) SetImplements ¶
func (*TypInfo) SetOverride ¶
func (*TypInfo) SetReadonly ¶
func (*TypInfo) SetSuperTypArgs ¶
func (*TypInfo) SetTypAnnot ¶
func (*TypInfo) SetTypArgs ¶
func (*TypInfo) SetTypParams ¶
func (*TypInfo) SuperTypArgs ¶
func (*TypInfo) TypAnnot ¶
func (ti *TypInfo) TypAnnot() *TsTypAnnot
type UnaryExpr ¶
type UnaryExpr struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*UnaryExpr) Op ¶
func (n *UnaryExpr) Op() TokenValue
func (*UnaryExpr) OuterParen ¶
func (*UnaryExpr) SetOuterParen ¶
type UpdateExpr ¶
type UpdateExpr struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]
func (*UpdateExpr) Arg ¶
func (n *UpdateExpr) Arg() Node
func (*UpdateExpr) Op ¶
func (n *UpdateExpr) Op() TokenValue
func (*UpdateExpr) OpText ¶
func (n *UpdateExpr) OpText() string
func (*UpdateExpr) OuterParen ¶
func (n *UpdateExpr) OuterParen() span.Range
func (*UpdateExpr) Prefix ¶
func (n *UpdateExpr) Prefix() bool
func (*UpdateExpr) Range ¶ added in v0.0.10
func (n *UpdateExpr) Range() span.Range
func (*UpdateExpr) SetOuterParen ¶
func (n *UpdateExpr) SetOuterParen(rng span.Range)
func (*UpdateExpr) Type ¶
func (n *UpdateExpr) Type() NodeType
type VarDecStmt ¶
type VarDecStmt struct {
// contains filtered or unexported fields
}
#[visitor(DecList)]
func (*VarDecStmt) DecList ¶
func (n *VarDecStmt) DecList() []Node
func (*VarDecStmt) Kind ¶
func (n *VarDecStmt) Kind() string
func (*VarDecStmt) Names ¶
func (n *VarDecStmt) Names() []Node
func (*VarDecStmt) Range ¶ added in v0.0.10
func (n *VarDecStmt) Range() span.Range
func (*VarDecStmt) Type ¶
func (n *VarDecStmt) Type() NodeType
type WhileStmt ¶
type WhileStmt struct {
// contains filtered or unexported fields
}
#[visitor(PUSH_SCOPE,Test,Body)]
type WithStmt ¶
type WithStmt struct {
// contains filtered or unexported fields
}
#[visitor(Expr,Body)]
type YieldExpr ¶
type YieldExpr struct {
// contains filtered or unexported fields
}
#[visitor(Arg)]