how to recoganize a url pattern ? #4828
Replies: 2 comments 2 replies
-
"token recognition error" says that it can't tokenize the input. You define the grammar almost entirely as a lexer grammar, but didn't take into account how Antlr lexers work:
So, either you need to write this as a collection of parser rules (see url grammar), or define one non-fragment lexer rule called "URL" and have all other lexer rules "fragment". "fragment" means "don't produce a token for this rule ever." |
Beta Was this translation helpful? Give feedback.
-
Look at the top-left where it says "Lexer Parser Sample". Click on "Lexer" to switch the left panel to the lexer grammar. Select all the text and delete the old lexer grammar as it has nothing to do with your "url.g4" combined grammar. Switch back to the "Parser" grammar and make sure it's OK. Then, click on the "run". |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have tried this
and the start rule is

url
, with the inputhttp://www.google.com
, but I got thiswhat ??
Beta Was this translation helpful? Give feedback.
All reactions