Skip to content

Commit

Permalink
Merge pull request #37 from 1c-syntax/fix/PreprocNot36
Browse files Browse the repository at this point in the history
Preproc parse error
  • Loading branch information
nixel2007 authored Jun 19, 2019
2 parents f81eb2e + 2c6cfc3 commit cbdb6ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/antlr/BSLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ preproc_else : PREPROC_ELSE_KEYWORD;
preproc_endif : PREPROC_ENDIF_KEYWORD;

preproc_expression
: ( PREPROC_LPAREN preproc_expression PREPROC_RPAREN )
: ( PREPROC_NOT_KEYWORD? (PREPROC_LPAREN preproc_expression PREPROC_RPAREN ) )
| preproc_logicalExpression
;
preproc_logicalOperand
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/github/_1c_syntax/bsl/parser/BSLParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.commons.io.IOUtils;
//import org.testng.annotations.ITestAnnotation;
import org.junit.jupiter.api.Test;

import java.io.IOException;
Expand Down Expand Up @@ -175,6 +176,15 @@ void testPreproc_if() {
setInput("Если Клиент Тогда", BSLLexer.PREPROCESSOR_MODE);
assertMatches(parser.preproc_if());

setInput("Если НЕ (ТонкийКлиент ИЛИ ВебКлиент) Тогда", BSLLexer.PREPROCESSOR_MODE);
assertMatches(parser.preproc_if());

setInput("Если НЕ (НЕ ТонкийКлиент ИЛИ НЕ ВебКлиент) Тогда", BSLLexer.PREPROCESSOR_MODE);
assertMatches(parser.preproc_if());

setInput("Если ТонкийКлиент И ВебКлиент Тогда", BSLLexer.PREPROCESSOR_MODE);
assertMatches(parser.preproc_if());

setInput("Если", BSLLexer.PREPROCESSOR_MODE);
assertNotMatches(parser.preproc_if());

Expand Down

0 comments on commit cbdb6ff

Please sign in to comment.