mirror of https://github.com/tbklang/tlang.git
Added functions to lexer to aid in dot-identifier parsing
Made isPathIdentifier public Updated test case
This commit is contained in:
parent
e003a9879f
commit
e469cc3ec3
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue