TokenBase
Base class for operators and literals, mainly for debugging and for throwing syntax errors.
Attributes
| Attribute | Type | Description |
|---|---|---|
| id | string = null | node/token type name |
| value | string = null | used by literals |
| first | object = null | used by tree nodes |
Methods
nud()
@classmethod
def nud(
parser: [Parser](../../test/html/parser.md?sid=django_test_html_parser)
) - > null
Null denotation - called in prefix context. Raises a syntax error because the token is not expected in a prefix position within an if tag.
Parameters
| Name | Type | Description |
|---|---|---|
| parser | [Parser](../../test/html/parser.md?sid=django_test_html_parser) | The parser instance used to raise the syntax error with context-specific information |
Returns
| Type | Description |
|---|---|
null |
led()
@classmethod
def led(
left: [TokenBase](tokenbase.md?sid=django_template_smartif_tokenbase),
parser: [Parser](../../test/html/parser.md?sid=django_test_html_parser)
) - > null
Left denotation - called in infix context. Raises a syntax error because the token is not expected as an infix operator within an if tag.
Parameters
| Name | Type | Description |
|---|---|---|
| left | [TokenBase](tokenbase.md?sid=django_template_smartif_tokenbase) | The token or node appearing to the left of this operator |
| parser | [Parser](../../test/html/parser.md?sid=django_test_html_parser) | The parser instance used to raise the syntax error with context-specific information |
Returns
| Type | Description |
|---|---|
null |
display()
@classmethod
def display() - > string
Return what to display in error messages for this node
Returns
| Type | Description |
|---|---|
string | The node or token type name used for identification in error reports |