mirror of
https://github.com/AppleCommander/bastools.git
synced 2024-12-21 08:31:51 +00:00
Renaming project from bastokenizer to bastools to capture the ... expansion of its capabilities!
This commit is contained in:
parent
68709f8ca1
commit
88ce03e970
4
LICENSE
4
LICENSE
@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
bastokenizer
|
||||
bastools
|
||||
Copyright (C) 2018 Rob Greene
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
bastokenizer Copyright (C) 2018 Rob Greene
|
||||
bastools Copyright (C) 2018 Rob Greene
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
@ -9,8 +9,8 @@ To include in a Maven project:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>net.sf.applecommander</groupId>
|
||||
<artifactId>bastokenizer-api</artifactId>
|
||||
<version>0.2.0</version>
|
||||
<artifactId>bastools-api</artifactId>
|
||||
<version>0.3.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@ -19,7 +19,7 @@ To include in a Gradle project:
|
||||
```
|
||||
dependencies {
|
||||
// ...
|
||||
compile "net.sf.applecommander:bastokenizer-api:0.2.0"
|
||||
compile "net.sf.applecommander:bastools-api:0.2.0"
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
@ -13,7 +13,7 @@ dependencies {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Implementation-Title': 'B/BAS Tokenizer',
|
||||
'Implementation-Title': 'B/BAS Tools API',
|
||||
'Implementation-Version': "${version} (${new Date().format('yyyy-MM-dd HH:mm')})"
|
||||
)
|
||||
}
|
||||
@ -55,11 +55,11 @@ uploadArchives {
|
||||
pom.project {
|
||||
name archivesBaseName
|
||||
packaging 'jar'
|
||||
description 'Experiments with generating an AppleSoft B/BAS tokenized "binary".'
|
||||
description 'An Applesoft BASIC tools library.'
|
||||
url 'https://applecommander.github.io/'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/AppleCommander/bastokenizer'
|
||||
url 'https://github.com/AppleCommander/bastools'
|
||||
}
|
||||
|
||||
licenses {
|
||||
|
@ -1,14 +0,0 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
|
||||
/**
|
||||
* Since there are many pieces to bastokenizer, the version information is just a small,
|
||||
* dedicated class.
|
||||
*/
|
||||
public class BasTokenizer {
|
||||
public static final String VERSION;
|
||||
static {
|
||||
VERSION = BasTokenizer.class.getPackage().getImplementationVersion();
|
||||
}
|
||||
|
||||
private BasTokenizer() {}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
/**
|
||||
* Since there are many pieces to bastools, the version information is just a small,
|
||||
* dedicated class.
|
||||
*/
|
||||
public class BasTools {
|
||||
public static final String VERSION;
|
||||
public static final String TITLE;
|
||||
static {
|
||||
TITLE = BasTools.class.getPackage().getImplementationTitle();
|
||||
VERSION = BasTools.class.getPackage().getImplementationVersion();
|
||||
}
|
||||
|
||||
private BasTools() {}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@ -6,10 +6,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastokenizer.api.utils.Converters;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.utils.Converters;
|
||||
|
||||
public abstract class Directive {
|
||||
protected Configuration config;
|
@ -1,12 +1,12 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.directives.EmbeddedBinaryDirective;
|
||||
import io.github.applecommander.bastokenizer.api.directives.HexDirective;
|
||||
import io.github.applecommander.bastools.api.directives.EmbeddedBinaryDirective;
|
||||
import io.github.applecommander.bastools.api.directives.HexDirective;
|
||||
|
||||
public class Directives {
|
||||
private Directives() { /* Prevent construction. */ }
|
@ -1,12 +1,12 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.optimizations.ExtractConstantValues;
|
||||
import io.github.applecommander.bastokenizer.api.optimizations.MergeLines;
|
||||
import io.github.applecommander.bastokenizer.api.optimizations.RemoveEmptyStatements;
|
||||
import io.github.applecommander.bastokenizer.api.optimizations.RemoveRemStatements;
|
||||
import io.github.applecommander.bastokenizer.api.optimizations.Renumber;
|
||||
import io.github.applecommander.bastools.api.optimizations.ExtractConstantValues;
|
||||
import io.github.applecommander.bastools.api.optimizations.MergeLines;
|
||||
import io.github.applecommander.bastools.api.optimizations.RemoveEmptyStatements;
|
||||
import io.github.applecommander.bastools.api.optimizations.RemoveRemStatements;
|
||||
import io.github.applecommander.bastools.api.optimizations.Renumber;
|
||||
|
||||
/**
|
||||
* All optimization capabilities are definined here in the "best" manner of execution.
|
@ -1,13 +1,13 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
/**
|
||||
* The Parser will read a series of Tokens and build a Program.
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -12,8 +12,8 @@ import java.util.LinkedList;
|
||||
import java.util.Optional;
|
||||
import java.util.Queue;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
/**
|
||||
* The TokenReader, given a text file, generates a series of Tokens (in the compiler sense,
|
@ -1,9 +1,9 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
/**
|
||||
* The Visitor interface allows some flexibility in what can be done with the
|
@ -1,17 +1,17 @@
|
||||
package io.github.applecommander.bastokenizer.api;
|
||||
package io.github.applecommander.bastools.api;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.visitors.ByteVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.LineNumberTargetCollector;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.PrettyPrintVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.PrintVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.ReassignmentVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.VariableCollectorVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.VariableReportVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.ByteVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.LineNumberTargetCollector;
|
||||
import io.github.applecommander.bastools.api.visitors.PrettyPrintVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.PrintVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.ReassignmentVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.VariableCollectorVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.VariableReportVisitor;
|
||||
|
||||
/**
|
||||
* This class presents all of the common Visitor implementations via builder patterns.
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.directives;
|
||||
package io.github.applecommander.bastools.api.directives;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@ -7,10 +7,10 @@ import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Directive;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Directive;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
|
||||
public class EmbeddedBinaryDirective extends Directive {
|
||||
public EmbeddedBinaryDirective(Configuration config, OutputStream outputStream) {
|
@ -1,12 +1,12 @@
|
||||
package io.github.applecommander.bastokenizer.api.directives;
|
||||
package io.github.applecommander.bastools.api.directives;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Directive;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Directive;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
|
||||
/**
|
||||
* A simple directive to introduce hexidecimal capabilities. StreamTokenizer does not
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.model;
|
||||
package io.github.applecommander.bastools.api.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
@ -1,11 +1,11 @@
|
||||
package io.github.applecommander.bastokenizer.api.model;
|
||||
package io.github.applecommander.bastools.api.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
|
||||
/** An AppleSoft BASIC Line representation. */
|
||||
public class Line {
|
@ -1,9 +1,9 @@
|
||||
package io.github.applecommander.bastokenizer.api.model;
|
||||
package io.github.applecommander.bastools.api.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
|
||||
/** A Program is a series of lines. */
|
||||
public class Program {
|
@ -1,9 +1,9 @@
|
||||
package io.github.applecommander.bastokenizer.api.model;
|
||||
package io.github.applecommander.bastools.api.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
|
||||
/** A Statement is simply a series of Tokens. */
|
||||
public class Statement {
|
@ -1,6 +1,6 @@
|
||||
package io.github.applecommander.bastokenizer.api.model;
|
||||
package io.github.applecommander.bastools.api.model;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
|
||||
/**
|
||||
* A Token in the classic compiler sense, in that this represents a component of the application.
|
@ -1,14 +1,14 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitors;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
/**
|
||||
* Common base class for optimization visitors that allow the program tree to be rewritten.
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -7,15 +7,15 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.utils.VariableNameGenerator;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.VariableCollectorVisitor;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Visitors;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.utils.VariableNameGenerator;
|
||||
import io.github.applecommander.bastools.api.visitors.VariableCollectorVisitor;
|
||||
|
||||
/**
|
||||
* Find constants and extract to variables in order to have the number parsed only once.
|
@ -1,18 +1,18 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Set;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.ByteVisitor;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.LineNumberTargetCollector;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Visitors;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.visitors.ByteVisitor;
|
||||
import io.github.applecommander.bastools.api.visitors.LineNumberTargetCollector;
|
||||
|
||||
public class MergeLines extends BaseVisitor {
|
||||
private Set<Integer> targets;
|
@ -1,7 +1,7 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
|
||||
/** Remove any empty statements during the tree walk. Effective removes double "::"'s. */
|
||||
public class RemoveEmptyStatements extends BaseVisitor {
|
@ -1,8 +1,8 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
/** Drop all REM statements as they are encountered in the tree walk. */
|
||||
public class RemoveRemStatements extends BaseVisitor {
|
@ -1,7 +1,7 @@
|
||||
package io.github.applecommander.bastokenizer.api.optimizations;
|
||||
package io.github.applecommander.bastools.api.optimizations;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
|
||||
/**
|
||||
* A simple renumbering algorithm that maps the reassignments and lets {@code BaseVisitor}
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.utils;
|
||||
package io.github.applecommander.bastools.api.utils;
|
||||
|
||||
public class Converters {
|
||||
private Converters() { /* Prevent construction */ }
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.utils;
|
||||
package io.github.applecommander.bastools.api.utils;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -7,15 +7,15 @@ import java.util.Optional;
|
||||
import java.util.Stack;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Directive;
|
||||
import io.github.applecommander.bastokenizer.api.Directives;
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Directive;
|
||||
import io.github.applecommander.bastools.api.Directives;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
public class ByteVisitor implements Visitor {
|
||||
private Stack<ByteArrayOutputStream> stack;
|
@ -1,13 +1,13 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
public class LineNumberTargetCollector implements Visitor {
|
||||
private Set<Integer> targets = new TreeSet<>();
|
@ -1,12 +1,12 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors.PrintBuilder;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitors.PrintBuilder;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
public class PrettyPrintVisitor implements Visitor {
|
||||
private PrintStream printStream;
|
@ -1,12 +1,12 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors.PrintBuilder;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.Visitors.PrintBuilder;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
|
||||
public class PrintVisitor implements Visitor {
|
||||
private PrintStream printStream;
|
@ -1,14 +1,14 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Statement;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.model.ApplesoftKeyword;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Statement;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
/** This is a mildly rewritable Visitor. */
|
||||
public class ReassignmentVisitor implements Visitor {
|
@ -1,11 +1,11 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
public class VariableCollectorVisitor implements Visitor {
|
||||
private Set<String> variableNames = new HashSet<>();
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.visitors;
|
||||
package io.github.applecommander.bastools.api.visitors;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -6,11 +6,11 @@ import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Visitor;
|
||||
import io.github.applecommander.bastokenizer.api.model.Line;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.Visitor;
|
||||
import io.github.applecommander.bastools.api.model.Line;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
|
||||
public class VariableReportVisitor implements Visitor {
|
||||
private Map<String,SortedSet<Integer>> refs = new HashMap<>();
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.api.utils;
|
||||
package io.github.applecommander.bastools.api.utils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@ -7,6 +7,8 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import io.github.applecommander.bastools.api.utils.VariableNameGenerator;
|
||||
|
||||
public class VariableNameGeneratorTest {
|
||||
@Test
|
||||
public void testNameSequence() {
|
@ -1,8 +1,8 @@
|
||||
# Universal applesingle version number. Used for:
|
||||
# Universal bastools version number. Used for:
|
||||
# - Naming JAR file.
|
||||
# - The build will insert this into a file that is read at run time as well.
|
||||
version=0.3.0
|
||||
|
||||
# Maven Central Repository G and A of GAV coordinate. :-)
|
||||
group=net.sf.applecommander
|
||||
archivesBaseName=bastokenizer
|
||||
archivesBaseName=bastools
|
||||
|
@ -1,7 +1,7 @@
|
||||
include 'api'
|
||||
include 'tools:bt'
|
||||
|
||||
rootProject.name = 'bastokenizer'
|
||||
project(":api").name = 'bastokenizer-api'
|
||||
project(":tools").name = 'bastokenizer-tools'
|
||||
project(":tools:bt").name = 'bastokenizer-tools-bt'
|
||||
rootProject.name = 'bastools'
|
||||
project(":api").name = 'bastools-api'
|
||||
project(":tools").name = 'bastools-tools'
|
||||
project(":tools:bt").name = 'bastools-tools-bt'
|
||||
|
@ -15,11 +15,11 @@ Options:
|
||||
--addresses Dump line number addresses out.
|
||||
--applesingle Write output in AppleSingle format
|
||||
--debug Print debug output.
|
||||
--list List structure as bastokenizer understands it.
|
||||
--list List structure as bastools understands it.
|
||||
--max-line-length=<maxLineLength>
|
||||
Maximum line length for generated lines.
|
||||
Default: 255
|
||||
--pretty Pretty print structure as bastokenizer understands it.
|
||||
--pretty Pretty print structure as bastools understands it.
|
||||
--stdout Send binary output to stdout.
|
||||
--tokens Dump token list to stdout for debugging.
|
||||
--variables Generate a variable report
|
||||
|
@ -8,12 +8,12 @@ repositories {
|
||||
|
||||
apply plugin: 'application'
|
||||
|
||||
mainClassName = "io.github.applecommander.bastokenizer.tools.bt.Main"
|
||||
mainClassName = "io.github.applecommander.bastools.tools.bt.Main"
|
||||
|
||||
bootJar {
|
||||
manifest {
|
||||
attributes(
|
||||
'Implementation-Title': 'bastokenizer',
|
||||
'Implementation-Title': 'BT CLI',
|
||||
'Implementation-Version': "${version} (${new Date().format('yyyy-MM-dd HH:mm')})"
|
||||
)
|
||||
}
|
||||
@ -22,5 +22,5 @@ bootJar {
|
||||
dependencies {
|
||||
compile 'info.picocli:picocli:3.0.2'
|
||||
compile 'net.sf.applecommander:applesingle-api:1.2.1'
|
||||
compile project(':bastokenizer-api')
|
||||
compile project(':bastools-api')
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.tools.bt;
|
||||
package io.github.applecommander.bastools.tools.bt;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Arrays;
|
@ -1,6 +1,6 @@
|
||||
package io.github.applecommander.bastokenizer.tools.bt;
|
||||
package io.github.applecommander.bastools.tools.bt;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.utils.Converters;
|
||||
import io.github.applecommander.bastools.api.utils.Converters;
|
||||
import picocli.CommandLine.ITypeConverter;
|
||||
|
||||
/** Add support for "$801" and "0x801" instead of just decimal like 2049. */
|
@ -1,4 +1,4 @@
|
||||
package io.github.applecommander.bastokenizer.tools.bt;
|
||||
package io.github.applecommander.bastools.tools.bt;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -14,15 +14,15 @@ import java.util.Queue;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import io.github.applecommander.applesingle.AppleSingle;
|
||||
import io.github.applecommander.bastokenizer.api.Configuration;
|
||||
import io.github.applecommander.bastokenizer.api.Optimization;
|
||||
import io.github.applecommander.bastokenizer.api.Parser;
|
||||
import io.github.applecommander.bastokenizer.api.TokenReader;
|
||||
import io.github.applecommander.bastokenizer.api.Visitors;
|
||||
import io.github.applecommander.bastokenizer.api.model.Program;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token;
|
||||
import io.github.applecommander.bastokenizer.api.model.Token.Type;
|
||||
import io.github.applecommander.bastokenizer.api.visitors.ByteVisitor;
|
||||
import io.github.applecommander.bastools.api.Configuration;
|
||||
import io.github.applecommander.bastools.api.Optimization;
|
||||
import io.github.applecommander.bastools.api.Parser;
|
||||
import io.github.applecommander.bastools.api.TokenReader;
|
||||
import io.github.applecommander.bastools.api.Visitors;
|
||||
import io.github.applecommander.bastools.api.model.Program;
|
||||
import io.github.applecommander.bastools.api.model.Token;
|
||||
import io.github.applecommander.bastools.api.model.Token.Type;
|
||||
import io.github.applecommander.bastools.api.visitors.ByteVisitor;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Help.Visibility;
|
||||
@ -60,10 +60,10 @@ public class Main implements Callable<Void> {
|
||||
@Option(names = "--applesingle", description = "Write output in AppleSingle format")
|
||||
private boolean applesingleFlag;
|
||||
|
||||
@Option(names = "--pretty", description = "Pretty print structure as bastokenizer understands it.")
|
||||
@Option(names = "--pretty", description = "Pretty print structure as bastools understands it.")
|
||||
private boolean prettyPrint;
|
||||
|
||||
@Option(names = "--list", description = "List structure as bastokenizer understands it.")
|
||||
@Option(names = "--list", description = "List structure as bastools understands it.")
|
||||
private boolean listPrint;
|
||||
|
||||
@Option(names = "--tokens", description = "Dump token list to stdout for debugging.")
|
@ -1,6 +1,6 @@
|
||||
package io.github.applecommander.bastokenizer.tools.bt;
|
||||
package io.github.applecommander.bastools.tools.bt;
|
||||
|
||||
import io.github.applecommander.bastokenizer.api.Optimization;
|
||||
import io.github.applecommander.bastools.api.Optimization;
|
||||
import picocli.CommandLine.ITypeConverter;
|
||||
|
||||
/** Add support for lower-case Optimization flags. */
|
@ -1,15 +1,16 @@
|
||||
package io.github.applecommander.bastokenizer.tools.bt;
|
||||
package io.github.applecommander.bastools.tools.bt;
|
||||
|
||||
import io.github.applecommander.applesingle.AppleSingle;
|
||||
import io.github.applecommander.bastokenizer.api.BasTokenizer;
|
||||
import io.github.applecommander.bastools.api.BasTools;
|
||||
import picocli.CommandLine.IVersionProvider;
|
||||
|
||||
/** Display version information. Note that this is dependent on Gradle configuration. */
|
||||
public class VersionProvider implements IVersionProvider {
|
||||
public String[] getVersion() {
|
||||
return new String[] {
|
||||
String.format("BT CLI: %s", Main.class.getPackage().getImplementationVersion()),
|
||||
String.format("BT API: %s", BasTokenizer.VERSION),
|
||||
String.format("%s: %s", Main.class.getPackage().getImplementationTitle(),
|
||||
Main.class.getPackage().getImplementationVersion()),
|
||||
String.format("%s: %s", BasTools.TITLE, BasTools.VERSION),
|
||||
String.format("AppleSingle API: %s", AppleSingle.VERSION)
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user