Commit a6e30a36 authored by Custom2043's avatar Custom2043
Browse files

fix

parent 4308ea96
......@@ -12,6 +12,7 @@ import tokens.Line;
import tokens.MultipleSearchToken;
import tokens.OrSearchToken;
import tokens.SearchToken;
import tokens.Space;
import tokens.TokenSearchToken;
public class Compiler
......@@ -62,7 +63,7 @@ public class Compiler
{
if (t instanceof ParserString && ((ParserString)t).index == ParserString.anyChar.getIndex())
report(new Info(InfoModel.invalidChar, t));
else if (!(t instanceof Line))
else if (!(t instanceof Line || t instanceof Space || t instanceof LineJump))
report(new Info(InfoModel.syntaxError, t));
else
......
......@@ -38,6 +38,7 @@ public class ParserStringBuilder extends TokenBuilder
public ParserString getParserString(Result[] results)
{
return (ParserString)results[this.getIgnore() == null ? 0 : 1].getToken();
return (ParserString)results[0].getToken();
//return (ParserString)results[this.getIgnore() == null ? 0 : 1].getToken();
}
}
......@@ -36,7 +36,7 @@ public class TokenBuilder extends Builder
else
{
List<Search> s = addIgnores(this.ignore, this.searches);
s.add(this.ignore.getRealSearch());
//s.add(this.ignore.getRealSearch());
this.searchesWithIgnore = s.toArray(new Search[s.size()]);
}
}
......@@ -47,8 +47,9 @@ public class TokenBuilder extends Builder
for (Search s : searches)
if (s instanceof TokenSearch || s instanceof OrSearch)
{
searchesWithIgnore.add(ignore.getRealSearch());
searchesWithIgnore.add(s);
if (s != searches[searches.length - 1])
searchesWithIgnore.add(ignore.getRealSearch());
}
else if (s instanceof MultipleSearch)
searchesWithIgnore.add(((MultipleSearch)s).addIgnore(ignore));
......
quote = "\""
singleQuote = "\'"
backslash = "\\"
#NumberChar = "0" (base:"b" {value:'0-1'})|(base:"x" {value:'0-9|A-F'})|(base:"d" {value:digit})
#SingleChar = (backslash backslash:("b"|"r"|"t"|"n"|backslash|quote|singleQuote)) | anyChar
CharacterToken = singleQuote [notToken:notToken] {|orToken character1:(NumberChar|SingleChar) ["-" character2:(NumberChar|SingleChar)]} singleQuote
StringToken = (quote {charTokens:(CharacterToken | SingleChar)} quote) | singleChar:CharacterToken
letter = 'a-z|A-Z'
digit = '0-9'
exprOpen = "("
exprClose = ")"
optionOpen = "["
optionClose = "]"
arrayOpen = "{"
arrayClose = "}"
notToken = "!"
orToken = "|"
transientToken = "#"
equals = "="
Jump = "\r\n"|"\r"|"\n"
Space = " "|"\t"
Identifier = firstLetter:letter [{idName:(letter|digit)}]
ignore = {Space|Jump}
SearchName = id:Identifier ":"
LineHeader = [trans:transientToken] id:Identifier equals
TokenSearchToken = ([trans:transientToken] id:Identifier)|string:StringToken
ArraySearchToken = [{minSize:digit} "-"] arrayOpen [orToken left:SearchToken] {searches:SearchToken} [right:SearchToken orToken] arrayClose ["-" {maxSize:digit}]
OptionalSearchToken = optionOpen {searches:SearchToken} optionClose
BracketSearchToken = exprOpen {searches:SearchToken} exprClose
OrSearchToken = 2-{searches:#SearchToken orToken|}
#SearchToken = ([searchName:SearchName] searchToken:(TokenSearchToken|ArraySearchToken|OptionalSearchToken|BracketSearchToken)) | searchToken:OrSearchToken
Line = header:LineHeader {searchTokens:SearchToken}
anyChar = '*'
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