Skip to content

Commit

Permalink
Merge pull request #9 from 1c-syntax/feature/newantlr
Browse files Browse the repository at this point in the history
Переезд на antlr 4.13.1
  • Loading branch information
theshadowco authored Apr 16, 2024
2 parents de65552 + 0fea7e4 commit 666a7b0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ gen/
/.idea/compiler.xml
/.idea/jarRepositories.xml
/.idea/inspectionProfiles/Project_Default.xml
/.idea/material_theme_project_new.xml
/.idea/vcs.xml
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ gitVersioning.apply {
val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType.TAG

dependencies {
implementation("io.github.1c-syntax", "bsl-parser-core", "0.1.0")
implementation("com.tunnelvisionlabs", "antlr4", "4.9.0")
implementation("io.github.1c-syntax", "bsl-parser-core", "0.2.0")
implementation("org.antlr", "antlr4", "4.13.1")
implementation("commons-io", "commons-io", "2.15.1")
implementation("org.junit.jupiter", "junit-jupiter-api", "5.10.1")
implementation("org.assertj", "assertj-core", "3.25.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
package com.github._1c_syntax.bsl.parser.testing;

import com.github._1c_syntax.bsl.parser.CaseChangingCharStream;
import com.github._1c_syntax.bsl.parser.UnicodeBOMInputStream;
import lombok.Getter;
import lombok.SneakyThrows;
Expand Down Expand Up @@ -96,8 +95,7 @@ public CommonTokenStream getTokensStream(int mode, String inputString) {
var inputStreamReader = new InputStreamReader(ubis, StandardCharsets.UTF_8)
) {
ubis.skipBOM();
var inputTemp = CharStreams.fromReader(inputStreamReader);
input = new CaseChangingCharStream(inputTemp);
input = CharStreams.fromReader(inputStreamReader);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.atn.ATN;

public class DemoEmptyLexer extends Lexer {

Expand All @@ -39,4 +40,9 @@ public String[] getRuleNames() {
public String getGrammarFileName() {
return null;
}

@Override
public ATN getATN() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.atn.ATN;


public class DemoEmptyParser extends Parser {
Expand All @@ -45,4 +46,9 @@ public String[] getRuleNames() {
public String getGrammarFileName() {
return null;
}

@Override
public ATN getATN() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.atn.ATN;

public class DemoLexer extends Lexer {

Expand All @@ -44,4 +45,9 @@ public String[] getTokenNames() {
public String getGrammarFileName() {
return null;
}

@Override
public ATN getATN() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.github._1c_syntax.bsl.parser.BSLParserRuleContext;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.RuleVersion;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.tree.ParseTree;

import java.util.Collections;
Expand Down Expand Up @@ -55,17 +55,20 @@ public String getGrammarFileName() {
return null;
}

@Override
public ATN getATN() {
return null;
}

@Override
public void reset() {
// no op
}

@RuleVersion(0)
public final BSLParserRuleContext rule1() throws RecognitionException {
return new DemoRuleContext(0, new DemoRuleContext(1), new DemoRuleContext(1), new DemoRuleContext(2));
}

@RuleVersion(0)
public final BSLParserRuleContext rule2() throws RecognitionException {
return new DemoRuleContext(1);
}
Expand Down

0 comments on commit 666a7b0

Please sign in to comment.