Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Jastadd2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
Jastadd2
Commits
1a3b0a92
Commit
1a3b0a92
authored
4 years ago
by
Jesper
Browse files
Options
Downloads
Patches
Plain Diff
[cleanup] Rename pushTopLevelOrAspect
parent
3fe23df9
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/java/org/jastadd/JastAdd.java
+2
-2
2 additions, 2 deletions
src/java/org/jastadd/JastAdd.java
src/javacc/jrag/Jrag.jjt
+28
-26
28 additions, 26 deletions
src/javacc/jrag/Jrag.jjt
with
30 additions
and
28 deletions
src/java/org/jastadd/JastAdd.java
+
2
−
2
View file @
1a3b0a92
...
@@ -570,7 +570,7 @@ public class JastAdd {
...
@@ -570,7 +570,7 @@ public class JastAdd {
jp
.
root
=
grammar
;
jp
.
root
=
grammar
;
jp
.
setFileName
(
sourceName
);
jp
.
setFileName
(
sourceName
);
jp
.
className
=
sourceName
;
jp
.
className
=
sourceName
;
jp
.
push
TopLevelOrAspec
t
(
"aspect"
);
jp
.
push
Contex
t
(
"aspect"
);
try
{
try
{
jp
.
AspectBodyDeclarationsEOF
();
jp
.
AspectBodyDeclarationsEOF
();
problems
.
addAll
(
JastAdd
.
weaveInterTypeObjects
(
grammar
));
problems
.
addAll
(
JastAdd
.
weaveInterTypeObjects
(
grammar
));
...
@@ -579,7 +579,7 @@ public class JastAdd {
...
@@ -579,7 +579,7 @@ public class JastAdd {
.
message
(
"Internal Error in %s: %s"
,
sourceName
,
e
.
getMessage
())
.
message
(
"Internal Error in %s: %s"
,
sourceName
,
e
.
getMessage
())
.
buildError
());
.
buildError
());
}
}
jp
.
pop
TopLevelOrAspec
t
();
jp
.
pop
Contex
t
();
return
problems
;
return
problems
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/javacc/jrag/Jrag.jjt
+
28
−
26
View file @
1a3b0a92
/* Copyright (c) 2006, Sun Microsystems, Inc.
/* Copyright (c) 2006, Sun Microsystems, Inc.
* 2006-201
8
, The JastAdd Team
* 2006-20
2
1, The JastAdd Team
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
...
@@ -59,6 +59,8 @@ public class JragParser {
...
@@ -59,6 +59,8 @@ public class JragParser {
public String enclosingAspect = ""; // The name of the aspect currently being parsed.
public String enclosingAspect = ""; // The name of the aspect currently being parsed.
public String fileName; // Name of parsed file.
public String fileName; // Name of parsed file.
// TODO(joqvist): the mechanisms for adding class body decl to the enclosing class is very ugly
// and needs to be cleaned up. Either use the context everywhere or remove it?
private java.util.List<String> contextStack = new java.util.ArrayList<String>();
private java.util.List<String> contextStack = new java.util.ArrayList<String>();
public boolean inTopLevelOrAspect() {
public boolean inTopLevelOrAspect() {
...
@@ -74,11 +76,11 @@ public class JragParser {
...
@@ -74,11 +76,11 @@ public class JragParser {
contextStack.get(0).equals("interface"));
contextStack.get(0).equals("interface"));
}
}
public void push
TopLevelOrAspec
t(String context) {
public void push
Contex
t(String context) {
contextStack.add(context);
contextStack.add(context);
}
}
public void pop
TopLevelOrAspec
t() {
public void pop
Contex
t() {
contextStack.remove(contextStack.size()-1);
contextStack.remove(contextStack.size()-1);
}
}
...
@@ -593,13 +595,13 @@ void TypeDeclaration() :
...
@@ -593,13 +595,13 @@ void TypeDeclaration() :
void AspectDeclaration(String modifiers) :
void AspectDeclaration(String modifiers) :
{ Token t; }
{ Token t; }
{
{
"aspect" { push
TopLevelOrAspec
t("aspect"); }
"aspect" { push
Contex
t("aspect"); }
t = <IDENTIFIER> {
t = <IDENTIFIER> {
enclosingAspect = t.image;
enclosingAspect = t.image;
root.registerAspect(enclosingAspect, Unparser.unparseComment(jjtThis));
root.registerAspect(enclosingAspect, Unparser.unparseComment(jjtThis));
}
}
AspectBody()
AspectBody()
{ pop
TopLevelOrAspec
t(); enclosingAspect = ""; }
{ pop
Contex
t(); enclosingAspect = ""; }
}
}
void AspectBody() :
void AspectBody() :
...
@@ -697,7 +699,7 @@ void AspectClassDeclaration() :
...
@@ -697,7 +699,7 @@ void AspectClassDeclaration() :
modifiers = Modifiers()
modifiers = Modifiers()
first = "class"
first = "class"
t = <IDENTIFIER> {
t = <IDENTIFIER> {
push
TopLevelOrAspec
t("class");
push
Contex
t("class");
outerClassName = className;
outerClassName = className;
className = t.image;
className = t.image;
typeDecl = root.findClassDecl(className, Unparser.unparseComment(jjtThis),
typeDecl = root.findClassDecl(className, Unparser.unparseComment(jjtThis),
...
@@ -714,7 +716,7 @@ void AspectClassDeclaration() :
...
@@ -714,7 +716,7 @@ void AspectClassDeclaration() :
}
}
]
]
[ "implements" nameList = TypeNameList() { root.addInterface(nameList, className, fileName); } ]
[ "implements" nameList = TypeNameList() { root.addInterface(nameList, className, fileName); } ]
AspectClassBody() { className = outerClassName; pop
TopLevelOrAspec
t(); }
AspectClassBody() { className = outerClassName; pop
Contex
t(); }
}
}
void AspectClassBody() :
void AspectClassBody() :
...
@@ -739,7 +741,7 @@ void AspectInterfaceDeclaration() :
...
@@ -739,7 +741,7 @@ void AspectInterfaceDeclaration() :
modifiers = Modifiers()
modifiers = Modifiers()
first = "interface"
first = "interface"
t = <IDENTIFIER> {
t = <IDENTIFIER> {
push
TopLevelOrAspec
t("interface");
push
Contex
t("interface");
outerClassName = className;
outerClassName = className;
className = t.image;
className = t.image;
typeDecl = root.findInterfaceDecl(className, Unparser.unparseComment(jjtThis),
typeDecl = root.findInterfaceDecl(className, Unparser.unparseComment(jjtThis),
...
@@ -748,7 +750,7 @@ void AspectInterfaceDeclaration() :
...
@@ -748,7 +750,7 @@ void AspectInterfaceDeclaration() :
}
}
[ typeParameters = TypeParameters() { typeDecl.typeParameters = typeParameters; } ]
[ typeParameters = TypeParameters() { typeDecl.typeParameters = typeParameters; } ]
[ "extends" nameList = TypeNameList() { root.addInterface(nameList, className, fileName); } ]
[ "extends" nameList = TypeNameList() { root.addInterface(nameList, className, fileName); } ]
"{" ( AspectInterfaceMemberDeclaration() )* "}" { className = outerClassName; pop
TopLevelOrAspec
t(); }
"{" ( AspectInterfaceMemberDeclaration() )* "}" { className = outerClassName; pop
Contex
t(); }
}
}
void AspectInterfaceMemberDeclaration() :
void AspectInterfaceMemberDeclaration() :
...
@@ -894,14 +896,14 @@ void AspectNestedInterfaceDeclaration() :
...
@@ -894,14 +896,14 @@ void AspectNestedInterfaceDeclaration() :
}
}
{
{
modifiers = Modifiers()
modifiers = Modifiers()
"interface" { push
TopLevelOrAspec
t("interface"); } <IDENTIFIER>
"interface" { push
Contex
t("interface"); } <IDENTIFIER>
[ TypeParameters() ]
[ TypeParameters() ]
[ "extends" TypeNameList() ]
[ "extends" TypeNameList() ]
"{" ( InterfaceMemberDeclaration() )* "}"
"{" ( InterfaceMemberDeclaration() )* "}"
{
{
className = outerClassName;
className = outerClassName;
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
pop
TopLevelOrAspec
t();
pop
Contex
t();
}
}
}
}
...
@@ -914,7 +916,7 @@ void AspectNestedClassDeclaration() :
...
@@ -914,7 +916,7 @@ void AspectNestedClassDeclaration() :
}
}
{
{
modifiers = Modifiers()
modifiers = Modifiers()
"class" { push
TopLevelOrAspec
t("class"); } <IDENTIFIER>
"class" { push
Contex
t("class"); } <IDENTIFIER>
[ TypeParameters() ]
[ TypeParameters() ]
[ "extends" ClassOrInterfaceType() ]
[ "extends" ClassOrInterfaceType() ]
[ "implements" TypeNameList() ]
[ "implements" TypeNameList() ]
...
@@ -922,7 +924,7 @@ void AspectNestedClassDeclaration() :
...
@@ -922,7 +924,7 @@ void AspectNestedClassDeclaration() :
{
{
className = outerClassName;
className = outerClassName;
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
pop
TopLevelOrAspec
t();
pop
Contex
t();
}
}
}
}
...
@@ -1468,7 +1470,7 @@ void ClassDeclaration(String modifiers) :
...
@@ -1468,7 +1470,7 @@ void ClassDeclaration(String modifiers) :
{
{
first = "class"
first = "class"
t = <IDENTIFIER> {
t = <IDENTIFIER> {
push
TopLevelOrAspec
t("class");
push
Contex
t("class");
outerClassName = className;
outerClassName = className;
className = t.image;
className = t.image;
typeDecl = root.findClassDecl(className, Unparser.unparseComment(jjtThis),
typeDecl = root.findClassDecl(className, Unparser.unparseComment(jjtThis),
...
@@ -1483,7 +1485,7 @@ void ClassDeclaration(String modifiers) :
...
@@ -1483,7 +1485,7 @@ void ClassDeclaration(String modifiers) :
}
}
]
]
[ "implements" nameList = TypeNameList() { root.addInterface(nameList, className, fileName);} ]
[ "implements" nameList = TypeNameList() { root.addInterface(nameList, className, fileName);} ]
ClassBody() { className = outerClassName; pop
TopLevelOrAspec
t(); }
ClassBody() { className = outerClassName; pop
Contex
t(); }
}
}
SimpleNode TypeNameList():
SimpleNode TypeNameList():
...
@@ -1505,10 +1507,10 @@ void UnmodifiedClassDeclaration(String modifiers) :
...
@@ -1505,10 +1507,10 @@ void UnmodifiedClassDeclaration(String modifiers) :
String outerClassName;
String outerClassName;
}
}
{
{
"class" t = <IDENTIFIER> { push
TopLevelOrAspec
t("class"); outerClassName = className; className = t.image; }
"class" t = <IDENTIFIER> { push
Contex
t("class"); outerClassName = className; className = t.image; }
[ TypeParameters() ]
[ TypeParameters() ]
[ "extends" ClassOrInterfaceType() ] [ "implements" nameList = TypeNameList() ]
[ "extends" ClassOrInterfaceType() ] [ "implements" nameList = TypeNameList() ]
ClassBody() { className = outerClassName; pop
TopLevelOrAspec
t(); }
ClassBody() { className = outerClassName; pop
Contex
t(); }
{ if (shouldAddClassBodyDecl()) {
{ if (shouldAddClassBodyDecl()) {
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
}
}
...
@@ -1529,7 +1531,7 @@ void AspectEnumDeclaration():
...
@@ -1529,7 +1531,7 @@ void AspectEnumDeclaration():
modifiers = Modifiers()
modifiers = Modifiers()
first = "enum"
first = "enum"
t = <IDENTIFIER> {
t = <IDENTIFIER> {
push
TopLevelOrAspec
t("enum");
push
Contex
t("enum");
outerClassName = className;
outerClassName = className;
className = t.image;
className = t.image;
typeDecl = (org.jastadd.ast.AST.EnumDecl) root.findEnumDecl(className, Unparser.unparseComment(jjtThis),
typeDecl = (org.jastadd.ast.AST.EnumDecl) root.findEnumDecl(className, Unparser.unparseComment(jjtThis),
...
@@ -1538,16 +1540,16 @@ void AspectEnumDeclaration():
...
@@ -1538,16 +1540,16 @@ void AspectEnumDeclaration():
typeDecl.simpleNode = jjtThis;
typeDecl.simpleNode = jjtThis;
}
}
[ "implements" TypeNameList() ]
[ "implements" TypeNameList() ]
EnumBody() { className = outerClassName; pop
TopLevelOrAspec
t(); }
EnumBody() { className = outerClassName; pop
Contex
t(); }
}
}
void UnmodifiedEnumDeclaration(String modifiers):
void UnmodifiedEnumDeclaration(String modifiers):
{}
{}
{
{
"enum" { push
TopLevelOrAspec
t("enum"); } JavaIdentifier()
"enum" { push
Contex
t("enum"); } JavaIdentifier()
[ "implements" TypeNameList() ]
[ "implements" TypeNameList() ]
EnumBody()
EnumBody()
{ pop
TopLevelOrAspec
t();
{ pop
Contex
t();
if (shouldAddClassBodyDecl()) {
if (shouldAddClassBodyDecl()) {
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
}
}
...
@@ -1658,7 +1660,7 @@ void UnmodifiedInterfaceDeclaration(String modifiers) :
...
@@ -1658,7 +1660,7 @@ void UnmodifiedInterfaceDeclaration(String modifiers) :
first = "interface"
first = "interface"
t = <IDENTIFIER> {
t = <IDENTIFIER> {
isTopLevel = inTopLevelOrAspect();
isTopLevel = inTopLevelOrAspect();
push
TopLevelOrAspec
t("interface");
push
Contex
t("interface");
outerClassName = className;
outerClassName = className;
className = t.image;
className = t.image;
if (isTopLevel) {
if (isTopLevel) {
...
@@ -1669,7 +1671,7 @@ void UnmodifiedInterfaceDeclaration(String modifiers) :
...
@@ -1669,7 +1671,7 @@ void UnmodifiedInterfaceDeclaration(String modifiers) :
}
}
[ typeParameters = TypeParameters() { if (isTopLevel) typeDecl.typeParameters = typeParameters; } ]
[ typeParameters = TypeParameters() { if (isTopLevel) typeDecl.typeParameters = typeParameters; } ]
[ "extends" nameList = TypeNameList() { if (isTopLevel) root.addInterface(nameList, className, fileName); } ]
[ "extends" nameList = TypeNameList() { if (isTopLevel) root.addInterface(nameList, className, fileName); } ]
"{" ( InterfaceMemberDeclaration() )* "}" { className = outerClassName; pop
TopLevelOrAspec
t(); }
"{" ( InterfaceMemberDeclaration() )* "}" { className = outerClassName; pop
Contex
t(); }
{ if (shouldAddClassBodyDecl()) {
{ if (shouldAddClassBodyDecl()) {
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
}
}
...
@@ -2224,7 +2226,7 @@ void ArgumentList() :
...
@@ -2224,7 +2226,7 @@ void ArgumentList() :
void AllocationExpression() :
void AllocationExpression() :
{ String outerClassName = className;
{ String outerClassName = className;
className = "D$u$m$m$y";
className = "D$u$m$m$y";
push
TopLevelOrAspec
t("expr");
push
Contex
t("expr");
}
}
{
{
(
(
...
@@ -2242,7 +2244,7 @@ void AllocationExpression() :
...
@@ -2242,7 +2244,7 @@ void AllocationExpression() :
)
)
{
{
className = outerClassName;
className = outerClassName;
pop
TopLevelOrAspec
t();
pop
Contex
t();
}
}
}
}
...
@@ -2611,7 +2613,7 @@ void MemberValueArrayInitializer():
...
@@ -2611,7 +2613,7 @@ void MemberValueArrayInitializer():
void AnnotationTypeDeclaration(String modifiers):
void AnnotationTypeDeclaration(String modifiers):
{}
{}
{
{
"@" "interface" { push
TopLevelOrAspec
t("annotation"); } JavaIdentifier() AnnotationTypeBody() { pop
TopLevelOrAspec
t(); }
"@" "interface" { push
Contex
t("annotation"); } JavaIdentifier() AnnotationTypeBody() { pop
Contex
t(); }
{ if (shouldAddClassBodyDecl()) {
{ if (shouldAddClassBodyDecl()) {
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
root.addClassBodyDecl(jjtThis, className, fileName, modifiers, enclosingAspect);
}
}
...
...
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