Skip to content

Commit ed7c8e4

Browse files
committed
Использование предикатов вместо action
1 parent d44700e commit ed7c8e4

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

bslparser/src/main/antlr/BSLLexer.g4

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ AND_KEYWORD: RU_I | A N D;
167167
NEW_KEYWORD: RU_N RU_O RU_V RU_Y RU_J| N E W;
168168
GOTO_KEYWORD: RU_P RU_E RU_R RU_E RU_J RU_T RU_I | G O T O;
169169
BREAK_KEYWORD: RU_P RU_R RU_E RU_R RU_V RU_A RU_T RU_SOFT_SIGN | B R E A K;
170-
EXECUTE_KEYWORD: (RU_V RU_Y RU_P RU_O RU_L RU_N RU_I RU_T RU_SOFT_SIGN | E X E C U T E) { if (lastTokenType == DOT) { setType(IDENTIFIER); } };
170+
EXECUTE_KEYWORD
171+
:
172+
{ lastTokenType != DOT }?
173+
( RU_V RU_Y RU_P RU_O RU_L RU_N RU_I RU_T RU_SOFT_SIGN
174+
| E X E C U T E)
175+
;
171176
ADDHANDLER_KEYWORD
172177
: RU_D RU_O RU_B RU_A RU_V RU_I RU_T RU_SOFT_SIGN RU_O RU_B RU_R RU_A RU_B RU_O RU_T RU_CH RU_I RU_K
173178
| A D D H A N D L E R

bslparser/src/test/java/org/github/_1c_syntax/parser/BSLLexerTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,10 @@ void testAnnotation() throws IOException {
9292
BSLLexer.AMPERSAND, BSLLexer.ANNOTATION_ATSERVER_SYMBOL
9393
);
9494
}
95+
96+
@Test
97+
void testExecute() throws IOException {
98+
assertMatch("Выполнить", BSLLexer.EXECUTE_KEYWORD);
99+
assertMatch("Запрос.Выполнить", BSLLexer.IDENTIFIER, BSLLexer.DOT, BSLLexer.IDENTIFIER);
100+
}
95101
}

bslparser/src/test/java/org/github/_1c_syntax/parser/BSLParserTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,20 @@ void testAnnotation() throws IOException {
152152

153153
setInput("&Аннотация(П = 0, П2, Истина, \"строка\", П3)");
154154
assertMatches(parser.annotation());
155+
}
156+
157+
@Test
158+
void testExecuteStatement() throws IOException {
159+
setInput("Выполнить(А)");
160+
assertMatches(parser.executeStatement());
161+
}
162+
163+
@Test
164+
void testComplexIdentifier() throws IOException {
165+
setInput("Запрос.Пустой()");
166+
assertMatches(parser.complexIdentifier());
155167

168+
setInput("Запрос.Выполнить()");
169+
assertMatches(parser.complexIdentifier());
156170
}
157171
}

0 commit comments

Comments
 (0)