Purple
0.1
Standard Language Specification
|
Lexical Scanner function headers. More...
Go to the source code of this file.
Classes | |
struct | position |
Structure containing information about a Token's position in the input. More... | |
struct | Token |
Structure containing information about individual scannable tokens. More... | |
Macros | |
#define | NUMBER_LITERAL_BASE_PREFIX '0' |
#define | NUMBER_LITERAL_BIN_PREFIX 'b' |
#define | NUMBER_LITERAL_OCT_PREFIX 'o' |
#define | NUMBER_LITERAL_HEX_PREFIX 'x' |
#define | NUMBER_LITERAL_LONG_SUFFIX 'L' |
#define | NUMBER_LITERAL_SPACING_SEPARATOR '\'' |
#define | NUMBER_LITERAL_BASE_SEPARATOR '#' |
#define | TOKENTYPE_IS_BINARY_ARITHMETIC(type) (type >= T_PLUS && type <= T_EXPONENT) |
Determines if a TokenType is associated with a binary arithmetic operation. More... | |
#define | TOKENTYPE_IS_TYPE(type) (type >= T_VOID && type <= T_LONG) |
Determines if a TokenType is associated with a type keyword. More... | |
#define | TOKENTYPE_IS_NUMBER_TYPE(tt) ((tt >= T_BOOL && tt <= T_LONG) || (T_TRUE <= tt && tt <= T_LONG_LITERAL)) |
Determines if a TokenType is associated with a number type keyword or a number literal. More... | |
#define | TOKENTYPE_IS_LITERAL(type) (type >= T_TRUE && type <= T_LONG_LITERAL) |
Determines if a TokenType is associated with a literal value. More... | |
#define | TOKENTYPE_IS_BOOL_LITERAL(type) (type >= T_TRUE && type <= T_FALSE) |
Determines if a TokenType is associated with a boolean literal value. More... | |
#define | TOKENTYPE_IS_COMPARATOR(type) (type >= T_EQ && type <= T_GE) |
Determines if a TokenType is associated with a comparison operator. More... | |
#define | TOKENTYPE_IS_LOGICAL_OPERATOR(type) (type >= T_AND && type <= T_XNOR) |
Determines if a TokenType is associated with a logical operator. More... | |
#define | number_literal_type long long int |
Number literals can have a max value of 2^63 - 1 and a min value of -2^63. More... | |
#define | MAX_NUMBER_LITERAL_DIGITS 19 |
len(str(2^63)) = 19 More... | |
Typedefs | |
typedef struct position | position |
Structure containing information about a Token's position in the input. More... | |
typedef struct Token | Token |
Structure containing information about individual scannable tokens. More... | |
Enumerations | |
enum | TokenType { T_EOF , T_PLUS , T_MINUS , T_STAR , T_SLASH , T_EXPONENT , T_EQ , T_NEQ , T_LT , T_GT , T_LE , T_GE , T_AND , T_OR , T_XOR , T_NAND , T_NOR , T_XNOR , T_AMPERSAND , T_DEREFERENCE , T_TRUE , T_FALSE , T_CHAR_LITERAL , T_SHORT_LITERAL , T_INTEGER_LITERAL , T_LONG_LITERAL , T_VOID , T_BOOL , T_CHAR , T_SHORT , T_INT , T_LONG , T_ASSIGN , T_PRINT , T_IF , T_ELSE , T_WHILE , T_FOR , T_RETURN , T_SEMICOLON , T_LEFT_PAREN , T_RIGHT_PAREN , T_LEFT_BRACE , T_RIGHT_BRACE , T_IDENTIFIER , T_COMMA , T_AST_GLUE , T_FUNCTION_DECLARATION , T_FUNCTION_CALL , TOKENTYPE_MAX } |
Types of scannable tokens. More... | |
Functions | |
char | next (void) |
Get the next valid character from the current input file. More... | |
void | put_back_into_stream (char c) |
Put a character back into the input stream. More... | |
bool | scan () |
Scan tokens into the Token struct. More... | |
Variables | |
static char * | tokenStrings [] |
Token string equivalents. More... | |
Lexical Scanner function headers.
#define MAX_NUMBER_LITERAL_DIGITS 19 |
len(str(2^63)) = 19
#define NUMBER_LITERAL_BASE_PREFIX '0' |
#define NUMBER_LITERAL_BASE_SEPARATOR '#' |
#define NUMBER_LITERAL_BIN_PREFIX 'b' |
#define NUMBER_LITERAL_HEX_PREFIX 'x' |
#define NUMBER_LITERAL_LONG_SUFFIX 'L' |
#define NUMBER_LITERAL_OCT_PREFIX 'o' |
#define NUMBER_LITERAL_SPACING_SEPARATOR '\'' |
#define number_literal_type long long int |
Number literals can have a max value of 2^63 - 1 and a min value of -2^63.
#define TOKENTYPE_IS_BINARY_ARITHMETIC | ( | type | ) | (type >= T_PLUS && type <= T_EXPONENT) |
Determines if a TokenType is associated with a binary arithmetic operation.
Determines if a TokenType is associated with a boolean literal value.
Determines if a TokenType is associated with a comparison operator.
#define TOKENTYPE_IS_LITERAL | ( | type | ) | (type >= T_TRUE && type <= T_LONG_LITERAL) |
Determines if a TokenType is associated with a literal value.
Determines if a TokenType is associated with a logical operator.
#define TOKENTYPE_IS_NUMBER_TYPE | ( | tt | ) | ((tt >= T_BOOL && tt <= T_LONG) || (T_TRUE <= tt && tt <= T_LONG_LITERAL)) |
Determines if a TokenType is associated with a number type keyword or a number literal.
Determines if a TokenType is associated with a type keyword.
Structure containing information about a Token's position in the input.
enum TokenType |
Types of scannable tokens.
char next | ( | void | ) |
Get the next valid character from the current input file.
void put_back_into_stream | ( | char | c | ) |
Put a character back into the input stream.
c | Character to be placed into the input stream |
bool scan | ( | ) |
|
static |
Token string equivalents.