ShaderLang: Improve lexer
This commit is contained in:
parent
da81a5b871
commit
5598487e87
|
|
@ -100,6 +100,7 @@ namespace Nz::ShaderLang
|
||||||
{
|
{
|
||||||
if (Peek() == '>')
|
if (Peek() == '>')
|
||||||
{
|
{
|
||||||
|
currentPos++;
|
||||||
tokenType = TokenType::FunctionReturn;
|
tokenType = TokenType::FunctionReturn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +226,10 @@ namespace Nz::ShaderLang
|
||||||
{
|
{
|
||||||
char next = Peek();
|
char next = Peek();
|
||||||
if (next == '[')
|
if (next == '[')
|
||||||
|
{
|
||||||
|
currentPos++;
|
||||||
tokenType = TokenType::OpenAttribute;
|
tokenType = TokenType::OpenAttribute;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
tokenType = TokenType::OpenSquareBracket;
|
tokenType = TokenType::OpenSquareBracket;
|
||||||
|
|
||||||
|
|
@ -236,7 +240,10 @@ namespace Nz::ShaderLang
|
||||||
{
|
{
|
||||||
char next = Peek();
|
char next = Peek();
|
||||||
if (next == ']')
|
if (next == ']')
|
||||||
|
{
|
||||||
|
currentPos++;
|
||||||
tokenType = TokenType::ClosingAttribute;
|
tokenType = TokenType::ClosingAttribute;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
tokenType = TokenType::ClosingSquareBracket;
|
tokenType = TokenType::ClosingSquareBracket;
|
||||||
|
|
||||||
|
|
@ -255,10 +262,7 @@ namespace Nz::ShaderLang
|
||||||
case '(': tokenType = TokenType::OpenParenthesis; break;
|
case '(': tokenType = TokenType::OpenParenthesis; break;
|
||||||
case ')': tokenType = TokenType::ClosingParenthesis; break;
|
case ')': tokenType = TokenType::ClosingParenthesis; break;
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
}
|
|
||||||
|
|
||||||
if (!tokenType)
|
|
||||||
{
|
{
|
||||||
if (IsAlphaNum(c))
|
if (IsAlphaNum(c))
|
||||||
{
|
{
|
||||||
|
|
@ -275,6 +279,11 @@ namespace Nz::ShaderLang
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tokenType = it->second;
|
tokenType = it->second;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw UnrecognizedToken{};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue