Skip to content

Defining identifier charsets

amomra edited this page Apr 20, 2015 · 2 revisions

Defining identifier character sets

Sometimes it is necessary to change the character sets that are used for token identifiers in order to avoid conflicts. The parser uses three different character sets.

  • The name character set, is used for:
    • function identifiers
    • variable identifiers
    • constant identifiers
  • The operator character set is used for:
    • binary operator identifiers
    • postfix operator identifiers
  • The Infix operator charset is used for infix operator identifiers only

When using the default implementation directly you can skip this section.

parser.NameChars = "0123456789_" +
                   "abcdefghijklmnopqrstuvwxyz" +
                   "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
parser.OprtChars = "abcdefghijklmnopqrstuvwxyz" +
                   "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                   "+-*^/?<>=#!$%&|~'_";
parser.InfixOprtChars = "/+-*^?<>=#!$%&|~'_";
Clone this wiki locally