Skip to content

Commit

Permalink
Fixes, structure, readme.
Browse files Browse the repository at this point in the history
Signed-off-by: mmazas <[email protected]>
  • Loading branch information
mmazas authored and mmazas committed Feb 11, 2025
1 parent aa1986c commit 8e69b14
Show file tree
Hide file tree
Showing 197 changed files with 6,833 additions and 3,874 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
# Copyright (c) 2020-2024, Sreeni Viswanadha <[email protected]>.
# Copyright (c) 2024, Marc Mazas <[email protected]>.
# Copyright (c) 2020-2025, Sreeni Viswanadha <[email protected]>.
# Copyright (c) 2024-2025, Marc Mazas <[email protected]>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
BSD 3-Clause License

Copyright (c) 2020-2021, javacc
Copyright (c) 2020-2024, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024, Marc Mazas <[email protected]>.
Copyright (c) 2020-2025, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024-2025, Marc Mazas <[email protected]>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# JavaCC-8 C++ (CPP)

This is the JavaCC **C++** generator Git repository / java & maven project of JavaCC version 8.

See the README at [javacc-8](https://github.com/javacc/javacc-8)
877 changes: 354 additions & 523 deletions bugs/bug001/files/clc1.exp_err

Large diffs are not rendered by default.

221 changes: 89 additions & 132 deletions bugs/bug001/files/clc2.exp_err
Original file line number Diff line number Diff line change
@@ -1,149 +1,106 @@
<DEFAULT>
Current character: 'a' at 1:1
<DEFAULT> Current input char: 'a' at 1:1
No string literal start with char: 'a'
Starting NFA with start state: 0
Current character: 'a'
Looking to move from state: 0 for: <Id>
state=0 vectorindex=1 bitpattern=8589934592 jjChars[state][vectorIndex]=576460743847706622
Found a match of kind:9; kind: <Id> using the first: 0 characters.
Current character: 'a'
Looking to move from state: 1 for: <Id>
state=1 vectorindex=1 bitpattern=8589934592 jjChars[state][vectorIndex]=576460743847706622
Found a match of kind:9; kind: <Id> using the first: 1 characters.
Current character: ' '
Looking to move from state: 1 for: <Id>
state=1 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=287984085547089920
Cur char: 'a'
Looking to move from state: 0 <Id>
Found a match of kind: 9 [<Id>] using the first: 0 characters
Cur char: 'a'
Looking to move from state: 1 <Id>
Found a match of kind: 9 [<Id>] using the first: 1 characters
Cur char: ' '
Looking to move from state: 1 <Id>
Done with NFA at pos: 2
Returning token: 'aa'
<DEFAULT>
Current character: ' ' at 1:3
Looking for string literal match of kind:1 token image: ' '
Current character: ' '
Currently matched the first: 1 chars as kind: 1,with image:
Returning token: 'aa'
<DEFAULT> Current input char: ' ' at 1:3
Looking for string literal match of kind: 1 " "
Cur char: ' '
Currently matched the first: 1 chars as kind: 1 " "
No NFA state at pos: 2
Found a SKIP match.
<DEFAULT>
Current character: '-' at 1:4
Looking for string literal match of kind:7 token image: '--'
Current character: '-'
Current character: '-'
Currently matched the first: 2 chars as kind: 7,with image: --
Found a SKIP match
<DEFAULT> Current input char: '-' at 1:4
Looking for string literal match of kind: 7 "--"
Cur char: '-'
Cur char: '-'
Currently matched the first: 2 chars as kind: 7 "--"
No NFA state at pos: 3
Found a SKIP match.
<LineComment>
Current character: ' ' at 1:6
Found a SKIP match
<LineComment> Current input char: ' ' at 1:6
No string literal start with char: ' '
Starting NFA with start state: 9
Current character: ' '
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=35184372088832
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=9216
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=8192
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=18446708889337453567
Found a match of kind:8; kind: <token of kind 8> using the first: 0 characters.
Looking to move from state: 9 for: <UNKNOWN>
state=9 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=0
Current character: 'o'
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=1 bitpattern=140737488355328 jjChars[state][vectorIndex]=0
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=1 bitpattern=140737488355328 jjChars[state][vectorIndex]=0
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=1 bitpattern=140737488355328 jjChars[state][vectorIndex]=0
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=1 bitpattern=140737488355328 jjChars[state][vectorIndex]=18446744073709551615
Found a match of kind:8; kind: <token of kind 8> using the first: 1 characters.
Current character: '-'
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=35184372088832
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=9216
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=8192
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=18446708889337453567
Current character: 'i'
Looking to move from state: 8 for: <token of kind 8>
state=8 vectorindex=1 bitpattern=2199023255552 jjChars[state][vectorIndex]=0
Looking to move from state: 7 for: <UNKNOWN>
state=7 vectorindex=1 bitpattern=2199023255552 jjChars[state][vectorIndex]=0
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=1 bitpattern=2199023255552 jjChars[state][vectorIndex]=0
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=1 bitpattern=2199023255552 jjChars[state][vectorIndex]=18446744073709551615
Found a match of kind:8; kind: <token of kind 8> using the first: 3 characters.
Current character: ' '
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=35184372088832
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=9216
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=8192
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=18446708889337453567
Found a match of kind:8; kind: <token of kind 8> using the first: 4 characters.
Current character: '-'
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=35184372088832
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=9216
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=8192
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=18446708889337453567
Current character: '-'
Looking to move from state: 8 for: <token of kind 8>
state=8 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=35184372088832
Found a match of kind:8; kind: <token of kind 8> using the first: 6 characters.
Looking to move from state: 7 for: <UNKNOWN>
state=7 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=8192
Looking to move from state: 5 for: <token of kind 8>
state=5 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=9216
Looking to move from state: 2 for: <token of kind 8>
state=2 vectorindex=0 bitpattern=35184372088832 jjChars[state][vectorIndex]=18446708889337453567
Cur char: ' '
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 4 <UNKNOWN>
Looking to move from state: 2 <token of kind 8>
Found a match of kind: 8 [<token of kind 8>] using the first: 0 characters
Looking to move from state: 9 <UNKNOWN>
Cur char: 'o'
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 4 <UNKNOWN>
Looking to move from state: 2 <token of kind 8>
Found a match of kind: 8 [<token of kind 8>] using the first: 1 characters
Cur char: '-'
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 4 <UNKNOWN>
Looking to move from state: 2 <token of kind 8>
Cur char: 'i'
Looking to move from state: 8 <token of kind 8>
Looking to move from state: 7 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 2 <token of kind 8>
Found a match of kind: 8 [<token of kind 8>] using the first: 3 characters
Cur char: ' '
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 4 <UNKNOWN>
Looking to move from state: 2 <token of kind 8>
Found a match of kind: 8 [<token of kind 8>] using the first: 4 characters
Cur char: '-'
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 4 <UNKNOWN>
Looking to move from state: 2 <token of kind 8>
Cur char: '-'
Looking to move from state: 8 <token of kind 8>
Found a match of kind: 8 [<token of kind 8>] using the first: 6 characters
Looking to move from state: 7 <UNKNOWN>
Looking to move from state: 5 <token of kind 8>
Looking to move from state: 2 <token of kind 8>
Done with NFA at pos: 6
Found a SKIP match.
<DEFAULT>
Current character: ' ' at 1:13
Looking for string literal match of kind:1 token image: ' '
Current character: ' '
Currently matched the first: 1 chars as kind: 1,with image:
Found a SKIP match
<DEFAULT> Current input char: ' ' at 1:13
Looking for string literal match of kind: 1 " "
Cur char: ' '
Currently matched the first: 1 chars as kind: 1 " "
No NFA state at pos: 2
Found a SKIP match.
<DEFAULT>
Current character: 'b' at 1:14
Found a SKIP match
<DEFAULT> Current input char: 'b' at 1:14
No string literal start with char: 'b'
Starting NFA with start state: 0
Current character: 'b'
Looking to move from state: 0 for: <Id>
state=0 vectorindex=1 bitpattern=17179869184 jjChars[state][vectorIndex]=576460743847706622
Found a match of kind:9; kind: <Id> using the first: 0 characters.
Current character: 'b'
Looking to move from state: 1 for: <Id>
state=1 vectorindex=1 bitpattern=17179869184 jjChars[state][vectorIndex]=576460743847706622
Found a match of kind:9; kind: <Id> using the first: 1 characters.
Current character: ''
Looking to move from state: 1 for: <Id>
state=1 vectorindex=0 bitpattern=8192 jjChars[state][vectorIndex]=287984085547089920
Cur char: 'b'
Looking to move from state: 0 <Id>
Found a match of kind: 9 [<Id>] using the first: 0 characters
Cur char: 'b'
Looking to move from state: 1 <Id>
Found a match of kind: 9 [<Id>] using the first: 1 characters
Cur char: ''
Looking to move from state: 1 <Id>
Done with NFA at pos: 2
Returning token: 'bb'
<DEFAULT>
Current character: '' at 1:16
Looking for string literal match of kind:4 token image: '\r'
Current character: ''
Currently matched the first: 1 chars as kind: 4,with image: \r
Returning token: 'bb'
<DEFAULT> Current input char: '' at 1:16
Looking for string literal match of kind: 4 "\r"
Cur char: ''
Currently matched the first: 1 chars as kind: 4 "\r"
No NFA state at pos: 2
Found a SKIP match.
<DEFAULT>
Current character: '
Found a SKIP match
<DEFAULT> Current input char: '
' at 1:17
Looking for string literal match of kind:3 token image: '\n'
Current character: '
Looking for string literal match of kind: 3 "\n"
Cur char: '
'
Currently matched the first: 1 chars as kind: 3,with image: \n
Found a SKIP match.
Currently matched the first: 1 chars as kind: 3 "\n"
Found a SKIP match
<DEFAULT> Reached EOF at 1:17
Input file parsed successfully
Expand Down
4 changes: 2 additions & 2 deletions bugs/bug001/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020-2024, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024, Marc Mazas <[email protected]>.
Copyright (c) 2020-2025, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024-2025, Marc Mazas <[email protected]>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 2 additions & 0 deletions bugs/bug001/src/main/javacc/ComplexLineComment.jj
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
options {
DEBUG_TOKEN_MANAGER=true;
JAVA_UNICODE_ESCAPE = true; // (JavaCC - default false)
// KEEP_LINE_COLUMN = false; // (JavaCC - default true; undocumented) // test
}

PARSER_BEGIN(ComplexLineComment)
Expand Down
76 changes: 32 additions & 44 deletions bugs/bug002/files/bug.exp_err
Original file line number Diff line number Diff line change
@@ -1,52 +1,40 @@
<DEFAULT>
Current character: '{' at 1:1
Looking for string literal match of kind:7 token image: '{'
Current character: '{'
Currently matched the first: 1 chars as kind: 7,with image: {
<DEFAULT> Current input char: '{' at 1:1
Looking for string literal match of kind: 7 "{"
Cur char: '{'
Currently matched the first: 1 chars as kind: 7 "{"
No NFA state at pos: 2
Returning token: '{'
<DEFAULT>
Current character: ' ' at 1:2
Looking for string literal match of kind:1 token image: ' '
Current character: ' '
Currently matched the first: 1 chars as kind: 1,with image:
Returning token: '{'
<DEFAULT> Current input char: ' ' at 1:2
Looking for string literal match of kind: 1 " "
Cur char: ' '
Currently matched the first: 1 chars as kind: 1 " "
No NFA state at pos: 2
Found a SKIP match.
<DEFAULT>
Current character: 'c' at 1:3
Found a SKIP match
<DEFAULT> Current input char: 'c' at 1:3
No string literal start with char: 'c'
Starting NFA with start state: 0
Current character: 'c'
Looking to move from state: 3 for: <IDENTIFIANT>
state=3 vectorindex=1 bitpattern=34359738368 jjChars[state][vectorIndex]=576460743713488896
Found a match of kind:17; kind: <IDENTIFIANT> using the first: 0 characters.
Looking to move from state: 1 for: <NUMBER>
state=1 vectorindex=1 bitpattern=34359738368 jjChars[state][vectorIndex]=0
Looking to move from state: 0 for: <NUMBER>
state=0 vectorindex=1 bitpattern=34359738368 jjChars[state][vectorIndex]=0
Current character: ' '
Looking to move from state: 7 for: <VALUEREFERENCE>
state=7 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=287948901175001088
Looking to move from state: 6 for: <UNKNOWN>
state=6 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=35184372088832
Looking to move from state: 5 for: <IDENTIFIANT>
state=5 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=287948901175001088
Looking to move from state: 4 for: <UNKNOWN>
state=4 vectorindex=0 bitpattern=4294967296 jjChars[state][vectorIndex]=35184372088832
Cur char: 'c'
Looking to move from state: 3 <IDENTIFIANT>
Found a match of kind: 17 [<IDENTIFIANT>] using the first: 0 characters
Looking to move from state: 1 <NUMBER>
Looking to move from state: 0 <NUMBER>
Cur char: ' '
Looking to move from state: 7 <VALUEREFERENCE>
Looking to move from state: 6 <UNKNOWN>
Looking to move from state: 5 <IDENTIFIANT>
Looking to move from state: 4 <UNKNOWN>
Done with NFA at pos: 1
Returning token: 'c'
<DEFAULT>
Current character: ' ' at 1:4
Looking for string literal match of kind:1 token image: ' '
Current character: ' '
Currently matched the first: 1 chars as kind: 1,with image:
Returning token: 'c'
<DEFAULT> Current input char: ' ' at 1:4
Looking for string literal match of kind: 1 " "
Cur char: ' '
Currently matched the first: 1 chars as kind: 1 " "
No NFA state at pos: 2
Found a SKIP match.
<DEFAULT>
Current character: '}' at 1:5
Looking for string literal match of kind:8 token image: '}'
Current character: '}'
Currently matched the first: 1 chars as kind: 8,with image: }
Found a SKIP match
<DEFAULT> Current input char: '}' at 1:5
Looking for string literal match of kind: 8 "}"
Cur char: '}'
Currently matched the first: 1 chars as kind: 8 "}"
No NFA state at pos: 2
Returning token: '}'
Returning token: '}'
Input file parsed successfully
Binary file modified bugs/bug002/files/bug.exp_out
Binary file not shown.
4 changes: 2 additions & 2 deletions bugs/bug002/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020-2024, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024, Marc Mazas <[email protected]>.
Copyright (c) 2020-2025, Sreeni Viswanadha <[email protected]>.
Copyright (c) 2024-2025, Marc Mazas <[email protected]>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions bugs/bug002/src/main/cpp/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Bug.h"

using namespace std;
using namespace mns;

#define MYPARSER Bug
#define MYTM BugTokenManager
Expand Down
Loading

0 comments on commit 8e69b14

Please sign in to comment.