moonrockz/gleam-parser/scanner does not have a README file
pub(all) enum LexicalErrorType {
BadStringEscape
InvalidUnicodeEscape(UnicodeEscapeError)
DigitOutOfRadix
NumTrailingUnderscore
RadixIntNoValue
MissingExponent
UnexpectedStringEnd
UnrecognizedToken(Char)
InvalidTripleEqual
MergeConflictIndicator
UnsupportedProceduralOperator
VisuallySimilarInvalidCharacter(name~ : String, correct~ : String)
} derive(Eq, Debug)pub struct SourceText {
// private fields
}test {
let st = @scanner.SourceText::new("é\nx")
debug_inspect(st.byte_length(), content="4")
debug_inspect(st.position_of(3), content="Some({ line: 2, column: 1 })")
debug_inspect(st.utf16_offset_of(3), content="Some(2)")
}pub(all) enum TokenKind {
Name(String)
UpName(String)
DiscardName(String)
Int(value~ : String, int_value~ : BigInt)
Float(value~ : String, float_value~ : Double)
String(String)
LeftParen
RightParen
LeftSquare
RightSquare
LeftBrace
RightBrace
Plus
Minus
Star
Slash
Less
Greater
LessEqual
GreaterEqual
Percent
PlusDot
MinusDot
StarDot
SlashDot
LessDot
GreaterDot
LessEqualDot
GreaterEqualDot
Concatenate
Colon
Comma
Hash
Bang
Equal
EqualEqual
NotEqual
Vbar
VbarVbar
AmperAmper
LtLt
GtGt
Pipe
Dot
RArrow
LArrow
DotDot
At
Keyword(Keyword)
Error
} derive(Eq, Debug)fn parse_float_value(value : String) -> Double?test {
debug_inspect(@scanner.parse_int_value("-0x1_F"), content="Some(-31)")
debug_inspect(@scanner.parse_int_value("0x"), content="None")
}test {
let s = @scanner.tokenize(@scanner.SourceText::new("let x = 1"))
debug_inspect(
s.tokens.iter().map(t => t.kind).collect(),
content="[Keyword(Let), Name(\"x\"), Equal, Int(value=\"1\", int_value=1)]",
)
debug_inspect(s.to_source(), content="\"let x = 1\"")
}fn wrap(text : String) -> StringInstall
Download zipParser and parsing utilities for the Gleam programming language in MoonBit
Dependencies