2

I'm fairly new to Antlr and I have a requirement where I need to parse characters like ÿ, ä, ë, û etc using Antlr and the lexer rule that I've written is

SPECIAL_CHARATERS : 'ÿ' | 'ä' | 'ë' | 'ö' | 'û' ;

and used it in parser rule like

special: SPECIAL_CHARATERS? ;

but it is not recognizing the characters and throwing

line 1:10 token recognition error at: 'ÿ'

Is there any way I can parse these characters?

Edit1: I'm trying to parse a string that contains these special characters and As we know Java String is internally always encoded in UTF-16 how can I parse these characters? (the question that was asked before(marked this as duplicate of) is parsing an input File, not a string)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Srikar
  • 351
  • 5
  • 16

0 Answers0