Add flags into gperf source files.
This commit is contained in:
parent
637728de6a
commit
b102982d65
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// Generate the output table via:
|
// Generate the output table via:
|
||||||
// ```bash
|
// ```bash
|
||||||
// gperf -t keywords.txt
|
// gperf keywords.txt
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// Since GNU gperf does not produce Rust output, the ANSI-C output must be hand-edited and
|
// Since GNU gperf does not produce Rust output, the ANSI-C output must be hand-edited and
|
||||||
@ -17,86 +17,89 @@
|
|||||||
// * Copy the `wordlist` array into `KEYWORDS_LIST` with the following modifications:
|
// * Copy the `wordlist` array into `KEYWORDS_LIST` with the following modifications:
|
||||||
// - Remove the `#line` comments
|
// - Remove the `#line` comments
|
||||||
// - Change the entry wrapping `{ .. }` into tuples `( .. )`
|
// - Change the entry wrapping `{ .. }` into tuples `( .. )`
|
||||||
// - Replace all entries `("")` by `("", Token::EOF)`
|
|
||||||
// - Put feature flags on the appropriate lines, and duplicating lines that maps to `Token::EOF`
|
// - Put feature flags on the appropriate lines, and duplicating lines that maps to `Token::EOF`
|
||||||
// for the opposite feature flags
|
// for the opposite feature flags
|
||||||
//
|
//
|
||||||
|
%global-table
|
||||||
|
%struct-type
|
||||||
|
%omit-struct-type
|
||||||
|
%define initializer-suffix ,Token::EOF
|
||||||
struct keyword;
|
struct keyword;
|
||||||
%%
|
%%
|
||||||
"{", Token::LeftBrace
|
{, Token::LeftBrace
|
||||||
"}", Token::RightBrace
|
}, Token::RightBrace
|
||||||
"(", Token::LeftParen
|
(, Token::LeftParen
|
||||||
")", Token::RightParen
|
), Token::RightParen
|
||||||
"[", Token::LeftBracket
|
[, Token::LeftBracket
|
||||||
"]", Token::RightBracket
|
], Token::RightBracket
|
||||||
"()", Token::Unit
|
(), Token::Unit
|
||||||
"+", Token::Plus
|
+, Token::Plus
|
||||||
"-", Token::Minus
|
-, Token::Minus
|
||||||
"*", Token::Multiply
|
*, Token::Multiply
|
||||||
"/", Token::Divide
|
/, Token::Divide
|
||||||
";", Token::SemiColon
|
;, Token::SemiColon
|
||||||
":", Token::Colon
|
:, Token::Colon
|
||||||
"::", Token::DoubleColon
|
::, Token::DoubleColon
|
||||||
"=>", Token::DoubleArrow
|
=>, Token::DoubleArrow
|
||||||
"_", Token::Underscore
|
_, Token::Underscore
|
||||||
",", Token::Comma
|
,, Token::Comma
|
||||||
".", Token::Period
|
., Token::Period
|
||||||
"?.", Token::Elvis
|
?., Token::Elvis
|
||||||
"??", Token::DoubleQuestion
|
??, Token::DoubleQuestion
|
||||||
"?[", Token::QuestionBracket
|
?[, Token::QuestionBracket
|
||||||
"..", Token::ExclusiveRange
|
.., Token::ExclusiveRange
|
||||||
"..=", Token::InclusiveRange
|
..=, Token::InclusiveRange
|
||||||
"#{", Token::MapStart
|
"#{", Token::MapStart
|
||||||
"=", Token::Equals
|
=, Token::Equals
|
||||||
"true", Token::True
|
true, Token::True
|
||||||
"false", Token::False
|
false, Token::False
|
||||||
"let", Token::Let
|
let, Token::Let
|
||||||
"const", Token::Const
|
const, Token::Const
|
||||||
"if", Token::If
|
if, Token::If
|
||||||
"else", Token::Else
|
else, Token::Else
|
||||||
"switch", Token::Switch
|
switch, Token::Switch
|
||||||
"do", Token::Do
|
do, Token::Do
|
||||||
"while", Token::While
|
while, Token::While
|
||||||
"until", Token::Until
|
until, Token::Until
|
||||||
"loop", Token::Loop
|
loop, Token::Loop
|
||||||
"for", Token::For
|
for, Token::For
|
||||||
"in", Token::In
|
in, Token::In
|
||||||
"!in", Token::NotIn
|
!in, Token::NotIn
|
||||||
"<", Token::LessThan
|
<, Token::LessThan
|
||||||
">", Token::GreaterThan
|
>, Token::GreaterThan
|
||||||
"<=", Token::LessThanEqualsTo
|
<=, Token::LessThanEqualsTo
|
||||||
">=", Token::GreaterThanEqualsTo
|
>=, Token::GreaterThanEqualsTo
|
||||||
"==", Token::EqualsTo
|
==, Token::EqualsTo
|
||||||
"!=", Token::NotEqualsTo
|
!=, Token::NotEqualsTo
|
||||||
"!", Token::Bang
|
!, Token::Bang
|
||||||
"|", Token::Pipe
|
|, Token::Pipe
|
||||||
"||", Token::Or
|
||, Token::Or
|
||||||
"&", Token::Ampersand
|
&, Token::Ampersand
|
||||||
"&&", Token::And
|
&&, Token::And
|
||||||
"continue", Token::Continue
|
continue, Token::Continue
|
||||||
"break", Token::Break
|
break, Token::Break
|
||||||
"return", Token::Return
|
return, Token::Return
|
||||||
"throw", Token::Throw
|
throw, Token::Throw
|
||||||
"try", Token::Try
|
try, Token::Try
|
||||||
"catch", Token::Catch
|
catch, Token::Catch
|
||||||
"+=", Token::PlusAssign
|
+=, Token::PlusAssign
|
||||||
"-=", Token::MinusAssign
|
-=, Token::MinusAssign
|
||||||
"*=", Token::MultiplyAssign
|
*=, Token::MultiplyAssign
|
||||||
"/=", Token::DivideAssign
|
/=, Token::DivideAssign
|
||||||
"<<=", Token::LeftShiftAssign
|
<<=, Token::LeftShiftAssign
|
||||||
">>=", Token::RightShiftAssign
|
>>=, Token::RightShiftAssign
|
||||||
"&=", Token::AndAssign
|
&=, Token::AndAssign
|
||||||
"|=", Token::OrAssign
|
|=, Token::OrAssign
|
||||||
"^=", Token::XOrAssign
|
^=, Token::XOrAssign
|
||||||
"<<", Token::LeftShift
|
<<, Token::LeftShift
|
||||||
">>", Token::RightShift
|
>>, Token::RightShift
|
||||||
"^", Token::XOr
|
^, Token::XOr
|
||||||
"%", Token::Modulo
|
%, Token::Modulo
|
||||||
"%=", Token::ModuloAssign
|
%=, Token::ModuloAssign
|
||||||
"**", Token::PowerOf
|
**, Token::PowerOf
|
||||||
"**=", Token::PowerOfAssign
|
**=, Token::PowerOfAssign
|
||||||
"fn", Token::Fn
|
fn, Token::Fn
|
||||||
"private", Token::Private
|
private, Token::Private
|
||||||
"import", Token::Import
|
import, Token::Import
|
||||||
"export", Token::Export
|
export, Token::Export
|
||||||
"as", Token::As
|
as, Token::As
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
// Generate the output table via:
|
// Generate the output table via:
|
||||||
// ```bash
|
// ```bash
|
||||||
// gperf -t reserved.txt
|
// gperf reserved.txt
|
||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// Since GNU gperf does not produce Rust output, the ANSI-C output must be hand-edited and
|
// Since GNU gperf does not produce Rust output, the ANSI-C output must be hand-edited and
|
||||||
@ -21,74 +21,88 @@
|
|||||||
// * Copy the `wordlist` array into `RESERVED_LIST` with the following modifications:
|
// * Copy the `wordlist` array into `RESERVED_LIST` with the following modifications:
|
||||||
// - Remove the `#line` comments
|
// - Remove the `#line` comments
|
||||||
// - Change the entry wrapping `{ .. }` into tuples `( .. )`
|
// - Change the entry wrapping `{ .. }` into tuples `( .. )`
|
||||||
// - Replace all entries `("")` by `("", false, false, false)`
|
|
||||||
// - Feature flags can be incorporated directly into the output via the `cfg!` macro
|
// - Feature flags can be incorporated directly into the output via the `cfg!` macro
|
||||||
//
|
//
|
||||||
|
%global-table
|
||||||
|
%struct-type
|
||||||
|
%omit-struct-type
|
||||||
|
%define initializer-suffix ,false,false,false
|
||||||
struct reserved;
|
struct reserved;
|
||||||
%%
|
%%
|
||||||
"?.", cfg!(feature = "no_object"), false, false
|
# reserved under certain flags
|
||||||
"?[", cfg!(feature = "no_index"), false, false
|
#
|
||||||
"fn", cfg!(feature = "no_function"), false, false
|
?., cfg!(feature = no_object), false, false
|
||||||
"private", cfg!(feature = "no_function"), false, false
|
?[, cfg!(feature = no_index), false, false
|
||||||
"import", cfg!(feature = "no_module"), false, false
|
fn, cfg!(feature = no_function), false, false
|
||||||
"export", cfg!(feature = "no_module"), false, false
|
private, cfg!(feature = no_function), false, false
|
||||||
"as", cfg!(feature = "no_module"), false, false
|
import, cfg!(feature = no_module), false, false
|
||||||
"===", true, false, false
|
export, cfg!(feature = no_module), false, false
|
||||||
"!==", true, false, false
|
as, cfg!(feature = no_module), false, false
|
||||||
"->", true, false, false
|
#
|
||||||
"<-", true, false, false
|
# reserved symbols
|
||||||
"?", true, false, false
|
#
|
||||||
":=", true, false, false
|
===, true, false, false
|
||||||
":;", true, false, false
|
!==, true, false, false
|
||||||
"~", true, false, false
|
->, true, false, false
|
||||||
"!.", true, false, false
|
<-, true, false, false
|
||||||
"::<", true, false, false
|
?, true, false, false
|
||||||
"(*", true, false, false
|
:=, true, false, false
|
||||||
"*)", true, false, false
|
:;, true, false, false
|
||||||
|
~, true, false, false
|
||||||
|
!., true, false, false
|
||||||
|
::<, true, false, false
|
||||||
|
(*, true, false, false
|
||||||
|
*), true, false, false
|
||||||
"#", true, false, false
|
"#", true, false, false
|
||||||
"#!", true, false, false
|
"#!", true, false, false
|
||||||
"@", true, false, false
|
@, true, false, false
|
||||||
"$", true, false, false
|
$, true, false, false
|
||||||
"++", true, false, false
|
++, true, false, false
|
||||||
"--", true, false, false
|
--, true, false, false
|
||||||
"...", true, false, false
|
..., true, false, false
|
||||||
"<|", true, false, false
|
<|, true, false, false
|
||||||
"|>", true, false, false
|
|>, true, false, false
|
||||||
"public", true, false, false
|
#
|
||||||
"protected", true, false, false
|
# reserved keywords
|
||||||
"super", true, false, false
|
#
|
||||||
"new", true, false, false
|
public, true, false, false
|
||||||
"use", true, false, false
|
protected, true, false, false
|
||||||
"module", true, false, false
|
super, true, false, false
|
||||||
"package", true, false, false
|
new, true, false, false
|
||||||
"var", true, false, false
|
use, true, false, false
|
||||||
"static", true, false, false
|
module, true, false, false
|
||||||
"shared", true, false, false
|
package, true, false, false
|
||||||
"with", true, false, false
|
var, true, false, false
|
||||||
"is", true, false, false
|
static, true, false, false
|
||||||
"goto", true, false, false
|
shared, true, false, false
|
||||||
"exit", true, false, false
|
with, true, false, false
|
||||||
"match", true, false, false
|
is, true, false, false
|
||||||
"case", true, false, false
|
goto, true, false, false
|
||||||
"default", true, false, false
|
exit, true, false, false
|
||||||
"void", true, false, false
|
match, true, false, false
|
||||||
"null", true, false, false
|
case, true, false, false
|
||||||
"nil", true, false, false
|
default, true, false, false
|
||||||
"spawn", true, false, false
|
void, true, false, false
|
||||||
"thread", true, false, false
|
null, true, false, false
|
||||||
"go", true, false, false
|
nil, true, false, false
|
||||||
"sync", true, false, false
|
spawn, true, false, false
|
||||||
"async", true, false, false
|
thread, true, false, false
|
||||||
"await", true, false, false
|
go, true, false, false
|
||||||
"yield", true, false, false
|
sync, true, false, false
|
||||||
"print", true, true, false
|
async, true, false, false
|
||||||
"debug", true, true, false
|
await, true, false, false
|
||||||
"type_of", true, true, true
|
yield, true, false, false
|
||||||
"eval", true, true, false
|
#
|
||||||
"Fn", true, true, false
|
# keyword functions
|
||||||
"call", true, true, true
|
#
|
||||||
"curry", true, true, true
|
print, true, true, false
|
||||||
"this", true, false, false
|
debug, true, true, false
|
||||||
"is_def_var", true, true, false
|
type_of, true, true, true
|
||||||
"is_def_fn", cfg!(not(feature = "no_function")), true, false
|
eval, true, true, false
|
||||||
"is_shared", cfg!(not(feature = "no_closure")), true, true
|
Fn, true, true, false
|
||||||
|
call, true, true, true
|
||||||
|
curry, true, true, true
|
||||||
|
this, true, false, false
|
||||||
|
is_def_var, true, true, false
|
||||||
|
is_def_fn, cfg!(not(feature = no_function)), true, false
|
||||||
|
is_shared, cfg!(not(feature = no_closure)), true, true
|
||||||
|
Loading…
Reference in New Issue
Block a user