Skip to content

Commit

Permalink
Release v0.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed May 3, 2022
2 parents fc800a9 + 19cf130 commit 0285fec
Show file tree
Hide file tree
Showing 14 changed files with 288 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
java_version: ['11', '17']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew check --stacktrace
- name: Archive test results
if: failure()
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v3
with:
name: junit_report_${{ matrix.os }}_${{ matrix.java_version }}
path: build/reports/tests/test
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3

- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt'
Expand All @@ -29,7 +29,7 @@ jobs:
run: ./gradlew --no-daemon javadoc

- name: Set up Python
uses: actions/setup-python@v2.3.2
uses: actions/setup-python@v3
with:
python-version: '3.6'
architecture: 'x64'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3
with:
fetch-depth: ''
- run: |
git fetch --prune --unshallow
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]
steps:
- uses: actions/checkout@v2.4.0
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- run: ./gradlew check --stacktrace
- if: matrix.os == 'ubuntu-latest'
run: ./gradlew build
- if: matrix.os == 'ubuntu-latest'
uses: AButler/upload-release-assets@v1.0
uses: AButler/upload-release-assets@v2.0
with:
files: './build/libs/*.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ plugins {
id("org.sonarqube") version "3.3"
id("org.cadixdev.licenser") version "0.6.1"
id("com.github.gradle-git-version-calculator") version "1.1.0"
id("io.freefair.javadoc-links") version "6.4.1"
id("io.freefair.javadoc-utf-8") version "6.4.1"
id("io.freefair.javadoc-links") version "6.4.3"
id("io.freefair.javadoc-utf-8") version "6.4.3"
id("com.github.ben-manes.versions") version "0.42.0"
id("me.champeau.gradle.jmh") version "0.5.3"
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/antlr/BSLLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,9 @@ Async_BREAK_KEYWORD: BREAK_KEYWORD -> type(BREAK_KEYWORD);
Async_EXECUTE_KEYWORD: EXECUTE_KEYWORD -> type(EXECUTE_KEYWORD);
Async_ADDHANDLER_KEYWORD: ADDHANDLER_KEYWORD -> type(ADDHANDLER_KEYWORD);
Async_REMOVEHANDLER_KEYWORD: REMOVEHANDLER_KEYWORD -> type(REMOVEHANDLER_KEYWORD);
WAIT_KEYWORD
AWAIT_KEYWORD
: (RU_ZH RU_D RU_A RU_T RU_SOFT_SIGN
| W A I T)
| A W A I T)
;
// всегда в конце мода
Expand Down
12 changes: 7 additions & 5 deletions src/main/antlr/BSLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ preproc_expression
;
preproc_logicalOperand
: (PREPROC_LPAREN PREPROC_NOT_KEYWORD? preproc_logicalOperand PREPROC_RPAREN)
| ( PREPROC_NOT_KEYWORD? preproc_symbol )
| (PREPROC_NOT_KEYWORD? preproc_symbol)
| (PREPROC_LPAREN preproc_logicalExpression PREPROC_RPAREN)
;
preproc_logicalExpression
: preproc_logicalOperand (preproc_boolOperation preproc_logicalOperand)*;
: preproc_logicalOperand (preproc_boolOperation preproc_logicalOperand)*
;
preproc_symbol
: PREPROC_CLIENT_SYMBOL
| PREPROC_ATCLIENT_SYMBOL
Expand Down Expand Up @@ -160,7 +162,7 @@ subCodeBlock : subVars? codeBlock;
// statements
continueStatement : CONTINUE_KEYWORD;
breakStatement : BREAK_KEYWORD;
raiseStatement : RAISE_KEYWORD expression?;
raiseStatement : RAISE_KEYWORD (expression? | doCall);
ifStatement
: ifBranch elsifBranch* elseBranch? ENDIF_KEYWORD
;
Expand Down Expand Up @@ -204,7 +206,7 @@ removeHandlerStatement
;

ternaryOperator : QUESTION LPAREN expression COMMA expression COMMA expression RPAREN;
waitExpression : WAIT_KEYWORD expression;
waitExpression : AWAIT_KEYWORD expression;

