Expand description
This module provides a set of literal types that can be used to parse and tokenize
literals. The literals are parsed from the token stream and can be used to represent the
parsed value. unsynn defines only simplified literals, such as integers, characters and
strings. The literals here are not full rust syntax, which will be defined in the
unsynn-rust crate. There are Literal* for Integer, Character, String to parse simple
literals and ConstInteger<V> and ConstCharacter<V> who must match an exact character.
The later two also implement Default, thus they can be used to create constant tokens.
There is no ConstString; constant literal strings can be constructed with
IntoLiteralString<T>.
Structsยง
- Const
Character - A constant
charof valueV. Must match V and also hasDefaultimplemented to create aLiteralCharacterwith valueV. - Const
Integer - A constant
u128integer of valueV. Must match V and also hasDefaultimplemented to create aLiteralIntegerwith valueV. - Literal
Character - A single quoted character literal (
'x'). - Literal
Integer - A simple unsigned 128 bit integer. This is the most simple form to parse integers. Note that only decimal integers without any other characters, signs or suffixes are supported, this is not full rust syntax.
- Literal
String - A double quoted string literal (
"hello"). The quotes are included in the value. Note that this is a simplified string literal, and only double quoted strings are supported, this is not full rust syntax, eg. byte and C string literals are not supported.