Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Single char tokens are themselves. ADD = '+' SUB = '-' MUL = '*' QUO = '/' REM = '%' AND = '&' OR = '|' XOR = '^' QUESTION = '?' HASH = '#' LSS = '<' GTR = '>' ASSIGN = '=' NOT = '!' BNOT = '~' LPAREN = '(' LBRACK = '[' LBRACE = '{' COMMA = ',' PERIOD = '.' RPAREN = ')' RBRACK = ']' RBRACE = '}' SEMICOLON = ';' COLON = ':' ERROR = 10000 + iota EOF //some cpp only tokens FUNCLIKE_DEFINE //Occurs after ident before paren #define ident( DIRECTIVE //#if #include etc END_DIRECTIVE //New line at the end of a directive HEADER // Identifiers and basic type literals // (these tokens stand for classes of literals) IDENT // main INT_CONSTANT // 12345 FLOAT_CONSTANT // 123.45 CHAR_CONSTANT // 'a' STRING // "abc" SHL // << SHR // >> ADD_ASSIGN // += SUB_ASSIGN // -= MUL_ASSIGN // *= QUO_ASSIGN // /= REM_ASSIGN // %= AND_ASSIGN // &= OR_ASSIGN // |= XOR_ASSIGN // ^= SHL_ASSIGN // <<= SHR_ASSIGN // >>= LAND // && LOR // || ARROW // -> INC // ++ DEC // -- EQL // == NEQ // != LEQ // <= GEQ // >= ELLIPSIS // ... // Keywords REGISTER EXTERN STATIC SHORT BREAK CASE DO CONST CONTINUE DEFAULT ELSE FOR WHILE GOTO IF RETURN STRUCT UNION VOLATILE SWITCH TYPEDEF SIZEOF VOID CHAR INT FLOAT DOUBLE SIGNED UNSIGNED LONG )
The list of tokens.
Variables ¶
This section is empty.
Functions ¶
func ErrWithLoc ¶
Types ¶
type IncludeSearcher ¶
type IncludeSearcher interface { //IncludeQuote is invoked when the preprocessor //encounters an include of the form #include "foo.h". //returns the full path of the file, a reader of the contents or an error. IncludeQuote(requestingFile, headerPath string) (string, io.Reader, error) //IncludeAngled is invoked when the preprocessor //encounters an include of the form #include <foo.h>. //returns the full path of the file, a reader of the contents or an error. IncludeAngled(requestingFile, headerPath string) (string, io.Reader, error) }
func NewStandardIncludeSearcher ¶
func NewStandardIncludeSearcher(includePaths string) IncludeSearcher
A ; seperated list of paths
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
type Preprocessor ¶
type Preprocessor struct {
// contains filtered or unexported fields
}
func New ¶
func New(l *Lexer, is IncludeSearcher) *Preprocessor
func (*Preprocessor) Next ¶
func (pp *Preprocessor) Next() (t *Token, err error)
type StandardIncludeSearcher ¶
type StandardIncludeSearcher struct {
// contains filtered or unexported fields
}
func (*StandardIncludeSearcher) IncludeAngled ¶
func (*StandardIncludeSearcher) IncludeQuote ¶
Click to show internal directories.
Click to hide internal directories.