Added functions to lexer to aid in dot-identifier parsing

Made isPathIdentifier public

Updated test case
This commit is contained in:
Tristan B. Velloza Kildaire 2021-03-29 13:44:09 +02:00
parent e003a9879f
commit e469cc3ec3
3 changed files with 25 additions and 1 deletions

View File

@ -70,6 +70,29 @@ public final class Lexer
return position-1 < sourceCode.length;
}
/**
* Used for tokenising a2.b2
*
* When the `.` is encountered
* and there are some characters
* behind it this checks if we can
* append a further dot to it
*/
private bool isBuildUpValidIdent()
{
import compiler.symbols;
return isPathIdentifier(currentToken) || isIdentifier(currentToken);
}
/**
* Returns true if we have a token being built
* false otherwise
*/
private bool hasToken()
{
return currentToken.length == 0;
}
/* Perform the lexing process */
/* TODO: Use return value */
public bool performLex()

View File

@ -115,7 +115,7 @@ public bool isPathIdentifier(string token)
return isDot;
}
private bool isIdentifier(string token)
public bool isIdentifier(string token)
{
/* This is used to prevent the first character from not being number */
bool isFirstRun = true;

View File

@ -9,6 +9,7 @@ int b = a.a;
int c = b;
int f = f.L(f(1+f.d.d.d()));
int p = f2p.j2p.p;
public ubyte k = 1;
private ubyte k2 = 1;