Skip to content

Commit a1378af

Browse files
praihanfacebook-github-bot
authored andcommitted
Reserve asterisk (*) as a punctuation token
Summary: Currently unused but reserving for potential future use. Reviewed By: thedavekwon Differential Revision: D67920813 fbshipit-source-id: 4d7915f37cd75d552f84b551577363f8b033729f
1 parent c11b6d2 commit a1378af

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

third-party/thrift/src/thrift/compiler/whisker/test/lexer_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ TEST_F(LexerTest, multiple_identifiers) {
183183
}
184184

185185
TEST_F(LexerTest, ids_and_punctuations) {
186-
auto lexer = make_lexer("{{ |. ! bas ^> = ic /# }}{{()}}");
186+
auto lexer = make_lexer("{{ |. ! bas ^> =* ic /# }}{{()}}");
187187
const std::vector<token_description> expected = {
188188
{tok::open, {}},
189189
{tok::pipe, {}},
@@ -193,6 +193,7 @@ TEST_F(LexerTest, ids_and_punctuations) {
193193
{tok::caret, {}},
194194
{tok::gt, {}},
195195
{tok::eq, {}},
196+
{tok::star, {}},
196197
{tok::identifier, "ic"},
197198
{tok::slash, {}},
198199
{tok::pound, {}},

third-party/thrift/src/thrift/compiler/whisker/token.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ constexpr token_kind_info info[] = {
9191
{tok::pipe, "`|`"},
9292
{tok::gt, "`>`"},
9393
{tok::eq, "`=`"},
94+
{tok::star, "`*`"},
9495

9596
#define WHISKER_KEYWORD(kw) {tok::kw_##kw, "`" #kw "`"},
9697
WHISKER_KEYWORDS()

third-party/thrift/src/thrift/compiler/whisker/token.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ enum class tok : unsigned {
6262
pipe, // "|"
6363
gt, // ">"
6464
eq, // "="
65+
star, // "*"
6566
// clang-format on
6667

6768
// Literals:
@@ -114,6 +115,7 @@ constexpr tok to_tok(char c) {
114115
case '|': return tok::pipe;
115116
case '>': return tok::gt;
116117
case '=': return tok::eq;
118+
case '*': return tok::star;
117119
default:
118120
return tok::error;
119121
}

0 commit comments

Comments
 (0)