plush: github.com/gobuffalo/plush/token Index | Files

package token

import "github.com/gobuffalo/plush/token"

Index

Package Files

const.go token.go

Constants

const (
    ILLEGAL = "ILLEGAL"
    EOF     = "EOF"

    // Identifiers + literals
    IDENT    = "IDENT"    // add, foobar, x, y, ...
    INT      = "INT"      // 1343456
    FLOAT    = "FLOAT"    // 12.34
    STRING   = "STRING"   // "foobar"
    B_STRING = "B_STRING" // `foobar`
    HTML     = "HTML"     // <p>adf</p>
    DOT      = "DOT"      // .23

    // Operators
    ASSIGN   = "="
    PLUS     = "+"
    MINUS    = "-"
    BANG     = "!"
    ASTERISK = "*"
    SLASH    = "/"
    PERCENT  = "%"

    LT   = "<"
    LTEQ = "<="
    GT   = ">"
    GTEQ = ">="

    EQ      = "=="
    NOT_EQ  = "!="
    AND     = "&&"
    OR      = "||"
    MATCHES = "~="

    S_START = "<%"
    C_START = "<%#"
    E_START = "<%="
    E_END   = "%>"

    COMMA     = ","
    SEMICOLON = ";"
    COLON     = ":"

    LPAREN   = "("
    RPAREN   = ")"
    LBRACE   = "{"
    RBRACE   = "}"
    LBRACKET = "["
    RBRACKET = "]"

    // Keywords
    FUNCTION = "FUNCTION"
    LET      = "LET"
    TRUE     = "TRUE"
    FALSE    = "FALSE"
    IF       = "IF"
    ELSE     = "ELSE"
    RETURN   = "RETURN"
    FOR      = "FOR"
    IN       = "IN"
)

type Token Uses

type Token struct {
    Type       Type
    Literal    string
    LineNumber int
}

Token of a section of input source.

type Type Uses

type Type string

Type represents each type of token.

func LookupIdent Uses

func LookupIdent(ident string) Type

LookupIdent an ident and return a keyword type, or a plain ident

Package token is imported by 6 packages. Updated 2018-07-24. Refresh now. Tools for package owners.