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

[build] Add Antlr-ng Tool to builds. #4385

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d05fc05
Update Trash tools, add new templates for antlr-ng tool parser genera…
kaby76 Jan 13, 2025
9e02a65
Updates for antlr-ng.
kaby76 Jan 14, 2025
626f29a
Update templates, tester, and version of Trash toolkit.
kaby76 Jan 16, 2025
3b1a348
Add debugging info.
kaby76 Jan 16, 2025
f5dada0
More debugging info.
kaby76 Jan 16, 2025
8d52e86
Forgot to add test for "*" as that is now a legal "target", meaning a…
kaby76 Jan 16, 2025
672e977
Typo in check.
kaby76 Jan 16, 2025
c18170d
Fix more typos.
kaby76 Jan 16, 2025
fb478e1
Add in generators testing.
kaby76 Jan 17, 2025
6bf1bee
Add debugging.
kaby76 Jan 17, 2025
9306194
Make sure to download jar for compile and run even though it is not u…
kaby76 Jan 17, 2025
77d711f
Update "*" recognition.
kaby76 Jan 17, 2025
31bfc96
Fix a couple of typos.
kaby76 Jan 17, 2025
0ee3c8b
Add in "npm init -y" for non-node projects.
kaby76 Jan 17, 2025
2309d12
Change "trxml2 .\Other.csproj" to "trxml2 Other.csproj" to workaround…
kaby76 Jan 17, 2025
4247a1f
Fix Cpp build, but Go and Dart messed up.
kaby76 Jan 17, 2025
004024a
Require "--version" for antlr-ng call.
kaby76 Jan 17, 2025
724a7a6
Updates to fix Cpp build.
kaby76 Jan 17, 2025
34bfe92
Fix "rm -rf" for Powershell. Fix location of antlr-ng.
kaby76 Jan 17, 2025
16d081d
Update Go target template and Trash for Go.
kaby76 Jan 19, 2025
bb61770
Merge branch 'antlr:master' into update-trash-antlr-ng
kaby76 Jan 29, 2025
cc1d70d
Updates to build antlr-ng in global directory. Prob won't work.
kaby76 Jan 29, 2025
73e6da3
Fix up global directory with temp variable.
kaby76 Jan 29, 2025
e52ca35
Fix typo in shell syntax.
kaby76 Jan 29, 2025
a3bd83c
Export environmental variables, try to find something that will work.
kaby76 Jan 29, 2025
70c2c9b
Replace with $HOME and see if that works. Prob not.
kaby76 Jan 29, 2025
2e16b0a
Fix Go target.
kaby76 Jan 29, 2025
dacf1ae
Fix Go templates.
kaby76 Jan 29, 2025
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
54 changes: 27 additions & 27 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,189 +3,189 @@
"isRoot": true,
"tools": {
"trcaret": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trcaret"
],
"rollForward": false
},
"trcover": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trcover"
],
"rollForward": false
},
"trgen": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trgen"
],
"rollForward": false
},
"trglob": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trglob"
],
"rollForward": false
},
"triconv": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"triconv"
],
"rollForward": false
},
"trparse": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trparse"
],
"rollForward": false
},
"trquery": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trquery"
],
"rollForward": false
},
"trtext": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trtext"
],
"rollForward": false
},
"trwdog": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trwdog"
],
"rollForward": false
},
"trxgrep": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trxgrep"
],
"rollForward": false
},
"trxml": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trxml"
],
"rollForward": false
},
"trxml2": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trxml2"
],
"rollForward": false
},
"trclonereplace": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trclonereplace"
],
"rollForward": false
},
"trcombine": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trcombine"
],
"rollForward": false
},
"trconvert": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trconvert"
],
"rollForward": false
},
"trfoldlit": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trfoldlit"
],
"rollForward": false
},
"trgenvsc": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trgenvsc"
],
"rollForward": false
},
"tritext": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"tritext"
],
"rollForward": false
},
"trjson": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trjson"
],
"rollForward": false
},
"trperf": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trperf"
],
"rollForward": false
},
"trrename": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trrename"
],
"rollForward": false
},
"trsort": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trsort"
],
"rollForward": false
},
"trsplit": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trsplit"
],
"rollForward": false
},
"trsponge": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trsponge"
],
"rollForward": false
},
"trtokens": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trtokens"
],
"rollForward": false
},
"trtree": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trtree"
],
"rollForward": false
},
"trunfold": {
"version": "0.23.11",
"version": "0.23.13",
"commands": [
"trunfold"
],
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
arch
uname -a
if [ -f /proc/cpuinfo ]; then cat /proc/cpuinfo; fi
export
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -149,6 +150,15 @@ jobs:
shell: bash
run: |
dotnet trgen --help
- name: Install Antlr-ng
shell: bash
run: |
cd $HOME
git clone https://github.com/mike-lischke/antlr-ng.git
cd antlr-ng
git checkout 27676950c547854a62c826345b22b57b8b8c8a98
npm i
npm run build
- name: Test
shell: pwsh
run: |
Expand Down
108 changes: 108 additions & 0 deletions _scripts/templates/Antlr4cs/st.CaseChangingCharStream.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// 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
* can be found in the LICENSE.txt file in the project root.
*/
using System;
using Antlr4.Runtime.Misc;

namespace Antlr4.Runtime
{
/// \<summary>
/// This class supports case-insensitive lexing by wrapping an existing
/// \<see cref=""ICharStream""/> and forcing the lexer to see either upper or
/// lowercase characters. Grammar literals should then be either upper or
/// lower case such as 'BEGIN' or 'begin'. The text of the character
/// stream is unaffected. Example: input 'BeGiN' would match lexer rule
/// 'BEGIN' if constructor parameter upper=true but getText() would return
/// 'BeGiN'.
/// \</summary>
public class CaseChangingCharStream : ICharStream
{
private ICharStream stream;
private bool upper;

/// \<summary>
/// Constructs a new CaseChangingCharStream wrapping the given \<paramref name=""stream""/> forcing
/// all characters to upper case or lower case.
/// \</summary>
/// \<param name=""stream"">The stream to wrap.\</param>
/// \<param name=""upper"">If true force each symbol to upper
/// case, otherwise force to lower.\</param>
public CaseChangingCharStream(ICharStream stream, bool upper)
{
this.stream = stream;
this.upper = upper;
}

public int Index
{
get
{
return stream.Index;
}
}

public int Size
{
get
{
return stream.Size;
}
}

public string SourceName
{
get
{
return stream.SourceName;
}
}

public void Consume()
{
stream.Consume();
}

[return: NotNull]
public string GetText(Interval interval)
{
return stream.GetText(interval);
}

public int La(int i)
{
int c = stream.La(i);

if (c \<= 0)
{
return c;
}

char o = (char)c;

if (upper)
{
return (int)char.ToUpperInvariant(o);
}

return (int)char.ToLowerInvariant(o);
}

public int Mark()
{
return stream.Mark();
}

public void Release(int marker)
{
stream.Release(marker);
}

public void Seek(int index)
{
stream.Seek(index);
}
}
}
39 changes: 39 additions & 0 deletions _scripts/templates/Antlr4cs/st.ErrorListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +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\<S> : IAntlrErrorListener\<S>
{
public bool had_error;
bool _quiet;
bool _tee;
TextWriter _out;

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

public virtual void SyntaxError(IRecognizer recognizer, S offendingSymbol, int line, int col, string msg, RecognitionException e)
{
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>
Loading
Loading