Module literal

Module literal 

Source
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ยง

ConstCharacter
A constant char of value V. Must match V and also has Default implemented to create a LiteralCharacter with value V.
ConstInteger
A constant u128 integer of value V. Must match V and also has Default implemented to create a LiteralInteger with value V.
LiteralCharacter
A single quoted character literal ('x').
LiteralInteger
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.
LiteralString
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.