Commit a36581b2 authored by Milhomme Allan's avatar Milhomme Allan
Browse files

Add list search names

parent fd06002d
File added
T = "a"
T = {"a" [#b:"b"]}
\ No newline at end of file
......@@ -249,7 +249,7 @@ public class ClassGenerator
builder.append("\"");
builder.append(name.id.getName());
builder.append("\", ");
builder.append(name.list);
builder.append(name.list != null);
builder.append(", ");
}
}
......
......@@ -150,6 +150,14 @@ public class Compiler
pathForThisName.add(level, new SearchPath(currentPath, token));
}
if (type.searchName.list != null)
{
if (level == 0)
report(new Info(InfoModel.listIsntInArraySearch, type.searchName.id));
if (!(token instanceof TokenSearchToken))
report(new Info(InfoModel.listIsntATokenSearch, type.searchName.id));
}
}
if (type.searchName != null && type.searchName != null)
......@@ -210,8 +218,10 @@ public class Compiler
report(new Info(InfoModel.emptyArray, token));
boolean b = first;
if (token instanceof ArraySearchToken)
level ++;
int i = 0;
for (SearchToken tt : ((MultipleSearchToken)token).getTypes())
{
......
......@@ -35,7 +35,9 @@ enum InfoModel
illegalIdentifier(Etat.ERROR, "This name is not allowed"),
invalidTransSearch(Etat.ERROR, "'#' can only be used with a transient token"),
incorrectRange(Etat.ERROR, "Min and max size must be positive integers (min <= max)"),
nonExistentIgnore(Etat.ERROR, "Can't use ignore because it has not been defined")
nonExistentIgnore(Etat.ERROR, "Can't use ignore because it has not been defined"),
listIsntInArraySearch(Etat.ERROR, "A list cannot be used outside of an array search"),
listIsntATokenSearch(Etat.ERROR, "A list can only be used on a token search")
;
public final Etat etat;
......
......@@ -10,8 +10,12 @@ public class SearchName extends Token
public Result searchResults[];
public Identifier id;
public ParserString list;
public ParserString notGenerated;
public static final Search builderSearches[] = {
new OptionalSearch(
new TokenSearch("list", false, ParserString.transientToken)
),
new OptionalSearch(
new TokenSearch("notGenerated", false, ParserString.nonGeneratedName)
),
......@@ -20,6 +24,4 @@ public class SearchName extends Token
};
/********** Do not modify or remove **********/
public boolean list = false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment