Menu

#46 parsing assignment in loop .. end loop

0.8.2
open
5
2005-02-15
2005-02-15
No

The parser has problems with an assignment inside a loop.

Changing

LOOP
baz := NULL;
NULL;
END LOOP;

to

WHILE TRUE LOOP
baz := NULL;
NULL;
END LOOP;

makes the problem goes away.

PLDoc version: 0.8.2
Parsing file ./test.pld ...
Error parsing line 23, column 1
Last consumed token: ";"
net.sourceforge.pldoc.parser.ParseException:
Encountered "END" at line 23, column 1.
Was expecting one of:
<EOF>
"COMMENT" ...
"CREATE" ...
"EXECUTE" ...
"ON" ...
"PACKAGE" ...
"PUBLIC" ...
"TO" ...
<IDENTIFIER> ...
<STRING_LITERAL> ...
"/" ...
"(" ...
")" ...

at
net.sourceforge.pldoc.parser.PLSQLParser.generateParseException(PLSQLParser.java:14260)
at
net.sourceforge.pldoc.parser.PLSQLParser.jj_consume_token(PLSQLParser.java:14123)
at
net.sourceforge.pldoc.parser.PLSQLParser.input(PLSQLParser.java:1196)
at net.sourceforge.pldoc.PLDoc.run(PLDoc.java:148)
at net.sourceforge.pldoc.PLDoc.main(PLDoc.java:72)

Discussion

  • John Vandenberg

    John Vandenberg - 2005-02-16

    test case

     
  • John Vandenberg

    John Vandenberg - 2005-02-16

    Logged In: YES
    user_id=108686

    It looks like the following syntax in statement() is the
    cause of the problem.

    // assignment
    LOOKAHEAD(qualifiedName()[(expression())] ":=")
    qualifiedName()[(expression())] ":=" expression() ";" |

    Im not sure why the optional expression() is permitted
    before the ':=' (these lines of code date back to v1.1 of
    the current file, and v1.5 of sources/Productions.jj) --
    anyway, changing assignment to the following simple rule
    works for me.

    // assignment
    LOOKAHEAD(qualifiedName() ":=")
    qualifiedName() ":=" expression() ";" |

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.