Files
langkit/testsuite/python_support/lexer_example.lkt
Pierre-Marie de Rodat 4c1391dd5f Introduce a language spec-wide option to enable case insensitivity
When enabled, this new option triggers the lexer engine to perform
"native" case insentivity and provides a default symbol canonicalizer
that just converts names to lower case.

TN: U118-054
2021-01-25 12:52:15 +01:00

50 lines
847 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"#(.?)+"
}
}