An operator for a given symbol or outcome in a state.
More...
|
enum | PDOperatorType {
PDOperatorPushState = 1,
PDOperatorPushWeakState,
PDOperatorPopState,
PDOperatorPopVariable,
PDOperatorPopValue,
PDOperatorPushEmptyString,
PDOperatorPushResult,
PDOperatorPushComplex,
PDOperatorStoveComplex,
PDOperatorPullBuildVariable,
PDOperatorPushbackSymbol,
PDOperatorPushbackValue,
PDOperatorPopLine,
PDOperatorReadToDelimiter,
PDOperatorMark,
PDOperatorPushMarked,
PDOperatorNOP,
PDOperatorBreak
} |
|
An operator for a given symbol or outcome in a state.
Operators are either tied to some symbol in a state, or to one of the fallback types (numeric, delimiter, and the all-accepting). They define some form of action that should occur, and may optionally include a "next" operator, which is executed directly following the completion of the current operator's action.
- Note
- If an operator pushes a state, its action will be regarded as ongoing until the pushed state is poppsed again.
#define PDSymbolDetermineNumeric |
( |
|
numeric, |
|
|
|
real, |
|
|
|
c, |
|
|
|
sym, |
|
|
|
len |
|
) |
| |
Value:
for (i = len-1; numeric && i >= 0; i--) { \
} \
} while (0)
long PDInteger
Definition: PDDefines.h:184
#define PDSymbolUpdateNumeric(numeric, real, c, first_character)
Definition: PDOperator.h:109
Set numeric and real for the given symbol over the given length.
- Parameters
-
numeric | The numeric boolean. |
real | The real boolean. |
c | The character. |
sym | The symbol buffer. |
len | The length of the symbol. |
#define PDSymbolUpdateNumeric |
( |
|
numeric, |
|
|
|
real, |
|
|
|
c, |
|
|
|
first_character |
|
) |
| |
Value:numeric &= ((c >= '0' && c <= '9') \
|| \
(first_character && (c == '-' || c == '+')) \
|| \
(! real && (real |= c == '.')))
Update the numeric and real booleans based on the character.
- Parameters
-
numeric | The numeric boolean. |
real | The real boolean. |
c | The character. |
first_character | Whether or not this is the first character. |
Operator type.
Pajdeg's internal parser is configured using a set of states and operators. Operators are defined using a PDOperatorType, and an appropriate unioned argument.
- See also
- pd_pdf_implementation.h
Enumerator |
---|
PDOperatorPushState |
Pushes another state; e.g. "<" pushes dict_hex, which on seeing "<" pushes "dict".
|
PDOperatorPushWeakState |
Identical to above, but does not 'retain' the target state, to prevent retain cycles (e.g. arb -> array -> arb -> ...)
|
PDOperatorPopState |
Pops back to previous state.
|
PDOperatorPopVariable |
Pops entry off of results stack and stores as an attribute of a future complex result.
|
PDOperatorPopValue |
Pops entry off of results stack and stores in variable stack, without including a variable name.
|
PDOperatorPushEmptyString |
Pushes an empty string onto the results stack.
|
PDOperatorPushResult |
Pushes current symbol onto results stack.
|
PDOperatorPushComplex |
Pushes object of type description "key" with variables (if any) as attributes onto results stack.
|
PDOperatorStoveComplex |
Pushes a complex onto build stack rather than results stack (for popping as a chunk of objects later)
|
PDOperatorPullBuildVariable |
Takes build stack as is, and stores it as if it was a popped variable.
|
PDOperatorPushbackSymbol |
Pushes the scanned symbol back onto the symbols stack, so that it is re-read the next time a symbol is popped from the scanner.
|
PDOperatorPushbackValue |
Pushes the top value on the stack onto the symbols stack as if it were never read.
|
PDOperatorPopLine |
Read to end of line.
|
PDOperatorReadToDelimiter |
Read over symbols and whitespace until a delimiter is encountered.
|
PDOperatorMark |
Mark current position in buffer for popping as is into results later.
|
PDOperatorPushMarked |
Push everything from mark to current position in buffer as results.
|
PDOperatorNOP |
Do nothing.
|
PDOperatorBreak |
Break (presuming breakpoint is properly placed)
|
Compile all states referenced by the operator.
- See also
- PDStateCompile
- Parameters
-
PDOperatorRef PDOperatorCreateFromDefinition |
( |
const void ** |
defs | ) |
|
Create a PDOperatorRef chain based on a definition in the form of NULL terminated arrays of operator types followed by (if any) arguments of corresponding types.
- Parameters
-
defs | Definitions, null terminated. |
- Todo:
- CLANG doesn't like homemade retaining
char PDOperatorSymbolGlobDefine |
( |
char * |
str | ) |
|
Define the given symbol. Definitions detected are delimiters, numeric (including real) values, and (regular) symbols.
void PDOperatorSymbolGlobSetup |
( |
| ) |
|
Set up the global symbol table.
char* PDOperatorSymbolGlob |
Global symbol table, a 256 byte mapping of ASCII characters to their corresponding PDF symbol type as defined in the PDF specification (v 1.7).
char* PDOperatorSymbolGlobDehex |
Global de-HEX table, a 16 (NOT 256) byte mapping of 0 through 15, where 0..9 return '0'..'9' and 10..15 return 'A'..'F'
char* PDOperatorSymbolGlobEscaping |
Global escape table, a 256 byte mapping of ASCII characters to 1 for "no escape", 0 for "escape as code", and a character for "escape using this escape code".
char* PDOperatorSymbolGlobHex |
Global HEX table, a 256 byte mapping of ASCII characters to their corresponding numeric values according to the hexademical system.