Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SableCC STUPS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
SableCC STUPS
Commits
3b8fe35f
Commit
3b8fe35f
authored
1 year ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Rename generated Lexer local variables to no shadow instance fields
parent
afead31d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
+90
-90
90 additions, 90 deletions
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
src/main/resources/org/sablecc/sablecc/lexer.txt
+13
-13
13 additions, 13 deletions
src/main/resources/org/sablecc/sablecc/lexer.txt
with
103 additions
and
103 deletions
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
+
90
−
90
View file @
3b8fe35f
...
@@ -68,8 +68,8 @@ public class Lexer
...
@@ -68,8 +68,8 @@ public class Lexer
int
acceptLine
=
-
1
;
int
acceptLine
=
-
1
;
boolean
acceptCr
=
false
;
boolean
acceptCr
=
false
;
int
[][][]
gotoTable
=
Lexer
.
gotoTable
[
this
.
state
.
ordinal
()];
int
[][][]
gotoTable
Sub
=
Lexer
.
gotoTable
[
this
.
state
.
ordinal
()];
int
[]
accept
=
Lexer
.
accept
[
this
.
state
.
ordinal
()];
int
[]
accept
Sub
=
Lexer
.
accept
[
this
.
state
.
ordinal
()];
this
.
text
.
setLength
(
0
);
this
.
text
.
setLength
(
0
);
while
(
true
)
while
(
true
)
...
@@ -126,7 +126,7 @@ public class Lexer
...
@@ -126,7 +126,7 @@ public class Lexer
dfaState
=
-
1
;
dfaState
=
-
1
;
int
[][]
tmp1
=
gotoTable
[
oldState
];
int
[][]
tmp1
=
gotoTable
Sub
[
oldState
];
int
low
=
0
;
int
low
=
0
;
int
high
=
tmp1
.
length
-
1
;
int
high
=
tmp1
.
length
-
1
;
...
@@ -160,10 +160,10 @@ public class Lexer
...
@@ -160,10 +160,10 @@ public class Lexer
if
(
dfaState
>=
0
)
if
(
dfaState
>=
0
)
{
{
if
(
accept
[
dfaState
]
!=
-
1
)
if
(
accept
Sub
[
dfaState
]
!=
-
1
)
{
{
acceptState
=
dfaState
;
acceptState
=
dfaState
;
acceptToken
=
accept
[
dfaState
];
acceptToken
=
accept
Sub
[
dfaState
];
acceptLength
=
this
.
text
.
length
();
acceptLength
=
this
.
text
.
length
();
acceptPos
=
this
.
pos
;
acceptPos
=
this
.
pos
;
acceptLine
=
this
.
line
;
acceptLine
=
this
.
line
;
...
@@ -178,7 +178,7 @@ public class Lexer
...
@@ -178,7 +178,7 @@ public class Lexer
{
{
case
0
:
case
0
:
{
{
Token
tok
en
=
new
TPkgId
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TPkgId
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
...
@@ -187,11 +187,11 @@ public class Lexer
...
@@ -187,11 +187,11 @@ public class Lexer
{
{
case
1
:
state
=
State
.
PACKAGE
;
break
;
case
1
:
state
=
State
.
PACKAGE
;
break
;
}
}
return
tok
en
;
return
tok
;
}
}
case
1
:
case
1
:
{
{
Token
tok
en
=
new
TPackage
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TPackage
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
...
@@ -200,137 +200,137 @@ public class Lexer
...
@@ -200,137 +200,137 @@ public class Lexer
{
{
case
0
:
state
=
State
.
PACKAGE
;
break
;
case
0
:
state
=
State
.
PACKAGE
;
break
;
}
}
return
tok
en
;
return
tok
;
}
}
case
2
:
case
2
:
{
{
Token
tok
en
=
new
TStates
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TStates
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
3
:
case
3
:
{
{
Token
tok
en
=
new
THelpers
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
THelpers
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
4
:
case
4
:
{
{
Token
tok
en
=
new
TTokens
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TTokens
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
5
:
case
5
:
{
{
Token
tok
en
=
new
TIgnored
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TIgnored
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
6
:
case
6
:
{
{
Token
tok
en
=
new
TProductions
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TProductions
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
7
:
case
7
:
{
{
Token
tok
en
=
new
TAbstract
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TAbstract
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
8
:
case
8
:
{
{
Token
tok
en
=
new
TSyntax
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TSyntax
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
9
:
case
9
:
{
{
Token
tok
en
=
new
TTree
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TTree
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
10
:
case
10
:
{
{
Token
tok
en
=
new
TNew
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TNew
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
11
:
case
11
:
{
{
Token
tok
en
=
new
TNull
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TNull
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
12
:
case
12
:
{
{
Token
tok
en
=
new
TTokenSpecifier
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TTokenSpecifier
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
13
:
case
13
:
{
{
Token
tok
en
=
new
TProductionSpecifier
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TProductionSpecifier
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
14
:
case
14
:
{
{
Token
tok
en
=
new
TDot
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TDot
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
15
:
case
15
:
{
{
Token
tok
en
=
new
TDDot
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TDDot
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
16
:
case
16
:
{
{
Token
tok
en
=
new
TSemicolon
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TSemicolon
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
...
@@ -340,214 +340,214 @@ public class Lexer
...
@@ -340,214 +340,214 @@ public class Lexer
case
0
:
state
=
State
.
NORMAL
;
break
;
case
0
:
state
=
State
.
NORMAL
;
break
;
case
1
:
state
=
State
.
NORMAL
;
break
;
case
1
:
state
=
State
.
NORMAL
;
break
;
}
}
return
tok
en
;
return
tok
;
}
}
case
17
:
case
17
:
{
{
Token
tok
en
=
new
TEqual
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TEqual
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
18
:
case
18
:
{
{
Token
tok
en
=
new
TLBkt
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TLBkt
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
19
:
case
19
:
{
{
Token
tok
en
=
new
TRBkt
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TRBkt
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
20
:
case
20
:
{
{
Token
tok
en
=
new
TLPar
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TLPar
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
21
:
case
21
:
{
{
Token
tok
en
=
new
TRPar
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TRPar
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
22
:
case
22
:
{
{
Token
tok
en
=
new
TLBrace
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TLBrace
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
23
:
case
23
:
{
{
Token
tok
en
=
new
TRBrace
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TRBrace
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
24
:
case
24
:
{
{
Token
tok
en
=
new
TPlus
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TPlus
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
25
:
case
25
:
{
{
Token
tok
en
=
new
TMinus
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TMinus
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
26
:
case
26
:
{
{
Token
tok
en
=
new
TQMark
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TQMark
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
27
:
case
27
:
{
{
Token
tok
en
=
new
TStar
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TStar
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
28
:
case
28
:
{
{
Token
tok
en
=
new
TBar
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TBar
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
29
:
case
29
:
{
{
Token
tok
en
=
new
TComma
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TComma
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
30
:
case
30
:
{
{
Token
tok
en
=
new
TSlash
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TSlash
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
31
:
case
31
:
{
{
Token
tok
en
=
new
TArrow
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TArrow
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
32
:
case
32
:
{
{
Token
tok
en
=
new
TColon
(
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TColon
(
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
33
:
case
33
:
{
{
Token
tok
en
=
new
TId
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TId
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
34
:
case
34
:
{
{
Token
tok
en
=
new
TChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
35
:
case
35
:
{
{
Token
tok
en
=
new
TDecChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TDecChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
36
:
case
36
:
{
{
Token
tok
en
=
new
THexChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
THexChar
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
37
:
case
37
:
{
{
Token
tok
en
=
new
TString
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TString
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
38
:
case
38
:
{
{
Token
tok
en
=
new
TBlank
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TBlank
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
case
39
:
case
39
:
{
{
Token
tok
en
=
new
TComment
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
Token
tok
=
new
TComment
(
getText
(
acceptLength
),
startLine
+
1
,
startPos
+
1
);
pushBack
(
acceptLength
);
pushBack
(
acceptLength
);
this
.
pos
=
acceptPos
;
this
.
pos
=
acceptPos
;
this
.
line
=
acceptLine
;
this
.
line
=
acceptLine
;
this
.
cr
=
acceptCr
;
this
.
cr
=
acceptCr
;
return
tok
en
;
return
tok
;
}
}
}
}
}
}
...
@@ -596,13 +596,13 @@ public class Lexer
...
@@ -596,13 +596,13 @@ public class Lexer
* @deprecated This method doesn't restore line/column info correctly in some cases
* @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair).
* (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement.
* There is no planned replacement.
* @param tok
en
the token to push back onto the input
* @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/
*/
@Deprecated
@Deprecated
protected
void
unread
(
Token
tok
en
)
throws
IOException
protected
void
unread
(
Token
tok
)
throws
IOException
{
{
String
text
=
tok
en
.
getText
();
String
text
=
tok
.
getText
();
int
length
=
text
.
length
();
int
length
=
text
.
length
();
for
(
int
i
=
length
-
1
;
i
>=
0
;
i
--)
for
(
int
i
=
length
-
1
;
i
>=
0
;
i
--)
...
@@ -612,8 +612,8 @@ public class Lexer
...
@@ -612,8 +612,8 @@ public class Lexer
this
.
in
.
unread
(
text
.
charAt
(
i
));
this
.
in
.
unread
(
text
.
charAt
(
i
));
}
}
this
.
pos
=
tok
en
.
getPos
()
-
1
;
this
.
pos
=
tok
.
getPos
()
-
1
;
this
.
line
=
tok
en
.
getLine
()
-
1
;
this
.
line
=
tok
.
getLine
()
-
1
;
}
}
private
String
getText
(
int
acceptLength
)
private
String
getText
(
int
acceptLength
)
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/org/sablecc/sablecc/lexer.txt
+
13
−
13
View file @
3b8fe35f
...
@@ -92,8 +92,8 @@ public class Lexer
...
@@ -92,8 +92,8 @@ public class Lexer
int acceptLine = -1;
int acceptLine = -1;
boolean acceptCr = false;
boolean acceptCr = false;
int[][][] gotoTable = Lexer.gotoTable[this.state.ordinal()];
int[][][] gotoTable
Sub
= Lexer.gotoTable[this.state.ordinal()];
int[] accept = Lexer.accept[this.state.ordinal()];
int[] accept
Sub
= Lexer.accept[this.state.ordinal()];
this.text.setLength(0);
this.text.setLength(0);
while(true)
while(true)
...
@@ -150,7 +150,7 @@ public class Lexer
...
@@ -150,7 +150,7 @@ public class Lexer
dfaState = -1;
dfaState = -1;
int[][] tmp1 =
gotoTable[oldState];
int[][] tmp1 = gotoTable
Sub
[oldState];
int low = 0;
int low = 0;
int high = tmp1.length - 1;
int high = tmp1.length - 1;
...
@@ -184,10 +184,10 @@ public class Lexer
...
@@ -184,10 +184,10 @@ public class Lexer
if(dfaState >= 0)
if(dfaState >= 0)
{
{
if(accept[dfaState] != -1)
if(accept
Sub
[dfaState] != -1)
{
{
acceptState = dfaState;
acceptState = dfaState;
acceptToken = accept[dfaState];
acceptToken = accept
Sub
[dfaState];
acceptLength = this.text.length();
acceptLength = this.text.length();
acceptPos = this.pos;
acceptPos = this.pos;
acceptLine = this.line;
acceptLine = this.line;
...
@@ -206,7 +206,7 @@ $
...
@@ -206,7 +206,7 @@ $
Macro:LexerVariableToken
Macro:LexerVariableToken
case $0$:
case $0$:
{
{
Token tok
en
= new $1$(getText(acceptLength), startLine + 1, startPos + 1);
Token tok = new $1$(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength);
pushBack(acceptLength);
this.pos = acceptPos;
this.pos = acceptPos;
this.line = acceptLine;
this.line = acceptLine;
...
@@ -217,7 +217,7 @@ $
...
@@ -217,7 +217,7 @@ $
Macro:LexerFixedToken
Macro:LexerFixedToken
case $0$:
case $0$:
{
{
Token tok
en
= new $1$(startLine + 1, startPos + 1);
Token tok = new $1$(startLine + 1, startPos + 1);
pushBack(acceptLength);
pushBack(acceptLength);
this.pos = acceptPos;
this.pos = acceptPos;
this.line = acceptLine;
this.line = acceptLine;
...
@@ -242,7 +242,7 @@ Macro:TokenSwitchTail
...
@@ -242,7 +242,7 @@ Macro:TokenSwitchTail
$
$
Macro:LexerTokenTail
Macro:LexerTokenTail
return tok
en
;
return tok;
}
}
$
$
...
@@ -295,13 +295,13 @@ Macro:LexerBody
...
@@ -295,13 +295,13 @@ Macro:LexerBody
* @deprecated This method doesn't restore line/column info correctly in some cases
* @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair).
* (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement.
* There is no planned replacement.
* @param tok
en
the token to push back onto the input
* @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/
*/
@Deprecated
@Deprecated
protected void unread(Token tok
en
) throws IOException
protected void unread(Token tok) throws IOException
{
{
String text = tok
en
.getText();
String text = tok.getText();
int length = text.length();
int length = text.length();
for(int i = length - 1; i >= 0; i--)
for(int i = length - 1; i >= 0; i--)
...
@@ -311,8 +311,8 @@ Macro:LexerBody
...
@@ -311,8 +311,8 @@ Macro:LexerBody
this.in.unread(text.charAt(i));
this.in.unread(text.charAt(i));
}
}
this.pos = tok
en
.getPos() - 1;
this.pos = tok.getPos() - 1;
this.line = tok
en
.getLine() - 1;
this.line = tok.getLine() - 1;
}
}
private String getText(int acceptLength)
private String getText(int acceptLength)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment