Skip to content

Commit

Permalink
update gradle script to version 8 and renamed Grammar file
Browse files Browse the repository at this point in the history
  • Loading branch information
saharmehrpour committed Oct 31, 2023
1 parent 05d1610 commit 99f4a4c
Show file tree
Hide file tree
Showing 13 changed files with 1,709 additions and 1,697 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ There is also another json file named `tagTable.json`. In this file we store inf

This system is using ANTLR4.

* The grammar is stored in `myGrammar.g4`
* The grammar is stored in `rulePadGrammar.g4`
* The generated code with ANTLR is created through `gradle` script.
* The `gradle.build` file is located in the root directory of the project.
* Run `gradle generateParser`
Expand Down
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
apply plugin: 'java'
plugins {
id 'java'
}

repositories {
jcenter()
mavenCentral()
}

dependencies {
runtime 'org.antlr:antlr4:4.7.1'
implementation 'org.antlr:antlr4:4.7.1'
}

task generateParser(type:JavaExec) {
main = 'org.antlr.v4.Tool'
classpath = sourceSets.main.runtimeClasspath
args = ['-Dlanguage=JavaScript', 'myGrammar.g4', '-o', 'src/core/generated-parser']
args = ['-Dlanguage=JavaScript', 'rulePadGrammar.g4', '-o', 'src/core/generated-parser']
}
2 changes: 1 addition & 1 deletion myGrammar.g4 → rulePadGrammar.g4
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grammar myGrammar;
grammar rulePadGrammar;

inputSentence
: (emptyLine* | mustClause) end? NL* EOF
Expand Down
4 changes: 2 additions & 2 deletions src/core/generateXPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GenerateXPath {
channel: number
column: number
line: number
source: [myGrammarLexer, InputStream]
source: [rulePadGrammarLexer, InputStream]
start: number
stop: number
tokenIndex: number
Expand Down Expand Up @@ -88,7 +88,7 @@ class GenerateXPath {
exception: null ?
invokingState: number
parentCtx: {parentNode}
parser: myGrammarParser {...}
parser: rulePadGrammarParser {...}
ruleIndex: number
start: CommonToken {source: Array(2), type: 21, channel: 0, start: 8, stop: 8, …}
stop: CommonToken {source: Array(2), type: 26, channel: 0, start: 66, stop: 66, …}
Expand Down
Loading

0 comments on commit 99f4a4c

Please sign in to comment.