mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-06 21:29:27 +00:00
tidying
This commit is contained in:
parent
1aaee043a3
commit
20ad92fbd5
|
@ -933,7 +933,7 @@ public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftCons
|
||||||
{
|
{
|
||||||
for (SubLine subline : line.sublines)
|
for (SubLine subline : line.sublines)
|
||||||
{
|
{
|
||||||
for (String symbol : subline.getSymbols ())
|
for (String symbol : subline.getVariables ())
|
||||||
checkVar (symbol, line.lineNumber, symbolLines, uniqueSymbols);
|
checkVar (symbol, line.lineNumber, symbolLines, uniqueSymbols);
|
||||||
for (String symbol : subline.getArrays ())
|
for (String symbol : subline.getArrays ())
|
||||||
checkVar (symbol, line.lineNumber, arrayLines, uniqueArrays);
|
checkVar (symbol, line.lineNumber, arrayLines, uniqueArrays);
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class SubLine implements ApplesoftConstants
|
||||||
private final List<Integer> gotoLines = new ArrayList<> ();
|
private final List<Integer> gotoLines = new ArrayList<> ();
|
||||||
private final List<Integer> gosubLines = new ArrayList<> ();
|
private final List<Integer> gosubLines = new ArrayList<> ();
|
||||||
|
|
||||||
private final List<String> symbols = new ArrayList<> ();
|
private final List<String> variables = new ArrayList<> ();
|
||||||
private final List<String> functions = new ArrayList<> ();
|
private final List<String> functions = new ArrayList<> ();
|
||||||
private final List<String> arrays = new ArrayList<> ();
|
private final List<String> arrays = new ArrayList<> ();
|
||||||
|
|
||||||
|
@ -213,64 +213,8 @@ public class SubLine implements ApplesoftConstants
|
||||||
if (!arrays.contains (var))
|
if (!arrays.contains (var))
|
||||||
arrays.add (var);
|
arrays.add (var);
|
||||||
}
|
}
|
||||||
else if (!symbols.contains (var))
|
else if (!variables.contains (var))
|
||||||
symbols.add (var);
|
variables.add (var);
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<String> getSymbols ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return symbols;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<String> getFunctions ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return functions;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<String> getArrays ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return arrays;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<Integer> getGotoLines ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return gotoLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<Integer> getGosubLines ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return gosubLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<Integer> getConstantsInt ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return constantsInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<Float> getConstantsFloat ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return constantsFloat;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
List<String> getStringsText ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return stringsText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -386,8 +330,7 @@ public class SubLine implements ApplesoftConstants
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int decimalPos = var.indexOf ('.');
|
if (var.indexOf ('.') < 0) // no decimal point
|
||||||
if (decimalPos < 0)
|
|
||||||
{
|
{
|
||||||
int varInt = Integer.parseInt (var);
|
int varInt = Integer.parseInt (var);
|
||||||
if (!constantsInt.contains (varInt))
|
if (!constantsInt.contains (varInt))
|
||||||
|
@ -402,7 +345,6 @@ public class SubLine implements ApplesoftConstants
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfe)
|
catch (NumberFormatException nfe)
|
||||||
{
|
{
|
||||||
// System.out.printf ("NFE1: %s%n", var);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -416,6 +358,7 @@ public class SubLine implements ApplesoftConstants
|
||||||
|
|
||||||
int ptr = startPtr + 1;
|
int ptr = startPtr + 1;
|
||||||
int max = startPtr + length - 1;
|
int max = startPtr + length - 1;
|
||||||
|
|
||||||
while (ptr < max)
|
while (ptr < max)
|
||||||
{
|
{
|
||||||
byte b = buffer[ptr++];
|
byte b = buffer[ptr++];
|
||||||
|
@ -437,6 +380,7 @@ public class SubLine implements ApplesoftConstants
|
||||||
for (int i = start; i < buffer.length; i++)
|
for (int i = start; i < buffer.length; i++)
|
||||||
if (buffer[i] == value)
|
if (buffer[i] == value)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +444,10 @@ public class SubLine implements ApplesoftConstants
|
||||||
{
|
{
|
||||||
int p = startPtr + 1;
|
int p = startPtr + 1;
|
||||||
int max = startPtr + length;
|
int max = startPtr + length;
|
||||||
|
|
||||||
while (buffer[p] != TOKEN_EQUALS && p < max)
|
while (buffer[p] != TOKEN_EQUALS && p < max)
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (buffer[p] == TOKEN_EQUALS)
|
if (buffer[p] == TOKEN_EQUALS)
|
||||||
equalsPosition = toString ().indexOf ('='); // use expanded line
|
equalsPosition = toString ().indexOf ('='); // use expanded line
|
||||||
}
|
}
|
||||||
|
@ -645,15 +591,8 @@ public class SubLine implements ApplesoftConstants
|
||||||
len--;
|
len--;
|
||||||
byte[] buffer2 = new byte[len];
|
byte[] buffer2 = new byte[len];
|
||||||
System.arraycopy (buffer, startPtr + 1, buffer2, 0, buffer2.length);
|
System.arraycopy (buffer, startPtr + 1, buffer2, 0, buffer2.length);
|
||||||
return buffer2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
return buffer2;
|
||||||
@Override
|
|
||||||
public String toString ()
|
|
||||||
// ---------------------------------------------------------------------------------//
|
|
||||||
{
|
|
||||||
return toStringBuilder ().toString ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -663,6 +602,62 @@ public class SubLine implements ApplesoftConstants
|
||||||
return Utility.isHighBitSet (b);
|
return Utility.isHighBitSet (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<String> getVariables ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<String> getFunctions ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return functions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<String> getArrays ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return arrays;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<Integer> getGotoLines ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return gotoLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<Integer> getGosubLines ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return gosubLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<Integer> getConstantsInt ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return constantsInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<Float> getConstantsFloat ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return constantsFloat;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
List<String> getStringsText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return stringsText;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
public StringBuilder toStringBuilder ()
|
public StringBuilder toStringBuilder ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -697,4 +692,12 @@ public class SubLine implements ApplesoftConstants
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@Override
|
||||||
|
public String toString ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
return toStringBuilder ().toString ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user