mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
This is necessary so that unparsing inserts a space between "var" and "foo" in "var foo". That problem was undetected so far in our only rewriting API test because all variable declaration nodes were rewritten from sources (they were not synthetized), so formatting (which includes that space) was preserved.
49 lines
850 B
Plaintext
49 lines
850 B
Plaintext
lexer foo_lexer {
|
|
|
|
@trivia()
|
|
whitespace <- p"[ \n\r\t]+"
|
|
|
|
family alphanumericals {
|
|
def <- "def"
|
|
var <- "var"
|
|
}
|
|
|
|
family alphanumericals {
|
|
error <- "error"
|
|
example <- "example"
|
|
null_tok <- "null"
|
|
}
|
|
|
|
|
|
family punctuation {
|
|
comma <- ","
|
|
dot <- "."
|
|
semicolon <- ";"
|
|
l_par <- "("
|
|
r_par <- ")"
|
|
l_brace <- "{"
|
|
r_brace <- "}"
|
|
equal <- "="
|
|
plus <- "+"
|
|
}
|
|
|
|
minus <- "-"
|
|
less_than <- "<"
|
|
|
|
@unparse_spacing(with=alphanumericals)
|
|
family alphanumericals {
|
|
number <- p"[0-9]+|0x[0-9a-f]+"
|
|
@symbol()
|
|
identifier <- p"[a-zA-Z_][a-zA-Z0-9_]*"
|
|
}
|
|
|
|
string <- p"\"[^\"]*\""
|
|
|
|
family comments {
|
|
@unparse_newline_after
|
|
@trivia()
|
|
comment <- p"#(.?)+"
|
|
}
|
|
|
|
}
|