Skip to content
Snippets Groups Projects
Commit 63a27095 authored by dgelessus's avatar dgelessus
Browse files

Fix weird line breaks after the words add/get/remove/set everywhere

parent 6d9932ce
Branches
Tags
No related merge requests found
Showing with 69 additions and 125 deletions
......@@ -71,14 +71,12 @@ public class CharSet implements Cloneable
return result;
}
private void remove
(Interval interval)
private void remove(Interval interval)
{
intervals.remove(interval);
}
private void add
(Interval interval)
private void add(Interval interval)
{
for(int i = 0; i < intervals.size(); i++)
{
......
......@@ -41,8 +41,7 @@ public class ComputeInlining
Map<String, AProd> productionsMap,
Start tree)
{
this.setOfProdToBeInline = set
;
this.setOfProdToBeInline = set;
this.productionsMap = productionsMap;
this.tree = tree;
}
......
......@@ -250,12 +250,9 @@ public class DFA
{
System.out.print(".");
IntSet set
= new IntSet();
eclosure(i, set
);
eclosures[i] = set
;
IntSet set = new IntSet();
eclosure(i, set);
eclosures[i] = set;
}
System.out.println();
......
......@@ -90,11 +90,9 @@ public final class Grammar
computeFirst();
LR0ItemSet set
= new LR0ItemSet();
LR0ItemSet set = new LR0ItemSet();
set.set(new LR0Item(startProduction, 0));
LR1Collection collection = new LR1Collection(set
);
LR1Collection collection = new LR1Collection(set);
System.out.println(" - Computing parse table.");
......@@ -418,11 +416,9 @@ public final class Grammar
{
if(!rightside[j].terminal)
{
SymbolSet set
= FIRST(rightside, j + 1);
SymbolSet set = FIRST(rightside, j + 1);
set.clearEmpty();
FOLLOW[rightside[j].index].or(set
);
FOLLOW[rightside[j].index].or(set);
}
}
}
......@@ -523,8 +519,7 @@ public final class Grammar
// private static final SplayTreeMap fastLr0SetClosure = new SplayTreeMap();
static LR0ItemSet CLOSURE(LR0ItemSet set
)
static LR0ItemSet CLOSURE(LR0ItemSet set)
{
LR0ItemSet result =
/*
......@@ -633,8 +628,7 @@ public final class Grammar
// private static final SplayTreeMap fastLr1SetClosure = new SplayTreeMap();
static LR1ItemSet CLOSURE(LR1ItemSet set
)
static LR1ItemSet CLOSURE(LR1ItemSet set)
{
LR1ItemSet result =
/*
......@@ -666,14 +660,10 @@ public final class Grammar
return result;
}
static LR0ItemSet GOTO(LR0ItemSet set
, Symbol symbol)
static LR0ItemSet GOTO(LR0ItemSet set, Symbol symbol)
{
LR0ItemSet initialset = set
;
set
= CLOSURE(set
);
LR0ItemSet initialset = set;
set = CLOSURE(set);
LR0ItemSet result = new LR0ItemSet();
// return all items A->xS.y such that A->x.Sy is in set. (S=symbol)
......
......@@ -15,17 +15,14 @@ public class IntSet
public IntSet()
{}
private IntSet(IntSet set
)
private IntSet(IntSet set)
{
elements = set.elements.clone();
}
public void and(IntSet set
)
public void and(IntSet set)
{
if(set
== this)
if(set == this)
{
return;
}
......@@ -100,8 +97,7 @@ public class IntSet
return false;
}
IntSet set
= (IntSet) obj;
IntSet set = (IntSet) obj;
if(elements.length != set.elements.length)
{
......@@ -119,8 +115,7 @@ public class IntSet
return true;
}
public boolean get
(int bit)
public boolean get(int bit)
{
int low = 0;
int high = elements.length - 1;
......@@ -159,11 +154,9 @@ public class IntSet
return result;
}
public void or(IntSet set
)
public void or(IntSet set)
{
if(set
== this)
if(set == this)
{
return;
}
......@@ -245,11 +238,9 @@ public class IntSet
}
public void set
(int bit)
public void set(int bit)
{
if(!get
(bit))
if(!get(bit))
{
int[] old = elements;
elements = new int[old.length + 1];
......@@ -325,11 +316,9 @@ public class IntSet
return s.toString();
}
public void xor(IntSet set
)
public void xor(IntSet set)
{
if(set
== this)
if(set == this)
{
set = set.clone();
}
......
......@@ -19,14 +19,11 @@ final class LR0Collection
private final List<Map<Symbol, Integer>> GOTO = new ArrayList<>();
final List<String> names = new ArrayList<>();
LR0Collection(LR0ItemSet set
)
LR0Collection(LR0ItemSet set)
{
System.out.println(" - Computing LR(0) items.");
add
(set
, -1, null);
add(set, -1, null);
for(int i = 0; i < sets.size(); i++)
{
......@@ -35,27 +32,21 @@ final class LR0Collection
for(int j = 0; j < symbols.length; j++)
{
addGoto(i, symbols[j], Grammar.GOTO(set
(i), symbols[j]));
addGoto(i, symbols[j], Grammar.GOTO(set(i), symbols[j]));
}
}
System.out.println();
}
private int add
(LR0ItemSet set
, int from, Symbol symbol)
private int add(LR0ItemSet set, int from, Symbol symbol)
{
Integer result = set
(set
);
Integer result = set(set);
if(result == null)
{
result = sets.size();
setIndices.put(set
, result);
setIndices.put(set, result);
sets.add(set);
GOTO.add(new TreeMap<Symbol, Integer>());
if(from == -1)
......@@ -86,15 +77,12 @@ final class LR0Collection
}
}
private Integer set
(LR0ItemSet set
)
private Integer set(LR0ItemSet set)
{
return setIndices.get(set);
}
private LR0ItemSet set
(int index)
private LR0ItemSet set(int index)
{
return sets.get(index);
}
......@@ -104,8 +92,7 @@ final class LR0Collection
return sets.toArray(new LR0ItemSet[0]);
}
Integer GOTO(int set
, Symbol symbol)
Integer GOTO(int set, Symbol symbol)
{
return GOTO.get(set).get(symbol);
}
......
......@@ -10,14 +10,11 @@ package org.sablecc.sablecc;
final class LR0ItemAndSetPair
{
public final LR0Item item;
public final int set
;
public final int set;
LR0ItemAndSetPair(LR0Item item, int set
)
LR0ItemAndSetPair(LR0Item item, int set)
{
this.item = item;
this.set = set
;
this.set = set;
}
}
......@@ -21,14 +21,12 @@ final class LR0ItemSet implements Cloneable, Comparable<LR0ItemSet>
items = new TreeMap<>();
}
private LR0ItemSet(LR0ItemSet set
)
private LR0ItemSet(LR0ItemSet set)
{
items = new TreeMap<>(set.items);
}
void set
(LR0Item item)
void set(LR0Item item)
{
if(items.put(item, item) == null)
{
......@@ -37,8 +35,7 @@ final class LR0ItemSet implements Cloneable, Comparable<LR0ItemSet>
}
}
boolean get
(LR0Item item)
boolean get(LR0Item item)
{
return items.get(item) != null;
}
......@@ -77,8 +74,7 @@ final class LR0ItemSet implements Cloneable, Comparable<LR0ItemSet>
for(int j = 0; j <= rightsideLength; j++)
{
LR0Item item = new LR0Item(productions[i].index, j);
if(get
(item))
if(get(item))
{
if(space)
{
......@@ -114,8 +110,7 @@ final class LR0ItemSet implements Cloneable, Comparable<LR0ItemSet>
return false;
}
LR0ItemSet set
= (LR0ItemSet) obj;
LR0ItemSet set = (LR0ItemSet) obj;
return items.keySet().equals(set.items.keySet());
}
......
......@@ -18,11 +18,9 @@ final class LR1Collection
final Map<LR0Item, SymbolSet>[] lookaheads;
private final Map<LR0Item, List<LR0ItemAndSetPair>>[] propagation;
LR1Collection(LR0ItemSet set
)
LR1Collection(LR0ItemSet set)
{
collection = new LR0Collection(set
);
collection = new LR0Collection(set);
System.out.println(" - Computing LR(1) items.");
......
......@@ -23,15 +23,13 @@ final class LR1ItemSet implements Cloneable, Comparable<LR1ItemSet>
this.items = new TreeMap<>();
}
private LR1ItemSet(LR1ItemSet set
)
private LR1ItemSet(LR1ItemSet set)
{
this.items = new TreeMap<>(set.items);
this.hashCode = set.hashCode;
}
void set
(LR1Item item)
void set(LR1Item item)
{
if(items.put(item, item) == null)
{
......@@ -40,8 +38,7 @@ final class LR1ItemSet implements Cloneable, Comparable<LR1ItemSet>
}
}
boolean get
(LR1Item item)
boolean get(LR1Item item)
{
return items.get(item) != null;
}
......@@ -89,8 +86,7 @@ final class LR1ItemSet implements Cloneable, Comparable<LR1ItemSet>
for(int k = 0; k < terminals.length; k++)
{
LR1Item item = new LR1Item(lr0Item, terminals[k].index);
if(get
(item))
if(get(item))
{
if(comma)
{
......@@ -176,8 +172,7 @@ final class LR1ItemSet implements Cloneable, Comparable<LR1ItemSet>
return false;
}
LR1ItemSet set
= (LR1ItemSet) obj;
LR1ItemSet set = (LR1ItemSet) obj;
return items.keySet().equals(set.items.keySet());
}
......
......@@ -46,8 +46,7 @@ final class SymbolSet implements Cloneable
this.nonterminals= new IntSet();
}
private SymbolSet(SymbolSet set
)
private SymbolSet(SymbolSet set)
{
this.terminals = set.terminals.clone();
this.nonterminals = set.nonterminals.clone();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment