Should have not been static
Added `PROCTECTED` symbol Added `isAccessor` to check whether or not the given token is an accessor typedevelop_before_lexer_parser_merge_parseName
parent
72616d4354
commit
5121e60092
|
@ -37,6 +37,7 @@ public enum SymbolType
|
||||||
RETURN,
|
RETURN,
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
PRIVATE,
|
PRIVATE,
|
||||||
|
PROTECTED,
|
||||||
STATIC,
|
STATIC,
|
||||||
CASE,
|
CASE,
|
||||||
GOTO,
|
GOTO,
|
||||||
|
@ -59,7 +60,7 @@ public class Symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Later build classes specific to symbol */
|
/* TODO: Later build classes specific to symbol */
|
||||||
public static bool isType(string tokenStr)
|
public bool isType(string tokenStr)
|
||||||
{
|
{
|
||||||
return cmp(tokenStr, "byte") == 0 || cmp(tokenStr, "ubyte") == 0
|
return cmp(tokenStr, "byte") == 0 || cmp(tokenStr, "ubyte") == 0
|
||||||
|| cmp(tokenStr, "short") == 0 || cmp(tokenStr, "ushort") == 0
|
|| cmp(tokenStr, "short") == 0 || cmp(tokenStr, "ushort") == 0
|
||||||
|
@ -70,7 +71,7 @@ public static bool isType(string tokenStr)
|
||||||
/**
|
/**
|
||||||
* Checks if the given character is a letter
|
* Checks if the given character is a letter
|
||||||
*/
|
*/
|
||||||
private static bool isCharacterAlpha(char character)
|
private bool isCharacterAlpha(char character)
|
||||||
{
|
{
|
||||||
return (character >= 65 && character <= 90) || (character >= 97 && character <= 122);
|
return (character >= 65 && character <= 90) || (character >= 97 && character <= 122);
|
||||||
}
|
}
|
||||||
|
@ -78,12 +79,12 @@ private static bool isCharacterAlpha(char character)
|
||||||
/**
|
/**
|
||||||
* Checks if the given character is a number
|
* Checks if the given character is a number
|
||||||
*/
|
*/
|
||||||
private static bool isCharacterNumber(char character)
|
private bool isCharacterNumber(char character)
|
||||||
{
|
{
|
||||||
return (character >= 48 && character <= 57);
|
return (character >= 48 && character <= 57);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool isIdentifier(string token)
|
private bool isIdentifier(string token)
|
||||||
{
|
{
|
||||||
/* This is used to prevent the first character from not being number */
|
/* This is used to prevent the first character from not being number */
|
||||||
bool isFirstRun = true;
|
bool isFirstRun = true;
|
||||||
|
@ -120,7 +121,14 @@ private static bool isIdentifier(string token)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SymbolType getSymbolType(Token tokenIn)
|
public bool isAccessor(Token token)
|
||||||
|
{
|
||||||
|
return getSymbolType(token) == SymbolType.PUBLIC ||
|
||||||
|
getSymbolType(token) == SymbolType.PRIVATE ||
|
||||||
|
getSymbolType(token) == SymbolType.PROTECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SymbolType getSymbolType(Token tokenIn)
|
||||||
{
|
{
|
||||||
string token = tokenIn.getToken();
|
string token = tokenIn.getToken();
|
||||||
/* TODO: Get symbol type of token */
|
/* TODO: Get symbol type of token */
|
||||||
|
@ -308,11 +316,13 @@ public bool isMathOp(Token token)
|
||||||
* These are just to use for keeping track of what
|
* These are just to use for keeping track of what
|
||||||
* valid identifiers are.
|
* valid identifiers are.
|
||||||
*
|
*
|
||||||
* The are NOT used for code gen
|
* Actually it might be, yeah it will
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
private string moduleName;
|
||||||
|
private Program[] importedModules;
|
||||||
private Variable[] globals;
|
private Variable[] globals;
|
||||||
private Function[] functions;
|
private Function[] functions;
|
||||||
}
|
}
|
||||||
|
@ -329,6 +339,8 @@ public class Variable
|
||||||
{
|
{
|
||||||
private string type;
|
private string type;
|
||||||
private string identifier;
|
private string identifier;
|
||||||
|
|
||||||
|
/* Code gen */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue