Flee icon indicating copy to clipboard operation
Flee copied to clipboard

Umlaut in variable name

Open Suplanus opened this issue 5 years ago • 1 comments

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);
}

Suplanus avatar Apr 14 '20 09:04 Suplanus

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.

hunkydoryrepair avatar Mar 26 '21 04:03 hunkydoryrepair