Documentation ¶
Index ¶
- Constants
- Variables
- type Position
- type Token
- func (t Token) Fork(tp Type) Token
- func (t Token) Is(text ...string) bool
- func (t Token) IsBaseType() bool
- func (t Token) IsComment() bool
- func (t Token) IsDocument() bool
- func (t Token) IsEmptyString() bool
- func (t Token) IsHttpMethod() bool
- func (t Token) IsKeyword() bool
- func (t Token) IsType(tp Type) bool
- func (t Token) Line() int
- func (t Token) String() string
- func (t Token) Valid() bool
- type Type
Constants ¶
View Source
const ( Syntax = "syntax" Info = "info" Service = "service" Returns = "returns" Any = "any" TypeKeyword = "type" MapKeyword = "map" ImportKeyword = "import" )
Variables ¶
View Source
var EofToken = Token{Type: EOF}
EofToken is the end of file token.
View Source
var ErrorToken = Token{Type: error}
ErrorToken is the error token.
View Source
var HttpMethods = []interface{}{"get", "head", "post", "put", "patch", "delete", "connect", "options", "trace"}
HttpMethods returns the http methods.
View Source
var IllegalPosition = Position{}
IllegalPosition is a position that is not valid.
Functions ¶
This section is empty.
Types ¶
type Token ¶
Token is the token of a rune.
func NewIllegalToken ¶
NewIllegalToken returns a new illegal token.
func (Token) IsBaseType ¶
IsBaseType returns true if the token is base type.
func (Token) IsDocument ¶
IsDocument returns true if the token is document.
func (Token) IsEmptyString ¶
IsEmptyString returns true if the token is empty string.
func (Token) IsHttpMethod ¶
IsHttpMethod returns true if the token is http method.
type Type ¶
type Type int
Type is the type of token.
const ( ILLEGAL Type EOF COMMENT DOCUMENT IDENT // main INT // 123 DURATION // 3s,3ms STRING // "abc" RAW_STRING // `abc` PATH // `abc` KEY // `abc:` SUB // - MUL // * QUO // / ASSIGN // = LPAREN // ( LBRACK // [ LBRACE // { COMMA // , DOT // . RPAREN // ) RBRACE // } RBRACK // ] SEMICOLON // ; COLON // : ELLIPSIS BREAK CASE CHAN CONST CONTINUE DEFAULT DEFER ELSE FALLTHROUGH FOR FUNC GO GOTO IF IMPORT INTERFACE MAP PACKAGE RANGE RETURN SELECT STRUCT SWITCH TYPE VAR AT_DOC AT_HANDLER AT_SERVER ANY )
func LookupKeyword ¶
LookupKeyword returns the keyword type if the given ident is keyword.
Click to show internal directories.
Click to hide internal directories.