I am very new to ANTLR, trying to parse a simple PL/SQL function. My apologies if this is a silly question.
function MyFunc return boolean is
begin
IF :USER_ID_P IS NULL THEN
:USER_ID_P := 'PUBLIC';
END IF;
return (TRUE);
end;
Grammar excerpt that is supposed to catch it:
atom
: variable_or_function_call ( PERCENT attribute )?
| SQL PERCENT attribute
| string_literal
| numeric_atom
| boolean_atom
| NULL
| LPAREN expression RPAREN
;
string_literal
: QUOTED_STRING
;
QUOTED_STRING
: ( 'n' )? '\'' ( '\'\'' | ~('\'') )* '\''
;
It gets to the "atom" rule and then gives this error:
NoViableAltException: line 6:0 no viable alternative for input 'END'
The string gets picked up if I add the following to the "atom" rule:
| '\'PUBLIC\''
string_literal
: the interpreter from ANTLRWorks is rather buggy, to put it mildly. The debugger works great, however. – Bart KiersRun->Debug
, orCTRL+D
), not the interpreter. – Bart Kiers