/// <summary> /// Returns 0 if valid, 1, 2, 3 etc. invalid. /// <para>skork s;</para> /// <para>int i = 0;</para> /// </summary> /// <param name="codeLine">The code line to parse.</param> /// <returns></returns> private byte ParseCodeLine(string codeLine) { SkorkKeyword sk = new SkorkKeyword(); Util u = new Util(); string line = string.Empty, name = string.Empty; char[] trails = { '\n', ' ' }; return(0); }
public bool CreateKey(string type, string name, string value) { SkorkKeyword sk = new SkorkKeyword(); foreach (string keyword in sk.Keywords) { if (type.ToLower().Equals(keyword)) { Type t = keyword.GetType(); } } return(false); }
public Type GetVariableType(string type) { SkorkKeyword sk = new SkorkKeyword(); int i = 4; foreach (string keyword in sk.Keywords) { if (type.ToLower().Equals(keyword)) { Type t = GetType(type.ToLower()); return(t); } } return(null); }
/// <summary> /// <para>Checks if a string follows skork naming conventions.</para> /// </summary> /// <param name="identifier">The identifier to check if its valid</param> /// <returns>Returns 0 if the identifier follows the conventions, else an /// int refering to how it failed.</returns> public int IsValidIdentifier(string identifier) { int startInside = 10; string invalidChars = "1234567890!@#$%^&*()-+=`~/,.<>;':[]{}\\|?\" "; char[] invalidStart = invalidChars.ToCharArray(); char[] invalidInside = invalidChars.Substring(startInside, invalidChars.Length - startInside).ToCharArray(); const int charLimit = 25; Util u = new Util(); // Checks if the identifiers first character starts with any character in invalidStart if (identifier.Substring(0, 1).IndexOfAny(invalidStart) >= 0) { return(1); } // Checks if the identifier contains invalidInside characters after position 0. if (identifier.IndexOfAny(invalidInside) >= 0) { return(2); } // Checks if the identifier is greater or equal to the charLimit if (identifier.Length > charLimit) { return(3); } // Checks if the identifier is a keyword. SkorkKeyword sk = new SkorkKeyword(); foreach (string keyword in sk.Keywords) { if (identifier.ToLower().Equals(keyword)) { return(4); } } return(0); }
// A line is valid if it contains a keyword or variable name or comment. // int\hi\=\5; private string GetCodeLine(string line) { string codeLine = string.Empty; SkorkKeyword sk = new SkorkKeyword(); const char bs = '\\'; if (line.Contains(";")) { foreach (string keyword in sk.Keywords) { if (line.Contains(keyword)) { line = line.Trim(); } } } return(codeLine); }