Added support for semi-colon delimiting
This commit is contained in:
parent
1f103bf190
commit
cce91b6615
|
@ -38,6 +38,17 @@ public final class Lexer
|
||||||
|
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
|
else if(currentChar == ';' && !stringMode)
|
||||||
|
{
|
||||||
|
/* Flush the current token */
|
||||||
|
currentTokens ~= currentToken;
|
||||||
|
currentToken = "";
|
||||||
|
|
||||||
|
/* Add the ; token */
|
||||||
|
currentTokens ~= ";";
|
||||||
|
|
||||||
|
position++;
|
||||||
|
}
|
||||||
else if(currentChar == '"')
|
else if(currentChar == '"')
|
||||||
{
|
{
|
||||||
/* If we are not in string mode */
|
/* If we are not in string mode */
|
||||||
|
|
|
@ -15,7 +15,8 @@ void beginCompilation(string[] sourceFiles)
|
||||||
gprintln("Performing tokenization on '"~sourceFile~"' ...");
|
gprintln("Performing tokenization on '"~sourceFile~"' ...");
|
||||||
|
|
||||||
/* TODO: Open source file */
|
/* TODO: Open source file */
|
||||||
string sourceCode = "hello \"world\";";
|
// string sourceCode = "hello \"world\";";
|
||||||
|
string sourceCode = "hello;";
|
||||||
Lexer currentLexer = new Lexer(sourceCode);
|
Lexer currentLexer = new Lexer(sourceCode);
|
||||||
currentLexer.performLex();
|
currentLexer.performLex();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue