Skip to content

Commit

Permalink
Revert "Updated syntax specification and parser in preparation for th…
Browse files Browse the repository at this point in the history
…e addition of pointers"

This reverts commit a46e39c.
  • Loading branch information
tomdodd4598 committed Apr 15, 2021
1 parent a46e39c commit baa80b5
Show file tree
Hide file tree
Showing 11 changed files with 292 additions and 305 deletions.
12 changes: 6 additions & 6 deletions src/drl.sable
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ Productions
const name equals expression semicolon;

variable_declaration =
{no_initialisation} var non_address_variable semicolon |
{with_initialisation} var non_address_variable equals expression semicolon;
{no_initialisation} var name semicolon |
{with_initialisation} var name equals expression semicolon;

variable_modification =
non_address_variable equals expression semicolon;
name equals expression semicolon;

method_call =
{built_in_out} out l_par expression r_par semicolon |
Expand Down Expand Up @@ -176,7 +176,7 @@ Productions

value =
{integer} integer |
{variable} variable |
{variable} name |
{function} name l_par argument_list? r_par;

variable =
Expand All @@ -195,10 +195,10 @@ Productions
comma expression;

parameter_list =
non_address_variable parameter_list_tail*;
name parameter_list_tail*;

parameter_list_tail =
comma non_address_variable;
comma name;



Expand Down
24 changes: 12 additions & 12 deletions src/drlc/analysis/DepthFirstAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ public void caseANoInitialisationVariableDeclaration(ANoInitialisationVariableDe
{
node.getVar().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getSemicolon() != null)
{
Expand All @@ -456,9 +456,9 @@ public void caseAWithInitialisationVariableDeclaration(AWithInitialisationVariab
{
node.getVar().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getEquals() != null)
{
Expand Down Expand Up @@ -489,9 +489,9 @@ public void outAVariableModification(AVariableModification node)
public void caseAVariableModification(AVariableModification node)
{
inAVariableModification(node);
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getEquals() != null)
{
Expand Down Expand Up @@ -1249,9 +1249,9 @@ public void outAVariableValue(AVariableValue node)
public void caseAVariableValue(AVariableValue node)
{
inAVariableValue(node);
if(node.getVariable() != null)
if(node.getName() != null)
{
node.getVariable().apply(this);
node.getName().apply(this);
}
outAVariableValue(node);
}
Expand Down Expand Up @@ -1473,9 +1473,9 @@ public void outAParameterList(AParameterList node)
public void caseAParameterList(AParameterList node)
{
inAParameterList(node);
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
{
List<PParameterListTail> copy = new ArrayList<PParameterListTail>(node.getParameterListTail());
Expand Down Expand Up @@ -1505,9 +1505,9 @@ public void caseAParameterListTail(AParameterListTail node)
{
node.getComma().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
outAParameterListTail(node);
}
Expand Down
24 changes: 12 additions & 12 deletions src/drlc/analysis/ReversedDepthFirstAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,9 @@ public void caseANoInitialisationVariableDeclaration(ANoInitialisationVariableDe
{
node.getSemicolon().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getVar() != null)
{
Expand Down Expand Up @@ -468,9 +468,9 @@ public void caseAWithInitialisationVariableDeclaration(AWithInitialisationVariab
{
node.getEquals().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getVar() != null)
{
Expand Down Expand Up @@ -505,9 +505,9 @@ public void caseAVariableModification(AVariableModification node)
{
node.getEquals().apply(this);
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
outAVariableModification(node);
}
Expand Down Expand Up @@ -1261,9 +1261,9 @@ public void outAVariableValue(AVariableValue node)
public void caseAVariableValue(AVariableValue node)
{
inAVariableValue(node);
if(node.getVariable() != null)
if(node.getName() != null)
{
node.getVariable().apply(this);
node.getName().apply(this);
}
outAVariableValue(node);
}
Expand Down Expand Up @@ -1494,9 +1494,9 @@ public void caseAParameterList(AParameterList node)
e.apply(this);
}
}
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
outAParameterList(node);
}
Expand All @@ -1515,9 +1515,9 @@ public void outAParameterListTail(AParameterListTail node)
public void caseAParameterListTail(AParameterListTail node)
{
inAParameterListTail(node);
if(node.getNonAddressVariable() != null)
if(node.getName() != null)
{
node.getNonAddressVariable().apply(this);
node.getName().apply(this);
}
if(node.getComma() != null)
{
Expand Down
30 changes: 15 additions & 15 deletions src/drlc/node/ANoInitialisationVariableDeclaration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public final class ANoInitialisationVariableDeclaration extends PVariableDeclaration
{
private TVar _var_;
private PNonAddressVariable _nonAddressVariable_;
private TName _name_;
private TSemicolon _semicolon_;

public ANoInitialisationVariableDeclaration()
Expand All @@ -18,13 +18,13 @@ public ANoInitialisationVariableDeclaration()

public ANoInitialisationVariableDeclaration(
@SuppressWarnings("hiding") TVar _var_,
@SuppressWarnings("hiding") PNonAddressVariable _nonAddressVariable_,
@SuppressWarnings("hiding") TName _name_,
@SuppressWarnings("hiding") TSemicolon _semicolon_)
{
// Constructor
setVar(_var_);

setNonAddressVariable(_nonAddressVariable_);
setName(_name_);

setSemicolon(_semicolon_);

Expand All @@ -35,7 +35,7 @@ public Object clone()
{
return new ANoInitialisationVariableDeclaration(
cloneNode(this._var_),
cloneNode(this._nonAddressVariable_),
cloneNode(this._name_),
cloneNode(this._semicolon_));
}

Expand Down Expand Up @@ -70,16 +70,16 @@ public void setVar(TVar node)
this._var_ = node;
}

public PNonAddressVariable getNonAddressVariable()
public TName getName()
{
return this._nonAddressVariable_;
return this._name_;
}

public void setNonAddressVariable(PNonAddressVariable node)
public void setName(TName node)
{
if(this._nonAddressVariable_ != null)
if(this._name_ != null)
{
this._nonAddressVariable_.parent(null);
this._name_.parent(null);
}

if(node != null)
Expand All @@ -92,7 +92,7 @@ public void setNonAddressVariable(PNonAddressVariable node)
node.parent(this);
}

this._nonAddressVariable_ = node;
this._name_ = node;
}

public TSemicolon getSemicolon()
Expand Down Expand Up @@ -125,7 +125,7 @@ public String toString()
{
return ""
+ toString(this._var_)
+ toString(this._nonAddressVariable_)
+ toString(this._name_)
+ toString(this._semicolon_);
}

Expand All @@ -139,9 +139,9 @@ void removeChild(@SuppressWarnings("unused") Node child)
return;
}

if(this._nonAddressVariable_ == child)
if(this._name_ == child)
{
this._nonAddressVariable_ = null;
this._name_ = null;
return;
}

Expand All @@ -164,9 +164,9 @@ void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("
return;
}

if(this._nonAddressVariable_ == oldChild)
if(this._name_ == oldChild)
{
setNonAddressVariable((PNonAddressVariable) newChild);
setName((TName) newChild);
return;
}

Expand Down
30 changes: 15 additions & 15 deletions src/drlc/node/AParameterList.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@SuppressWarnings("nls")
public final class AParameterList extends PParameterList
{
private PNonAddressVariable _nonAddressVariable_;
private TName _name_;
private final LinkedList<PParameterListTail> _parameterListTail_ = new LinkedList<PParameterListTail>();

public AParameterList()
Expand All @@ -17,11 +17,11 @@ public AParameterList()
}

public AParameterList(
@SuppressWarnings("hiding") PNonAddressVariable _nonAddressVariable_,
@SuppressWarnings("hiding") TName _name_,
@SuppressWarnings("hiding") List<?> _parameterListTail_)
{
// Constructor
setNonAddressVariable(_nonAddressVariable_);
setName(_name_);

setParameterListTail(_parameterListTail_);

Expand All @@ -31,7 +31,7 @@ public AParameterList(
public Object clone()
{
return new AParameterList(
cloneNode(this._nonAddressVariable_),
cloneNode(this._name_),
cloneList(this._parameterListTail_));
}

Expand All @@ -41,16 +41,16 @@ public void apply(Switch sw)
((Analysis) sw).caseAParameterList(this);
}

public PNonAddressVariable getNonAddressVariable()
public TName getName()
{
return this._nonAddressVariable_;
return this._name_;
}

public void setNonAddressVariable(PNonAddressVariable node)
public void setName(TName node)
{
if(this._nonAddressVariable_ != null)
if(this._name_ != null)
{
this._nonAddressVariable_.parent(null);
this._name_.parent(null);
}

if(node != null)
Expand All @@ -63,7 +63,7 @@ public void setNonAddressVariable(PNonAddressVariable node)
node.parent(this);
}

this._nonAddressVariable_ = node;
this._name_ = node;
}

public LinkedList<PParameterListTail> getParameterListTail()
Expand Down Expand Up @@ -96,17 +96,17 @@ public void setParameterListTail(List<?> list)
public String toString()
{
return ""
+ toString(this._nonAddressVariable_)
+ toString(this._name_)
+ toString(this._parameterListTail_);
}

@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._nonAddressVariable_ == child)
if(this._name_ == child)
{
this._nonAddressVariable_ = null;
this._name_ = null;
return;
}

Expand All @@ -122,9 +122,9 @@ void removeChild(@SuppressWarnings("unused") Node child)
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._nonAddressVariable_ == oldChild)
if(this._name_ == oldChild)
{
setNonAddressVariable((PNonAddressVariable) newChild);
setName((TName) newChild);
return;
}

Expand Down
Loading

0 comments on commit baa80b5

Please sign in to comment.