How to match Unicode characters in antlr

I am trying to highlight all the tokens in the text and should match all Ascii and Unicode characters, so here is how I laid them out.

fragment CHAR     :  ('A'..'Z') | ('a'..'z');
fragment DIGIT    :  ('0'..'9');
fragment UNICODE  :  '\u0000'..'\u00FF';

Now, if I write my token rule as:

TOKEN  :  (CHAR|DIGIT|UNICODE)+;

I get "The solution can match an input, for example," A ".." Z ", using several alternatives: 1, 3 As a result, alternative 3 was disabled for this input" "The solution can match an input, for example," 0 ".." 9 " using several alternatives: 2, 3 As a result, alternative 3 was disabled for this input "

And nothing happens: And also, if I write it as

TOKEN  :  (UNICODE)+;

Nothing matches.

Is there any way to do this.

+5
2

, , Unicode, , charvocabulary, , char Unicode 0 FFFE

options
{
charVocabulary='\u0000'..'\uFFFE';
}

options
{
charVocabulary = '\3'..'\377';
}

, . , ascii 'A'..'Z', Unicode, , : '\u0080'..'\ufffe'

+5

, TOKEN: (UNICODE)+ .

, Java, , .

, .

, "". BNF- Java, BNF , ,

identifier 
  ::= "a..z,$,_" { "a..z,$,_,0..9,unicode character over 00C0" } 
+5

All Articles