Search code examples
c++boost-spirit

Failing to parse correctly when using Boost.Spirit


I am working on a programming language (full project here) implemented using Boost.Spirit, and I am struggling with the following problem. I have the following declaration for a function (line 77 in this file):

function_body_rule %=
  identifier_rule
  >> lit(L":=")
  >> lit(L"(")
  >> -parameter_declaration_rule % ','
  >> lit(L")")
  //>> lit(L"->") // epic fail if you uncomment this
  >> type_specification_rule
  >> lit(L"{")
  >> *(assignment_statement_rule)
  >> lit(L"}");

At some point, it simply has two tokens one after another. If I uncomment the second token, my function is no longer parsed correctly when I type in the correct sequence. If I comment the token, everything is fine (though I obviously cannot include ->).

Can you help me figure out what's going on?


Solution

  • Found the answer - the keyboard input rewrote the dash into a − (minus).