// main
fileCodeBlockBeforeSub
Expand All @@ -216,7 +218,7 @@ fileCodeBlock
codeBlock : (statement | preprocessor)*;
numeric : FLOAT | DECIMAL;
paramList : param (COMMA param)*;
param : VAL_KEYWORD? IDENTIFIER (ASSIGN defaultValue)?;
param : (annotation)* VAL_KEYWORD? IDENTIFIER (ASSIGN defaultValue)?;
defaultValue : constValue;
constValue : (MINUS | PLUS)? numeric | string | TRUE | FALSE | UNDEFINED | NULL | DATETIME;
multilineString : STRINGSTART (STRINGPART | BAR | preprocessor)* STRINGTAIL;
Expand Down
41 changes: 20 additions & 21 deletions src/main/antlr/SDBLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ selectQuery:
// Основная часть запроса
// Состоит из основного запроса и объединения.
// Основной запрос может быть простым запросом для выборки данных И НЕ МОЖЕТ быть выбокой во временную таблицу
subquery:
main=query
| main=query orderBy? unions+=union+
;
subquery: main=query orderBy? (unions+=union+)?;

// объединение запросов
union: UNION ALL? query orderBy?;
Expand All @@ -76,9 +73,9 @@ query:
columns=selectedFields
(INTO temporaryTableName=identifier)?
(FROM from=dataSources)?
(WHERE where=searchConditions)?
(WHERE where=logicalExpression)?
(GROUP (BY_EN | PO_RU) groupBy=groupByItem)?
(HAVING having=searchConditions)?
(HAVING having=logicalExpression)?
(FOR UPDATE forUpdate=mdo?)?
(INDEX (BY_EN | PO_RU) indexes+=indexingItem (COMMA indexes+=indexingItem)*)?
;
Expand Down Expand Up @@ -120,7 +117,7 @@ selectedField:
asteriskField: (tableName=identifier DOT)* MUL;

// поле выборки-выражение, алиас может быть
expressionField: searchConditions;
expressionField: logicalExpression;

// поле выборки-поле табицы или NULL
columnField: NULL | recordAutoNumberFunction;
Expand Down Expand Up @@ -199,13 +196,13 @@ primitiveExpression:

// условные выражения (если...то...иначе)
caseExpression:
(CASE caseExp=expression caseBranch+ (ELSE elseExp=searchConditions)? END)
| (CASE caseBranch+ (ELSE elseExp=searchConditions)? END)
| (caseBranch (ELSE elseExp=searchConditions)? END)
(CASE caseExp=expression caseBranch+ (ELSE elseExp=logicalExpression)? END)
| (CASE caseBranch+ (ELSE elseExp=logicalExpression)? END)
| (caseBranch (ELSE elseExp=logicalExpression)? END)
;

// ветка со своим условием и результатом
caseBranch: WHEN searchConditions THEN searchConditions;
caseBranch: WHEN logicalExpression THEN logicalExpression;

// выражение в скобках
// в скобках может быть либо подзапрос либо другое выражение
Expand Down Expand Up @@ -235,8 +232,8 @@ builtInFunctions:

// агрегатные ф-ии
aggregateFunctions:
(doCall=(SUM | AVG | MIN | MAX) LPAREN searchConditions RPAREN)
| (doCall=COUNT LPAREN (DISTINCT? searchConditions | MUL) RPAREN)
(doCall=(SUM | AVG | MIN | MAX) LPAREN logicalExpression RPAREN)
| (doCall=COUNT LPAREN (DISTINCT? logicalExpression | MUL) RPAREN)
;

// функция Значение
Expand Down Expand Up @@ -278,19 +275,19 @@ castFunction:
;

