blancas.kern.lexer
->LanguageDef
(->LanguageDef type comment-start comment-end comment-line nested-comments identifier-start identifier-letter reserved-names case-sensitive line-continuation trim-newline leading-sign)
Positional factory function for class blancas.kern.lexer.LanguageDef.
->TokenParsers
(->TokenParsers trim lexeme sym new-line one-of none-of token word identifier field char-lit string-lit dec-lit oct-lit hex-lit float-lit bool-lit nil-lit parens braces & overage)
Positional factory function for class blancas.kern.lexer.TokenParsers.
angles
dynamic
(angles p)
Applies parser p skiping over surrounding angle brackets.
Calls (trim) after the opening bracket, after p, and after
the closing bracket.
basic-def
The most basic record; for use to build new styles.
bool-lit
dynamic
(bool-lit)
Parses a boolean value, true or false, comparing according to
:case-sensitive. Calls (trim) afterward.
braces
dynamic
(braces p)
Applies parser p skiping over surrounding braces.
Calls (trim) after the opening brace, after p, and after
the closing brace.
brackets
dynamic
(brackets p)
Applies parser p skiping over surrounding brackets.
Calls (trim) after the opening bracket, after p, and after
the closing bracket.
c-style
Lexical settings for C-style languages.
char-lit
dynamic
(char-lit)
Parses a character literal according to the :type setting. The
common syntax is a symbol in single quotes with the usual
escape codes. Calls (trim) afterwards.
The following styles add escaped characters:
:basic \b \t \n \f \r \' \" \/
:C :basic + \0ooo \0xnn \unnnnnnnn
:Haskell :basic + \nnnn \onnnn \xnnnn
:Java :basic + \0ooo \unnnn
:Shell :basic + \0ooo \0xnn \unnnnnnnn
colon
dynamic
(colon)
Parses a single colon; then calls (trim).
comma
dynamic
(comma)
Parses a single comma; then calls (trim).
comma-sep
dynamic
(comma-sep)
Applies parser p zero or more times, skiping over separating
commas. Calls (trim) after each p and comma.
comma-sep1
dynamic
(comma-sep1)
Applies parser p one or more times, skiping over separating
commas. Calls (trim) after each p and comma.
dec-lit
dynamic
(dec-lit)
Parses a decimal number as Long or BigInt depending on the
magnitude or if it ends with N. Calls (trim) afterward.
dot
dynamic
(dot)
Parses a single dot; then calls (trim).
field
dynamic
(field cs)
Parses an unquoted text field terminated by any character
in cs. Calls (trim) afterwards.
float-lit
dynamic
(float-lit)
Parses a floating-point number as Double or BigDecimal depending
on the magnitude or if it ends with M. It cannot start with a
period. The first period found must be followed by at least one
digit. Calls (trim) afterward.
haskell-style
Lexical settings for Haskell-style languages.
hex-lit
dynamic
(hex-lit)
Parses a hexadecimal number as Long or BigInt depending on the
magnitude or if it ends with N. Calls (trim) afterward.
identifier
dynamic
(identifier)
Parses an unquoted string suitable for an identifier or a name.
The start of the input is defined by :identifier-start, and
subsequent symbols by :identtifier-letter. It will check that
the parsed value not be in the list of :reserved-names, if any,
comparing according to :case-sensitive. Calls (trim) afterwards.
java-style
Lexical settings for Java-style languages.
lexeme
dynamic
(lexeme p)
Applies parser p, then calls (trim).
make-parsers
(make-parsers rec)
Returns a function map that corresponds to the customization
values of the input record, whose fields are as follows:
:type Identifies the type of settings.
:comment-start A string that marks the start of a block comment.
:comment-end A string that marks the end of a block comment.
:comment-line A string that marks the start of a line comment.
:nested-comments Whether the lexer accepts nested comments; a boolean.
:identifier-start A parser for the start of an identifier.
:identifier-letter A parser for the subsequent characters of an identifier.
:reserved-names A list of names that cannot be identifiers.
:case-sensitive Whether tokens are case-sensitive; a boolean.
:line-continuation A parser for the token that precedes the new line.
:trim-newline Treats newline character(s) as whitespace.
:leading-sign Whether numbers accept an optional leading sign.
map->LanguageDef
(map->LanguageDef m__6522__auto__)
Factory function for class blancas.kern.lexer.LanguageDef, taking a map of keywords to field values.
map->TokenParsers
(map->TokenParsers m__6522__auto__)
Factory function for class blancas.kern.lexer.TokenParsers, taking a map of keywords to field values.
new-line
dynamic
(new-line)
Parses a new line, UNIX or Windows style; then calls (trim).
nil-lit
dynamic
(nil-lit)
Parses a null value, nil or null, comparing according to
:case-sensitive. Calls (trim) afterward.
none-of
dynamic
(none-of)
Succeeds if the next character is not in the supplied string.
Calls (trim) afterwards.
oct-lit
dynamic
(oct-lit)
Parses an octal number as Long or BigInt depending on the
magnitude or if it ends with N. Calls (trim) afterward.
one-of
dynamic
(one-of cs)
Succeeds if the next character is in the supplied string.
Calls (trim) afterwards.
parens
dynamic
(parens p)
Applies parser p skiping over surrounding parenthesis.
Calls (trim) after the opening paren, after p, and after
the closing paren.
semi
dynamic
(semi)
Parses a single semicolon; then calls (trim).
semi-sep
dynamic
(semi-sep)
Applies parser p zero or more times, skiping over separating
semicolons. Calls (trim) after each p and semicolon.
semi-sep1
dynamic
(semi-sep1)
Applies parser p one or more times, skiping over separating
semicolons. Calls (trim) after each p and semicolon.
shell-style
Lexical settings for shell-style languages.
string-lit
dynamic
(string-lit)
Parses a string literal according to the :type setting. The
common syntax is any number of symbols in double quotes
with the usual escape codes. Calls (trim) afterward.
The following styles add escaped characters:
:basic \b \t \n \f \r \' \" \/
:C :basic + \0ooo \0xnn \unnnnnnnn
:Haskell :basic + \nnnn \onnnn \xnnnn
:Java :basic + \0ooo \unnnn
:Shell :basic + \0ooo \0xnn \unnnnnnnn
sym
dynamic
(sym c)
Parses a single character c. Compares according to
:case-sensitive. Calls (trim) afterwards.
token
dynamic
(token cs)
(token cs & more)
Parses a specific string, not necessarily delimited. If more
than one are given it will try each choice in turn. Compares
according to :case-sensitive. Calls (trim) afterwards.
trim
dynamic
(trim)
Skips over any whitespace, including comments (if defined), at
the start of the input. Whether newline characters are removed
as whitespace is configured by :trim-newline. When that setting
is true, the setting :line-continuation is activated.
with-parsers
macro
(with-parsers rec & body)
Binds the parser vars in the kern.lexer namespace to the values in rec.
word
dynamic
(word cs)
(word cs & more)
Parses a specific string; must be delimited by any character not
parsed by :identifier-letter. If more than one are given it will
try each choice in turn. Compares according to :case-sensitive.
Calls (trim) afterwards.