From b87291a8a46025fa9b709cd9860483528308735f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 29 Jul 2018 16:20:11 +0300 Subject: Move grammar --- grammar.ron | 147 --------------------------------------------------- src/grammar.ron | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/src/bin/gen.rs | 2 +- 3 files changed, 148 insertions(+), 148 deletions(-) delete mode 100644 grammar.ron create mode 100644 src/grammar.ron diff --git a/grammar.ron b/grammar.ron deleted file mode 100644 index d5d2e6162..000000000 --- a/grammar.ron +++ /dev/null @@ -1,147 +0,0 @@ -Grammar( - keywords: [ - "use", - "fn", - "struct", - "enum", - "trait", - "impl", - "true", - "false", - "as", - "extern", - "crate", - "mod", - "pub", - "self", - "super", - "in", - "where", - "for", - "loop", - "while", - "if", - "match", - "const", - "static", - "mut", - "unsafe", - "type", - "ref", - "let", - ], - contextual_keywords: [ - "auto", - "default", - "union", - ], - tokens: [ - "ERROR", - "IDENT", - "UNDERSCORE", - "WHITESPACE", - "INT_NUMBER", - "FLOAT_NUMBER", - "SEMI", - "COMMA", - "DOT", - "DOTDOT", - "DOTDOTDOT", - "DOTDOTEQ", - "L_PAREN", - "R_PAREN", - "L_CURLY", - "R_CURLY", - "L_BRACK", - "R_BRACK", - "L_ANGLE", - "R_ANGLE", - "AT", - "POUND", - "TILDE", - "QUESTION", - "COLON", - "COLONCOLON", - "DOLLAR", - "EQ", - "EQEQ", - "FAT_ARROW", - "NEQ", - "EXCL", - "LIFETIME", - "CHAR", - "BYTE", - "STRING", - "RAW_STRING", - "BYTE_STRING", - "RAW_BYTE_STRING", - "PLUS", - "MINUS", - "STAR", - "SLASH", - "CARET", - "PERCENT", - "AMPERSAND", - "PIPE", - "THIN_ARROW", - "COMMENT", - "DOC_COMMENT", - "SHEBANG", - ], - nodes: [ - "FILE", - - "STRUCT_ITEM", - "ENUM_ITEM", - "FN_ITEM", - "EXTERN_CRATE_ITEM", - "MOD_ITEM", - "USE_ITEM", - "STATIC_ITEM", - "CONST_ITEM", - "TRAIT_ITEM", - "IMPL_ITEM", - "TYPE_ITEM", - - "PAREN_TYPE", - "TUPLE_TYPE", - "NEVER_TYPE", - "PATH_TYPE", - "POINTER_TYPE", - "ARRAY_TYPE", - "SLICE_TYPE", - "REFERENCE_TYPE", - "PLACEHOLDER_TYPE", - "FN_POINTER_TYPE", - "FOR_TYPE", - - "REF_PAT", - "BIND_PAT", - "PLACEHOLDER_PAT", - - "TUPLE_EXPR", - - "EXTERN_BLOCK", - "ENUM_VARIANT", - "NAMED_FIELD", - "POS_FIELD", - "ATTR", - "META_ITEM", // not an item actually - "USE_TREE", - "PATH", - "PATH_SEGMENT", - "LITERAL", - "ALIAS", - "VISIBILITY", - "TYPE_PARAM_LIST", - "WHERE_CLAUSE", - "LIFETIME_PARAM", - "TYPE_PARAM", - "ABI", - "NAME", - "NAME_REF", - "VALUE_PARAMETER", - "BLOCK", - "LET_STMT", - ] -) diff --git a/src/grammar.ron b/src/grammar.ron new file mode 100644 index 000000000..d5d2e6162 --- /dev/null +++ b/src/grammar.ron @@ -0,0 +1,147 @@ +Grammar( + keywords: [ + "use", + "fn", + "struct", + "enum", + "trait", + "impl", + "true", + "false", + "as", + "extern", + "crate", + "mod", + "pub", + "self", + "super", + "in", + "where", + "for", + "loop", + "while", + "if", + "match", + "const", + "static", + "mut", + "unsafe", + "type", + "ref", + "let", + ], + contextual_keywords: [ + "auto", + "default", + "union", + ], + tokens: [ + "ERROR", + "IDENT", + "UNDERSCORE", + "WHITESPACE", + "INT_NUMBER", + "FLOAT_NUMBER", + "SEMI", + "COMMA", + "DOT", + "DOTDOT", + "DOTDOTDOT", + "DOTDOTEQ", + "L_PAREN", + "R_PAREN", + "L_CURLY", + "R_CURLY", + "L_BRACK", + "R_BRACK", + "L_ANGLE", + "R_ANGLE", + "AT", + "POUND", + "TILDE", + "QUESTION", + "COLON", + "COLONCOLON", + "DOLLAR", + "EQ", + "EQEQ", + "FAT_ARROW", + "NEQ", + "EXCL", + "LIFETIME", + "CHAR", + "BYTE", + "STRING", + "RAW_STRING", + "BYTE_STRING", + "RAW_BYTE_STRING", + "PLUS", + "MINUS", + "STAR", + "SLASH", + "CARET", + "PERCENT", + "AMPERSAND", + "PIPE", + "THIN_ARROW", + "COMMENT", + "DOC_COMMENT", + "SHEBANG", + ], + nodes: [ + "FILE", + + "STRUCT_ITEM", + "ENUM_ITEM", + "FN_ITEM", + "EXTERN_CRATE_ITEM", + "MOD_ITEM", + "USE_ITEM", + "STATIC_ITEM", + "CONST_ITEM", + "TRAIT_ITEM", + "IMPL_ITEM", + "TYPE_ITEM", + + "PAREN_TYPE", + "TUPLE_TYPE", + "NEVER_TYPE", + "PATH_TYPE", + "POINTER_TYPE", + "ARRAY_TYPE", + "SLICE_TYPE", + "REFERENCE_TYPE", + "PLACEHOLDER_TYPE", + "FN_POINTER_TYPE", + "FOR_TYPE", + + "REF_PAT", + "BIND_PAT", + "PLACEHOLDER_PAT", + + "TUPLE_EXPR", + + "EXTERN_BLOCK", + "ENUM_VARIANT", + "NAMED_FIELD", + "POS_FIELD", + "ATTR", + "META_ITEM", // not an item actually + "USE_TREE", + "PATH", + "PATH_SEGMENT", + "LITERAL", + "ALIAS", + "VISIBILITY", + "TYPE_PARAM_LIST", + "WHERE_CLAUSE", + "LIFETIME_PARAM", + "TYPE_PARAM", + "ABI", + "NAME", + "NAME_REF", + "VALUE_PARAMETER", + "BLOCK", + "LET_STMT", + ] +) diff --git a/tools/src/bin/gen.rs b/tools/src/bin/gen.rs index e772922ba..2d3cd422d 100644 --- a/tools/src/bin/gen.rs +++ b/tools/src/bin/gen.rs @@ -100,7 +100,7 @@ impl Grammar { } fn grammar_file() -> PathBuf { - base_dir().join("grammar.ron") + base_dir().join("src/grammar.ron") } fn generated_file() -> PathBuf { -- cgit v1.2.3