Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 2988: Change individual to grouped parsing #2989

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2676bc0
Advance to latest stable version.
kaby76 Jan 3, 2023
e37cad7
Changes for #2988--changing tests to group parsings in one call.
kaby76 Jan 4, 2023
90080be
The "-file" option not used anymore.
kaby76 Jan 4, 2023
f06fbbb
Update for changed name of directory for generated code--now is targe…
kaby76 Jan 4, 2023
c018962
Fix regression in trgen, use latest alpha2.
kaby76 Jan 4, 2023
dc0a62c
Update templates.
kaby76 Jan 5, 2023
aa331d2
Remaster all existing .errors files since these were created ad hoc. …
kaby76 Jan 5, 2023
c2459bf
Fix template for CSharp.
kaby76 Jan 5, 2023
c2d40cb
Call latest trgen.
kaby76 Jan 5, 2023
da71019
Set version of trgen. Make sure to comment out ATN tracing capability…
kaby76 Jan 5, 2023
5fb7d12
The "-file" command-line option is no longer recognize. Just name a f…
kaby76 Jan 6, 2023
e237415
Remove .errors compare in Powershell tester--too many testers that du…
kaby76 Jan 6, 2023
ebb3da6
Fix exit code from parse with *expected* error (it's not really an er…
kaby76 Jan 6, 2023
da1459e
Update Dart driver and test.
kaby76 Jan 8, 2023
bb10460
Make "tester.psm1" into stand-alone Powershell scripts, mirroring exa…
kaby76 Jan 8, 2023
aef2aa1
Updates to tester.ps1 script.
kaby76 Jan 9, 2023
fea2ad7
Rename to be consistent in name as well as purpose and code steps wit…
kaby76 Jan 9, 2023
75d13ef
Merge branch 'antlr:master' into issue-2988
kaby76 Jan 9, 2023
0541b2b
Merge branch 'issue-2988' of https://github.com/kaby76/grammars-v4 in…
kaby76 Jan 9, 2023
2f76f55
Fixes for Antlr4cs, CSharp, Dart targets with Powershell and Bash tes…
kaby76 Jan 9, 2023
eb23348
Updates to Antlr4cs, CSharp, Dart, Go templates.
kaby76 Jan 9, 2023
d858208
"files" should be the result of "find . -type f > files". Not critica…
kaby76 Jan 10, 2023
27b407d
Fixing tabs/spaces.
kaby76 Jan 10, 2023
4b0c42e
Fix newline that should not be there.
kaby76 Jan 10, 2023
518020b
Updates for Cpp template.
kaby76 Jan 10, 2023
047eed6
Update Java template. Fix exit code.
kaby76 Jan 10, 2023
c006ee0
Updates to Java template.
kaby76 Jan 10, 2023
2f8f35e
Updates for JavaScript template.
kaby76 Jan 10, 2023
ba9f6c2
Updates to PHP templates.
kaby76 Jan 10, 2023
2104051
Updates for PHP and Python3 templates.
kaby76 Jan 11, 2023
1ea7291
Update to latest trgen.
kaby76 Jan 11, 2023
c7230df
Remove OS query code since it does not work.
kaby76 Jan 11, 2023
8b69969
Fix bugs.
kaby76 Jan 11, 2023
f2aa8ac
Updates to templates to be more robust, fix problems.
kaby76 Jan 12, 2023
d7687b8
Fixes.
kaby76 Jan 12, 2023
10049f3
Change regtest.sh to call bash.sh directly. Fix Test.dart parser name…
kaby76 Jan 12, 2023
781f57a
Each and every error messages have a newline terminating the message!
kaby76 Jan 12, 2023
c271908
Bump versions for Trash tools being used.
kaby76 Jan 12, 2023
1006965
Merge branch 'antlr:master' into issue-2988
kaby76 Jan 13, 2023
7c526b5
Fix "no exaamples" error.
kaby76 Jan 13, 2023
24874c5
Fix missing close() call, without .errors files empty.
kaby76 Jan 13, 2023
d5ac34e
Fix when no test cases are provided, in test.sh.
kaby76 Jan 13, 2023
02ca5a9
Skip plsql and mysql for Python3 target--takes too long ("-tree" issu…
kaby76 Jan 13, 2023
891a064
Fix unicode/graphemes grammar test.
kaby76 Jan 13, 2023
06ff0f1
Send output to stderr since Powershell Write-Host has problems when b…
kaby76 Jan 13, 2023
4d19f90
Add in triconv step to remove bad unicode input files.
kaby76 Jan 14, 2023
f1c6100
Add in triconv test for invalid utf-8 input files in tests.
kaby76 Jan 14, 2023
0559460
Fixes to Dart and Go templates.
kaby76 Jan 15, 2023
2a18ae4
Fixes to trgen because Antlr4 grammar was messed up.
kaby76 Jan 15, 2023
ca0712b
Updated templates with build.sh, clean.sh, clean.ps1, simplified make…
kaby76 Jan 15, 2023
cc386ee
Fix build Cpp/Ubuntu.
kaby76 Jan 15, 2023
835158e
Add in code to get dependencies.
kaby76 Jan 15, 2023
b73c8f1
Setup for release.
kaby76 Jan 15, 2023
f704711
Not sure where the code for SyntaxError in javascript came from, but …
kaby76 Jan 17, 2023
e23956e
Fix templates.
kaby76 Jan 18, 2023
dbe625d
Fixes to templates.
kaby76 Jan 18, 2023
fb68f29
Remove conflicting implementations with Test.java.
kaby76 Jan 18, 2023
f76f128
Fix JS test script. Remove kirikiri-tjs from Python3 testing, remove …
kaby76 Jan 18, 2023
3abc063
Fix collision in build.sh and clean.sh with trgen templates. Fix antl…
kaby76 Jan 19, 2023
e191295
Add scss grammar to skip javascript. Timeout.
kaby76 Jan 19, 2023
077f178
There seems to be a problem with a file system issue and/or locale is…
kaby76 Jan 20, 2023
c32f9ea
Fix regex pattern, from dev branch of antlr4 repo.
kaby76 Jan 20, 2023
0213da4
These grammars are too slow with the Go target in combined parsing.
kaby76 Jan 20, 2023
9363da7
If a test file is not tracked, there will be new .errors files. These…
kaby76 Jan 21, 2023
bbf21ca
Corrections and commenting code.
kaby76 Jan 22, 2023
72efb43
Update templates.
kaby76 Jan 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ jobs:
- name: Install trgen
shell: pwsh
run: |
dotnet tool install -g trgen --version 0.16.3
dotnet tool install -g trwdog --version 0.16.3
dotnet tool install -g trgen --version 0.19.0
dotnet tool install -g triconv --version 0.19.0
dotnet tool install -g trwdog --version 0.19.0
if ("${{ matrix.os }}" -eq "ubuntu-latest") {
echo "$HOME/.dotnet/tools" >> $env:GITHUB_PATH
}
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@

# Ignore downloaded temporaries create by _scripts/get-antlr.ps1
antlr4-*-complete.jar

# Ignore untracked .errors and .tree files. If it was
# checked in, it is tracked, and cannot be ignored.
/**/*.errors
/**/*.tree
11 changes: 5 additions & 6 deletions _scripts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
This directory contains scripts for CI testing.

* regtest.sh -- This is a Bash-based script to test any target. To
run, cd to grammar-vs/, then type `bash regtest.sh <target>` where `<target>` is CSharp, Java, Cpp, Dart, Go, or one
of the other targets. To test the target, you will need the NET SDK installed,
access to the internet, and to toolchain for the target you want to test.
For CSharp, it will download the Antlr4 tool and runtime. For the other
targets, you will need to download the Antlr4 tool antlr-4.9.3-complete.jar and
place it in /tmp.
run, cd to grammar-vs/ or a grammar directory, then type `bash regtest.sh <target>`
where `<target>` is Antlr4cs, Cpp, CSharp, Dart, Go, Java, PHP, or Python3.
To test the target, you will need the NET SDK installed (required for the trgen
driver generator), access to the internet, and to toolchain for the target
you want to test. You will also need to set the Antlr4 tool.

* test.ps1 -- this is a Powershell script for testing, similar to regtest.sh.

Expand Down
5 changes: 3 additions & 2 deletions _scripts/really-run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ $antlrPath = _scripts/get-antlr.ps1 "4.11.1"
# Set up env as it is used in test script.
echo "antlr_path=$antlrPath" >> $env:GITHUB_ENV

dotnet tool install -g trgen --version 0.16.3
dotnet tool install -g trwdog --version 0.16.3
dotnet tool install -g trgen --version 0.19.0
dotnet tool install -g triconv --version 0.19.0
dotnet tool install -g trwdog --version 0.19.0

# Call test script.
$env:ANTLR_JAR_PATH="$antlrPath"
Expand Down
21 changes: 11 additions & 10 deletions _scripts/regtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ add() {
fi
}

rm -rf `find . -name Generated -type d`
rm -rf `find . -name 'Generated*' -type d`

build()
{
Expand All @@ -108,7 +108,7 @@ build()
echo Building $testname
echo ""
# Assert(cwd is valid)
pushd "$x/Generated"
pushd "$x/Generated-$target"
if [[ $? != "0" ]]
then
echo "$1 is not a valid directory"
Expand Down Expand Up @@ -136,14 +136,14 @@ test()
echo Testing $testname
echo ""
# Assert(cwd is valid)
pushd "$x/Generated"
pushd "$x/Generated-$target"
if [[ $? != "0" ]]
then
echo "$1 is not a valid directory"
exit 1
fi
date1=$(date +"%s")
make test
bash test.sh
status="$?"
date2=$(date +"%s")
DIFF=$(($date2-$date1))
Expand All @@ -166,9 +166,10 @@ setupdeps()
if [ $? != "0" ]
then
echo "Setting up trgen and antlr jar."
dotnet tool install -g trgen --version 0.16.3
dotnet tool install -g trxml2 --version 0.16.3
dotnet tool install -g trwdog --version 0.16.3
dotnet tool install -g trgen --version 0.19.0
dotnet tool install -g triconv --version 0.19.0
dotnet tool install -g trxml2 --version 0.19.0
dotnet tool install -g trwdog --version 0.19.0
case "${unameOut}" in
Linux*) curl 'https://repo1.maven.org/maven2/org/antlr/antlr4/4.11.1/antlr4-4.11.1-complete.jar' -o /tmp/antlr4-4.11.1-complete.jar;;
Darwin*) curl 'https://repo1.maven.org/maven2/org/antlr/antlr4/4.11.1/antlr4-4.11.1-complete.jar' -o /tmp/antlr4-4.11.1-complete.jar;;
Expand All @@ -185,7 +186,7 @@ part1()
{
date
# 1) Generate driver source code from poms.
rm -rf `find . -name Generated -type d`
rm -rf `find . -name Generated-$target -type d`
echo "Generating drivers."
if [[ "$invert" == "" ]]
then
Expand All @@ -208,7 +209,7 @@ part2()
esac
echo prefix $prefix
echo bft $build_file_type
build_files=`find $prefix -type f -name $build_file_type | grep Generated`
build_files=`find $prefix -type f -name $build_file_type | grep Generated-$target`
echo bf $build_files
for build_file in $build_files
do
Expand All @@ -229,7 +230,7 @@ part3()
# 3) Test generated parser on examples.
echo "Parsing."
date
build_files=`find $prefix -type f -name $build_file_type | grep Generated`
build_files=`find $prefix -type f -name $build_file_type | grep Generated-$target`
echo bf $build_files
for build_file in $build_files
do
Expand Down
3 changes: 3 additions & 0 deletions _scripts/skip-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ antlr/antlr2
antlr/antlr3
antlr/antlr4
apex
asm/asm8086
asn/asn_3gpp
clif
cobol85
Expand All @@ -11,6 +12,7 @@ csharp
dart2
databank
edif300
fasta
fortran77
gdscript
glsl
Expand Down Expand Up @@ -73,6 +75,7 @@ sql/hive/v2
sql/hive/v3
sql/plsql
sql/postgresql
sql/tsql
stringtemplate
swift/swift2
swift/swift3
Expand Down
1 change: 1 addition & 0 deletions _scripts/skip-javascript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ r
rego
rexx
rust
scss
sql/hive/v2
sql/hive/v3
sql/mariadb
Expand Down
3 changes: 3 additions & 0 deletions _scripts/skip-python3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ javascript/ecmascript
javascript/jsx
javascript/typescript
joss
kirikiri-tjs
kotlin/kotlin
kotlin/kotlin-formal
kuka
Expand Down Expand Up @@ -84,6 +85,8 @@ sparql
sql/hive/v2
sql/hive/v3
sql/mariadb
sql/mysql
sql/plsql
sql/postgresql
sql/sqlite
sql/tsql
Expand Down
2 changes: 1 addition & 1 deletion _scripts/templates/Antlr4cs/CaseChangingCharStream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Template generated code from trgen <version>
// Generated from trgen <version>

/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
60 changes: 32 additions & 28 deletions _scripts/templates/Antlr4cs/ErrorListener.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
// Generated from trgen <version>

using Antlr4.Runtime;
using Antlr4.Runtime.Misc;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

<if(has_name_space)>namespace <name_space>
{<endif>
public class ErrorListener<Symbol> : IAntlrErrorListener<Symbol>
public class ErrorListener\<S> : IAntlrErrorListener\<S>
{
/// <summary>
/// Provides a default instance of
/// <see cref="ErrorListener{Symbol}"/>
/// .
/// </summary>
public static readonly ErrorListener<Symbol> Instance = new ErrorListener<Symbol>();
public bool had_error;
bool _quiet;
bool _tee;
TextWriter _out;

public ErrorListener(bool quiet, bool tee, TextWriter @out)
{
_quiet = quiet;
_tee = tee;
_out = @out;
}

/// <summary>
/// <inheritDoc/>
/// <p>
/// This implementation prints messages to
/// <see cref="System.Console.Out"/>
/// containing the
/// values of
/// <paramref name="line"/>
/// ,
/// <paramref name="charPositionInLine"/>
/// , and
/// <paramref name="msg"/>
/// using
/// the following format.</p>
/// <pre>
/// line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
/// </pre>
/// </summary>
public virtual void SyntaxError(IRecognizer recognizer, Symbol offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
public virtual void SyntaxError(IRecognizer recognizer, S offendingSymbol, int line, int col, string msg, RecognitionException e)
{
System.Console.Out.WriteLine("line " + line + ":" + charPositionInLine + " " + msg);
had_error = true;
if (_tee)
{
_out.WriteLine("line " + line + ":" + col + " " + msg);
}
if (!_quiet)
{
System.Console.Error.WriteLine("line " + line + ":" + col + " " + msg);
}
}
}
<if(has_name_space)>}<endif>
<if(has_name_space)>}<endif>
121 changes: 0 additions & 121 deletions _scripts/templates/Antlr4cs/Program.cs

This file was deleted.

Loading