synt.tokens.ident
¤
id_
module-attribute
¤
|
Alias Identifier
.
Notes
id
is a built-in function in Python, so it's renamed to id_
with a suffix.
Identifier
¤
Bases: IntoExpression
, IntoCode
Represents a valid Python identifier.
For more information, see the Identifier and Keywords section of the Python's standard documentation.
Source code in synt/tokens/ident.py
__init__
¤
Initialize a new identifier.
The raw content will be checked immediately when initializing the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw |
str
|
Raw identifier text. |
required |
Raises:
Type | Description |
---|---|
InvalidIdentifierException
|
If the raw identifier text is not a valid identifier. |
Examples:
Source code in synt/tokens/ident.py
into_expression
¤
|
expr
¤
|
Initialize a new expression with self
.
Alias for into_expression
.
Examples:
Source code in synt/tokens/ident.py
into_code
¤
as_
¤
|
Construct a new alias.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alias |
Identifier
|
The alias name. |
required |
IdentifierExpr
¤
Bases: Expression
An identifier as a Python expression.
See Identifier
for more information.
Source code in synt/tokens/ident.py
__init__
¤
|
Initialize a new identifier.
Use Identifier
instead and converts it into an expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw |
Identifier
|
Identifier to be used as an expression. |
required |
Source code in synt/tokens/ident.py
from_str
staticmethod
¤
|
Parse an identifier from a string.
The raw content will be checked immediately when initializing the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s |
str
|
Raw identifier text. |
required |
Raises:
Type | Description |
---|---|
InvalidIdentifierException
|
If the raw identifier text is not a valid identifier. |