mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Allow underscores, dashes, and digits in identifiers
This commit is contained in:
@@ -48,19 +48,32 @@ partial class Lexer
|
||||
break;
|
||||
|
||||
case "TYPE":
|
||||
var typePrefixResult = WordText.Token()(input);
|
||||
var typePrefixResult = Identifier.Token()(input);
|
||||
input = typePrefixResult.Remainder;
|
||||
if (!typePrefixResult.WasSuccessful)
|
||||
return Result.Failure<IImport>(input, "Invalid type import", ["Expected a valid namespace prefix"]);
|
||||
|
||||
input = Parse.Char(':')(input).Remainder;
|
||||
var typeNamespaceDelimitterResult = Parse.Char(':')(input);
|
||||
input = typeNamespaceDelimitterResult.Remainder;
|
||||
|
||||
var typeNameResult = WordText(input);
|
||||
input = typeNameResult.Remainder;
|
||||
if (!typeNameResult.WasSuccessful)
|
||||
return Result.Failure<IImport>(input, "Invalid type import", ["Expected a valid type name"]);
|
||||
string typeName, typePrefix;
|
||||
if (typeNamespaceDelimitterResult.WasSuccessful)
|
||||
{
|
||||
var typeNameResult = Identifier(input);
|
||||
input = typeNameResult.Remainder;
|
||||
if (!typeNameResult.WasSuccessful)
|
||||
return Result.Failure<IImport>(input, "Invalid type import", ["Expected a valid type name"]);
|
||||
|
||||
import = new TypeImport(typePrefixResult.Value, typeNameResult.Value);
|
||||
typePrefix = typePrefixResult.Value;
|
||||
typeName = typeNameResult.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
typePrefix = null;
|
||||
typeName = typePrefixResult.Value;
|
||||
}
|
||||
|
||||
import = new TypeImport(typePrefix, typeName);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user