Skip to content

Bug: cannot parse function name ending with number #27

@vvvbit

Description

@vvvbit

Hello. I found that parser cannot properly parse function names ending with number like f1() or test5(). It adds extra token * between function name and opening "(".
so list of tokens looks like: [f1, , (, )] [test5,,(,)]

Here is my correction for method private List Lexer(string expr)

if (ch == '(') {
   if (i != 0 && (char.IsDigit(expr[i - 1]) || expr[i - 1] == ')')) {
      //correction start
     if (expr[i-1] == ')'||!LocalFunctions.Keys.Contains(tokens[tokens.Count-1])) {
         tokens.Add("*");
     }
     //correction end
     tokens.Add("(");
   }
   else {
      tokens.Add("(");
   }
}
else {
    tokens.Add(ch.ToString());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions