Documentation
¶
Overview ¶
Package lexer 将 waiton-script 源码切分为 token 流。
处理:// 行注释、字符串字面量("...",内部标点不被切分)、 基础标点 { } ( ) ; , . = 以及标识符/关键字。空白被跳过。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Token ¶
Token 是词法单元。
type TokenType ¶
type TokenType int
TokenType 区分 token 类别。
const ( EOF TokenType = iota Ident String // 标点 PuncLBrace // { PuncRBrace // } PuncLParen // ( PuncRParen // ) PuncSemicolon PuncComma PuncDot PuncAssign // = PuncColon // : PuncLBracket // [ PuncRBracket // ] PuncHash // # 注解前缀(子集统一用 #:吸收 PS 声明上方注解模型,参数体用 {};子集无语言内置注解层,标准库是注入物非内置) OpArrow // -> OpQuestion // ? OpRange // .. OpEllipsis // ... // 运算符 OpPlus // + OpMinus // - OpStar // * OpSlash // / OpMod // % OpEq // == OpNeq // != OpLt // < OpGt // > OpLe // <= OpGe // >= OpAnd // && OpOr // || OpNot // ! // 关键字 KwUse KwWorld KwFunc KwSelf KwIf KwElse KwFor KwWhile KwLoop KwBreak KwContinue KwMatch KwReturn KwIn KwLet KwAny KwTrue KwFalse Number // 数字字面量(整数/浮点起始) Comment // 注释(// 行注释或 /* */ 块注释;text 为去注释符号的内容) )
Source Files
¶
- lexer.go
Click to show internal directories.
Click to hide internal directories.