File tree Expand file tree Collapse file tree 1 file changed +59
-3
lines changed Expand file tree Collapse file tree 1 file changed +59
-3
lines changed Original file line number Diff line number Diff line change @@ -1832,6 +1832,56 @@ Parser<ManagedTokenSource>::parse_macro_match ()
1832
1832
const_TokenPtr t2 = lexer.peek_token (1 );
1833
1833
switch (t2->get_id ())
1834
1834
{
1835
+ case ABSTRACT:
1836
+ case AS:
1837
+ case ASYNC:
1838
+ case BECOME:
1839
+ case BOX:
1840
+ case BREAK:
1841
+ case CONST:
1842
+ case CONTINUE:
1843
+ case CRATE:
1844
+ case DO:
1845
+ case DYN:
1846
+ case ELSE:
1847
+ case ENUM_TOK:
1848
+ case EXTERN_TOK:
1849
+ case FALSE_LITERAL:
1850
+ case FINAL_TOK:
1851
+ case FN_TOK:
1852
+ case FOR:
1853
+ case IF:
1854
+ case IMPL:
1855
+ case IN:
1856
+ case LET:
1857
+ case LOOP:
1858
+ case MACRO:
1859
+ case MATCH_TOK:
1860
+ case MOD:
1861
+ case MOVE:
1862
+ case MUT:
1863
+ case OVERRIDE_TOK:
1864
+ case PRIV:
1865
+ case PUB:
1866
+ case REF:
1867
+ case RETURN_TOK:
1868
+ case SELF_ALIAS:
1869
+ case SELF:
1870
+ case STATIC_TOK:
1871
+ case STRUCT_TOK:
1872
+ case SUPER:
1873
+ case TRAIT:
1874
+ case TRUE_LITERAL:
1875
+ case TRY:
1876
+ case TYPE:
1877
+ case TYPEOF:
1878
+ case UNSAFE:
1879
+ case UNSIZED:
1880
+ case USE:
1881
+ case VIRTUAL:
1882
+ case WHERE:
1883
+ case WHILE:
1884
+ case YIELD:
1835
1885
case IDENTIFIER:
1836
1886
// macro fragment
1837
1887
return parse_macro_match_fragment ();
@@ -1877,16 +1927,22 @@ Parser<ManagedTokenSource>::parse_macro_match_fragment ()
1877
1927
Location fragment_locus = lexer.peek_token ()->get_locus ();
1878
1928
skip_token (DOLLAR_SIGN);
1879
1929
1880
- const_TokenPtr ident_tok = expect_token (IDENTIFIER);
1881
- if (ident_tok == nullptr )
1930
+ Identifier ident = " " ;
1931
+ auto identifier = lexer.peek_token ();
1932
+ if (identifier->has_str ())
1933
+ ident = identifier->get_str ();
1934
+ else
1935
+ ident = std::string (token_id_to_str (identifier->get_id ()));
1936
+
1937
+ if (ident.empty ())
1882
1938
{
1883
1939
Error error (lexer.peek_token ()->get_locus (),
1884
1940
" missing identifier in macro match fragment" );
1885
1941
add_error (std::move (error));
1886
1942
1887
1943
return nullptr ;
1888
1944
}
1889
- Identifier ident = ident_tok-> get_str ( );
1945
+ skip_token (identifier-> get_id () );
1890
1946
1891
1947
if (!skip_token (COLON))
1892
1948
{
You can’t perform that action at this time.
0 commit comments