I have a lexer, which supports only English. Here is how a identifier is defined:
let first_latin_identifier_character = [%sedlex.regexp? ('a'..'z') | ('A'..'Z') ]
let subsequent_latin_identifier_character = [%sedlex.regexp? first_latin_identifier_character | '\x5F' (* underscore *) | decimal_digit]
let latin_identifier = [%sedlex.regexp? first_latin_identifier_character, (Star subsequent_latin_identifier_character)]
let lex_identifier = [%sedlex.regexp? latin_identifier]
Now I would like to support foreign languages such as French, Spanish, German and Chinese, I tried to add cn to first_latin_identifier_character and expected it would support Chinese:
let first_latin_identifier_character = [%sedlex.regexp? ('a'..'z') | ('A'..'Z') | cn]
...
I have a lexer, which supports only English. Here is how a identifier is defined:
Now I would like to support foreign languages such as French, Spanish, German and Chinese, I tried to add
cn
tofirst_latin_identifier_character
and expected it would support Chinese:Then, the compilation returned:
Does anyone know how to make it work?