// выражения-условия отбора
searchConditions:
condidions+=searchCondition
((AND | OR) condidions+=searchCondition)*
logicalExpression:
condidions+=predicate
((AND | OR) condidions+=predicate)*
;
searchCondition: NOT* (
predicate: NOT* (
booleanPredicate=expression // булево
| likePredicate
| isNullPredicate
| comparePredicate
| betweenPredicate
| inPredicate
| refsPredicate
| (LPAREN searchConditions RPAREN)
| (LPAREN logicalExpression RPAREN)
);

likePredicate: expression NOT* LIKE expression (ESCAPE escape=multiString)?; // выражение подобно выражение [ESC-последовательность]
Expand All @@ -302,7 +299,7 @@ inPredicate: (expression | (LPAREN expressionList RPAREN)) NOT* IN HIERARCHY_FOR
refsPredicate: expression REFS mdo; // выражение ССЫЛКА МДО

// список выражений
expressionList: exp+=expression (COMMA exp+=expression)*;
expressionList: exp+=logicalExpression (COMMA exp+=logicalExpression)*;

// перечень таблиц-источников данных для выборки
dataSources: tables+=dataSource (COMMA tables+=dataSource)*;
Expand Down Expand Up @@ -343,7 +340,7 @@ virtualTable:
;

// параметр виртуальной таблицы может быть опущен
virtualTableParameter: searchConditions?;
virtualTableParameter: logicalExpression?;

// таблица как параметр, соединяться ни с чем не может
parameterTable: parameter;
Expand All @@ -357,7 +354,7 @@ joinPart:
| (joinType=INNER JOIN)
| (joinType=JOIN)
)
source=dataSource (ON_EN | PO_RU) condition=searchConditions // имя таблицы и соединение
source=dataSource (ON_EN | PO_RU) condition=logicalExpression // имя таблицы и соединение
;

// алиас для поля, таблицы ...
Expand Down Expand Up @@ -417,6 +414,7 @@ identifier:
| SELECT
| TOTALS
| UNION
| UPDATE
| AVG
| BEGINOFPERIOD
| BOOLEAN
Expand All @@ -428,6 +426,7 @@ identifier:
| DAY
| DAYOFYEAR
| EMPTYTABLE
| EMPTYREF
| ENDOFPERIOD
| HALFYEAR
| HOUR
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -508,30 +508,30 @@ void testKeyWords() {
assertMatch("Field.ASYNC", BSLLexer.IDENTIFIER, BSLLexer.DOT, BSLLexer.IDENTIFIER);

assertMatch("ЖдатЬ", BSLLexer.IDENTIFIER);
assertMatch("WAIt", BSLLexer.IDENTIFIER);
assertMatch("aWAIt", BSLLexer.IDENTIFIER);
assertMatch("Поле.ждАть", BSLLexer.IDENTIFIER, BSLLexer.DOT, BSLLexer.IDENTIFIER);
assertMatch("Field.WaIT", BSLLexer.IDENTIFIER, BSLLexer.DOT, BSLLexer.IDENTIFIER);
assertMatch("Field.aWaIT", BSLLexer.IDENTIFIER, BSLLexer.DOT, BSLLexer.IDENTIFIER);

assertMatch("асинх функция а() ЖдатЬ Б(); КонецФункции",
BSLLexer.ASYNC_KEYWORD,
BSLLexer.FUNCTION_KEYWORD,
BSLLexer.IDENTIFIER,
BSLLexer.LPAREN,
BSLLexer.RPAREN,
BSLLexer.WAIT_KEYWORD,
BSLLexer.AWAIT_KEYWORD,
BSLLexer.IDENTIFIER,
BSLLexer.LPAREN,
BSLLexer.RPAREN,
BSLLexer.SEMICOLON,
BSLLexer.ENDFUNCTION_KEYWORD
);
assertMatch("async function a() wait b(); endfunction",
assertMatch("async function a() await b(); endfunction",
BSLLexer.ASYNC_KEYWORD,
BSLLexer.FUNCTION_KEYWORD,
BSLLexer.IDENTIFIER,
BSLLexer.LPAREN,
BSLLexer.RPAREN,
BSLLexer.WAIT_KEYWORD,
BSLLexer.AWAIT_KEYWORD,
BSLLexer.IDENTIFIER,
BSLLexer.LPAREN,
BSLLexer.RPAREN,
Expand Down Expand Up @@ -582,7 +582,7 @@ void checkAsyncModeMapping() {
// проверка наличия всех токенов в фикстуре
var tokenTypes = tokens.stream().map(Token::getType).collect(Collectors.toSet());
for (int i = 1; i <= BSLLexer.VOCABULARY.getMaxTokenType(); i++) {
if (BSLLexer.WAIT_KEYWORD == i // этих токенов быть не должно
if (BSLLexer.AWAIT_KEYWORD == i // этих токенов быть не должно
|| BSLLexer.ASYNC_KEYWORD == i
|| BSLLexer.PREPROC_EXCLAMATION_MARK == i
|| BSLLexer.PREPROC_STRING == i
Expand Down
Loading

0 comments on commit 0285fec

Please sign in to comment.