Skip to content

Commit

Permalink
+ Mesh Editor.
Browse files Browse the repository at this point in the history
#2 ExportAs ok
Improving TreeNode. Addition vectors 1/1 (revert to my Android Calculator App)
Game works again.
TextDialog in feature processing
Include spaces in AlgebraicTree formulas.
New class analyze StringAnalyser.

Signed-off-by: Manuel Daniel Dahmen <[email protected]>
  • Loading branch information
manuelddahmen committed Jan 26, 2024
1 parent a44ec87 commit b458de9
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/main/java/one/empty3/library1/tree/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Class {
private String name;
private List<Variable> variableList = new ArrayList<>();
private List<Method> methodList = new ArrayList<>();
private String accessModifier;

public Class() {

Expand Down Expand Up @@ -77,4 +78,8 @@ public int hashCode() {
result = 31 * result + (methodList != null ? methodList.hashCode() : 0);
return result;
}

public void setAccessModifier(String searched) {
this.accessModifier = searched;
}
}
79 changes: 63 additions & 16 deletions src/main/java/one/empty3/library1/tree/StringAnalyser.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,50 @@ public int parse(String input, int position) {
input = input.substring(position);
for (String searched : values) {
if (input.startsWith(searched)) {
this.setSuccessful(true);
construct.currentClass.setAccessModifier(searched);
return searched.length();
}
}
return 0;
}
}

class TokenClassScope extends TokenChoiceExclusive {
private String[] values = new String[]{"static", ""};
class TokenChoiceStringMandatory extends Token {
private final String[] names;

public TokenClassScope(int indexCurrent) {
public TokenChoiceStringMandatory(int indexCurrent, String[] values) {
super(indexCurrent);
this.names = values;
}

@Override
public int parse(String input, int position) {
position = super.skipBlanks(input, position);
input = input.substring(position);
for (String s : names) {
if (input.startsWith(s)) {
setSuccessful(true);
return position + s.length();
}
}
return position;
}
}

class TokenClassScope extends TokenChoiceStringMandatory {
public TokenClassScope(int indexCurrent) {
super(indexCurrent, new String[]{"static", ""});
}
}

class TokenConstantModifier extends TokenChoiceExclusive {
private String[] values = new String[]{"final", ""};

class TokenConstantModifier extends TokenChoiceStringMandatory {
public TokenConstantModifier(int indexCurrent) {
super(indexCurrent);
super(indexCurrent, new String[]{"final", ""});
}
}


class TokenCodeFile extends Token {
public TokenCodeFile(int indexCurrent) {
super(indexCurrent);
Expand Down Expand Up @@ -145,7 +164,7 @@ public int parse(String input, int position) {
}

class TokenChoiceExclusive extends Token {
private final Token[] choices;
protected final Token[] choices;

public TokenChoiceExclusive(int indCurr, Token... choices) {
super(indCurr);
Expand All @@ -172,15 +191,41 @@ public int parse(String input, int position) {
}
}

class TokenPackage extends TokenChoiceInclusive {
class TokenPackage extends TokenChoiceStringMandatory {
public TokenPackage(int currIndex) {
super(currIndex, new String[]{"package"});
}

@Override
public int parse(String input, int position) {
position = super.parse(input, position);
int position1 = super.parse(input, position);
return position1;
}
}

class TokenQualifiedName extends TokenName {
public TokenQualifiedName(int currIndex) {
super(currIndex);
}

@Override
public int parse(String input, int position) {
position = super.parse(input, position);
int position1 = super.parse(input, position);
int i = 0;
boolean passed = false;
while (i < input.charAt(i) && (Character.isLetterOrDigit(input.charAt(i)) || Character.isAlphabetic(input.charAt(i))
|| input.charAt(i) == '_')) {
passed = true;
}
if (passed) {
if (input.substring(position1, i).length() > 0) {
setSuccessful(true);
return position1 + i;
}
}
setSuccessful(false);
return position1;
}
}
Expand Down Expand Up @@ -209,8 +254,11 @@ public TokenString(int index, String aPackage) {
public int parse(String input, int position) {
position = super.parse(input, position);
input = input.substring(position);
if (input.startsWith(name))
if (input.startsWith(name)) {
setSuccessful(true);
return position + name.length();
}
setSuccessful(false);
return position;
}
}
Expand Down Expand Up @@ -319,13 +367,13 @@ public int parse(String input, int position) {
}
}

class TokenMethodMemberDefinition extends Token {
class TokenMethodMemberDefinition extends TokenName {
public TokenMethodMemberDefinition(int indexCurrent) {
super(indexCurrent);
}
}

class TokenVariableMemberDefinition extends Token {
class TokenVariableMemberDefinition extends TokenName {
public TokenVariableMemberDefinition(int indexCurrent) {
super(indexCurrent);
}
Expand All @@ -344,7 +392,7 @@ public int parse(String input, int position) {
}
}

class TokenVariableMemberDefinitionClassName extends Token {
class TokenVariableMemberDefinitionClassName extends TokenName {
public TokenVariableMemberDefinitionClassName(int indexCurrent) {
super(indexCurrent);
}
Expand Down Expand Up @@ -400,12 +448,11 @@ class Construct {

public void construct() {
Token token = definitions.get(0);
if (token.getClass().equals(TokenCodeFile.class)) {

}
}
}

private Construct construct = new Construct();

public int parse(String input) {
return definitions.get(0).parse(input, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ class TestAlgebraicTreeVector() {
val stringAnalyser: StringAnalyser = StringAnalyser()
val parse: Int = stringAnalyser.parse(
"class Numb {\n" +
"func1(Double a, Double b, Double c) {\n" +
"double func1(Double a, Double b, Double c) {\n" +
"Double d = c+b/a\n" +
"\n" +
"return d\n" +
"}\n" +
"}\n"
)
Expand Down

0 comments on commit b458de9

Please sign in to comment.