Flee
Flee copied to clipboard
Umlaut in variable name
If there is an umlaut in the variable name a syntax error is thrown:
Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.ParseException: 'unexpected character 'ö', on line: 1 column: 4'
Here is the unit test for it:
[Theory]
[InlineData("Motörhead", true)]
public void ParseWithEnablerList(string expression, object expected)
{
// Arrange
ExpressionContext parser = new ExpressionContext();
parser.Variables.Add("Motörhead", true);
IGenericExpression<bool> e = parser.CompileGeneric<bool>(expression);
// Act
bool value = e.Evaluate();
// Assert
value.Should().Be((bool)expected);
}
Grammar for variables is defined by: IDENTIFIER = <<[a-z_]\w*>>
so the first character must be a-z or underscore, and subsequent characters must match RegEx "word" characters", which unfortunately does not include a number of accented characters.