Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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.16",
"commands": [
"trcaret"
],
"rollForward": false
},
"trcover": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trcover"
],
"rollForward": false
},
"trgen": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trgen"
],
"rollForward": false
},
"trglob": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trglob"
],
"rollForward": false
},
"triconv": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"triconv"
],
"rollForward": false
},
"trparse": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trparse"
],
"rollForward": false
},
"trquery": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trquery"
],
"rollForward": false
},
"trtext": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trtext"
],
"rollForward": false
},
"trwdog": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trwdog"
],
"rollForward": false
},
"trxgrep": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trxgrep"
],
"rollForward": false
},
"trxml": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trxml"
],
"rollForward": false
},
"trxml2": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trxml2"
],
"rollForward": false
},
"trclonereplace": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trclonereplace"
],
"rollForward": false
},
"trcombine": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trcombine"
],
"rollForward": false
},
"trconvert": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trconvert"
],
"rollForward": false
},
"trfoldlit": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trfoldlit"
],
"rollForward": false
},
"trgenvsc": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trgenvsc"
],
"rollForward": false
},
"tritext": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"tritext"
],
"rollForward": false
},
"trjson": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trjson"
],
"rollForward": false
},
"trperf": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trperf"
],
"rollForward": false
},
"trrename": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trrename"
],
"rollForward": false
},
"trsort": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trsort"
],
"rollForward": false
},
"trsplit": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trsplit"
],
"rollForward": false
},
"trsponge": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trsponge"
],
"rollForward": false
},
"trtokens": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trtokens"
],
"rollForward": false
},
"trtree": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trtree"
],
"rollForward": false
},
"trunfold": {
"version": "0.23.11",
"version": "0.23.16",
"commands": [
"trunfold"
],
Expand Down
11 changes: 11 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,16 @@ jobs:
shell: bash
run: |
dotnet trgen --help
- name: Install Antlr-ng
shell: pwsh
run: |
cd $HOME
git clone https://github.com/mike-lischke/antlr-ng.git
cd antlr-ng
echo HOME $HOME
git checkout 4975d4a7b556e34c38c2e53b9815c8c4c802236f
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