-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The V0.2 is now out. Many thinks is changes so it a lot faster end V0.1
- Loading branch information
Ronnie
committed
Feb 4, 2016
1 parent
65b44c6
commit 3e84480
Showing
28 changed files
with
298 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using script.token; | ||
using script.variabel; | ||
using System.Collections; | ||
|
||
namespace script.parser | ||
{ | ||
class ForParser : ParserInterface | ||
{ | ||
public void end(EnegyData data, VariabelDatabase db) | ||
{ | ||
} | ||
|
||
public CVar parse(EnegyData ed, VariabelDatabase db, Token token) | ||
{ | ||
if(token.next().type() != TokenType.LeftBue) | ||
{ | ||
ed.setError(new ScriptError("Missing ( after 'for'", token.getCache().posision()), db); | ||
return null; | ||
} | ||
|
||
//push the tokens until ; | ||
ArrayList init = getNextBlock(ed, db, token, true); | ||
|
||
if (ed.State != RunningState.Normal) | ||
{ | ||
return null; | ||
} | ||
|
||
ArrayList status = getNextBlock(ed, db, token, true); | ||
|
||
if (ed.State != RunningState.Normal) | ||
{ | ||
return null; | ||
} | ||
|
||
ArrayList handler = getNextBlock(ed, db, token, false); | ||
|
||
if (ed.State != RunningState.Normal) | ||
{ | ||
return null; | ||
} | ||
|
||
ArrayList body = BodyParser.parse(token, ed, db); | ||
|
||
if (ed.State != RunningState.Normal) | ||
{ | ||
return null; | ||
} | ||
|
||
//init the data :) | ||
new VariabelParser().parse(ed, db, new TokenCache(init, ed, db)); | ||
|
||
while(ed.State == RunningState.Normal && new VariabelParser().parse(ed, db, new TokenCache(status, ed, db)).toBoolean(token.getCache().posision(), ed, db)) | ||
{ | ||
Interprenter.parse(new TokenCache(body, ed, db), ed, db); | ||
if (ed.State == RunningState.Normal) | ||
new VariabelParser().parse(ed, db, new TokenCache(handler, ed, db)); | ||
} | ||
token.next(); | ||
return null; | ||
} | ||
|
||
private ArrayList getNextBlock(EnegyData data, VariabelDatabase db, Token token, bool isEnd) | ||
{ | ||
TokenBuffer buffer; | ||
ArrayList b = new ArrayList(); | ||
while((buffer = token.next()).type() != TokenType.EOF && buffer.type() != (isEnd ? TokenType.End : TokenType.RightBue)) | ||
{ | ||
b.Add(buffer); | ||
} | ||
|
||
if(token.getCache().type() != (isEnd ? TokenType.End : TokenType.RightBue)) | ||
{ | ||
data.setError(new ScriptError("Missing "+(isEnd ? ";" : ")")+" got: " + token.getCache().ToString(), token.getCache().posision()), db); | ||
return new ArrayList(); | ||
} | ||
|
||
return b; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using script.token; | ||
using script.variabel; | ||
using System; | ||
|
||
namespace script.parser | ||
{ | ||
class PublicParser : ParserInterface | ||
{ | ||
public void end(EnegyData data, VariabelDatabase db) | ||
{} | ||
|
||
public CVar parse(EnegyData ed, VariabelDatabase db, Token token) | ||
{ | ||
if(token.next().type() == TokenType.Function) | ||
{ | ||
functionParser p = new functionParser(true); | ||
p.parse(ed, db, token); | ||
p.end(ed, db); | ||
}else if(token.getCache().type() == TokenType.Class) | ||
{ | ||
ClassParser p = new ClassParser(true); | ||
p.parse(ed, db, token); | ||
p.end(ed, db); | ||
} | ||
else | ||
{ | ||
ed.setError(new ScriptError("unknown token after public: " + token.getCache().ToString(), token.getCache().posision()), db); | ||
} | ||
return new NullVariabel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.