@@ -27,22 +27,43 @@ enum Tokens {
27
27
% for token in SYNTAX_TOKENS:
28
28
% if token. is_keyword:
29
29
/// The `${token.text}` keyword
30
- static let `${lowercase_first_word(token.name)}` = SyntaxFactory . make${ token. name} Keyword( ) . withTrailingTrivia ( . spaces( 1 ) )
30
+ static let `${lowercase_first_word(token.name)}` = SyntaxFactory . make${ token. name} Keyword( )
31
+ % if token. requires_trailing_space:
32
+ . withLeadingTrivia ( . spaces( 1 ) )
33
+ % end
34
+ % if token. requires_leading_space:
35
+ . withTrailingTrivia ( . spaces( 1 ) )
36
+ % end
31
37
% end
32
38
% end
33
39
34
40
// MARK: Punctuations and Signs
35
41
36
- /// `":"`
37
- static let colon = SyntaxFactory . makeColonToken ( ) . withTrailingTrivia ( . spaces( 1 ) )
38
-
39
- /// `" = "`
40
- static let equal = SyntaxFactory . makeEqualToken ( ) . withLeadingTrivia ( . spaces( 1 ) )
41
- . withTrailingTrivia ( . spaces( 1 ) )
42
+ % for token in SYNTAX_TOKENS:
43
+ % if token. macro_name ( ) == " PUNCTUATOR " :
44
+ /// The `${token.text}` keyword
45
+ static let `${lowercase_first_word(token.name)}` = SyntaxFactory . make${ token. name} Keyword( )
46
+ % if token. requires_trailing_space:
47
+ . withLeadingTrivia ( . spaces( 1 ) )
48
+ % end
49
+ % if token. requires_leading_space:
50
+ . withTrailingTrivia ( . spaces( 1 ) )
51
+ % end
52
+ % end
53
+ % end
42
54
43
- /// `"{"`
44
- static let leftBrace = SyntaxFactory . makeLeftBraceToken ( )
55
+ // MARK: Punctuations and Signs
45
56
46
- /// `"}"`
47
- static let rightBrace = SyntaxFactory . makeRightBraceToken ( )
57
+ % for token in SYNTAX_TOKENS:
58
+ % if token. macro_name ( ) == " MISC " :
59
+ /// The `${token.text}` keyword
60
+ static let `${lowercase_first_word(token.name)}` = SyntaxFactory . make${ token. name} Keyword( )
61
+ % if token. requires_trailing_space:
62
+ . withLeadingTrivia ( . spaces( 1 ) )
63
+ % end
64
+ % if token. requires_leading_space:
65
+ . withTrailingTrivia ( . spaces( 1 ) )
66
+ % end
67
+ % end
68
+ % end
48
69
}
0 commit comments