-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: Use Java Language Specification CFG
- Loading branch information
Showing
64 changed files
with
3,532 additions
and
741 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ws.codewash.java; | ||
|
||
import java.util.List; | ||
|
||
public class CWBlock extends Scope { | ||
private List<CWStatement> mStatements; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,52 @@ | ||
package ws.codewash.java; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class CWConstructor { | ||
public class CWConstructor extends Scope implements CWConstructorOrMethod, CWParameterizable, Modifiable { | ||
private final CWClassOrInterface mParent; | ||
private final List<CWVariable> mParameters; | ||
|
||
public CWConstructor(CWClassOrInterface parent, List<CWVariable> parameters) { | ||
private final int mModifiers; | ||
|
||
private final List<CWTypeParameter> mTypeParameters = new ArrayList<>(); | ||
private final List<CWVariable> mParameters = new ArrayList<>(); | ||
|
||
public CWConstructor(CWClassOrInterface parent, int modifiers) { | ||
mParent = parent; | ||
mParameters = parameters; | ||
mModifiers = modifiers; | ||
} | ||
|
||
public void addTypeParameter(CWTypeParameter typeParameter) { | ||
mTypeParameters.add(typeParameter); | ||
addTypeDeclaration(typeParameter.getVariableName(), typeParameter); | ||
} | ||
|
||
public void addParameter(CWVariable parameter) { | ||
mParameters.add(parameter); | ||
addLocalVariableDeclaration(parameter.getName(), parameter); | ||
} | ||
|
||
private CWClassOrInterface getParent() { | ||
return mParent; | ||
} | ||
|
||
private List<CWTypeParameter> getTypeParameters() { | ||
return mTypeParameters; | ||
} | ||
|
||
private List<CWVariable> getParameters() { | ||
return mParameters; | ||
} | ||
|
||
@Override | ||
public int getModifiers() { | ||
return mModifiers; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getModifiersForToString() + mParent.getSimpleName() + | ||
"(" + mParameters.stream().map(CWVariable::toString).collect(Collectors.joining(", ")) + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package ws.codewash.java; | ||
|
||
public interface CWConstructorOrMethod { | ||
void addParameter(CWVariable parameter); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ws.codewash.java; | ||
|
||
public abstract class CWControlStatement extends CWStatement { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ws.codewash.java; | ||
|
||
public class CWExpression extends CWStatement { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
package ws.codewash.java; | ||
|
||
public class CWField extends CWMember { | ||
private CWType mType; | ||
public class CWField extends CWVariable implements CWMember, Modifiable { | ||
private CWClassOrInterface mParent; | ||
|
||
public CWField(TypeResolver resolver, CWClass parent, int modifiers, String name, String type) { | ||
super(resolver, parent, modifiers, name); | ||
public CWField(CWClassOrInterface parent, int modifiers, String type, String name) { | ||
super(parent, modifiers, type, name); | ||
|
||
resolver.resolve(new PendingType<>(type, this::setType)); | ||
mParent = parent; | ||
} | ||
|
||
public CWType getType() { | ||
return mType; | ||
} | ||
|
||
private void setType(CWType type) { | ||
mType = type; | ||
@Override | ||
public CWClassOrInterface getParent() { | ||
return mParent; | ||
} | ||
} |
Oops, something went wrong.