KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > ParsecErrorExpecting


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Feb 24, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.parsec;
15
16 /**
17  * Represent an "expecting" error.
18  * It works with MergedParsecError to implement laziness.
19  * Zephyr Business Solutions Corp.
20  *
21  * @author Ben Yu
22  *
23  */

24 final class ParsecErrorExpecting extends AbstractParsecError {
25   ParsecError render() {
26     return err.render().setExpecting(s).render();
27   }
28
29   AbstractParsecError setExpecting(String JavaDoc s) {
30     return new ParsecErrorExpecting(noMerge(), getIndex(), getPrecedence(),
31         getException(), err, s);
32   }
33   private final AbstractParsecError err;
34   private final String JavaDoc s;
35
36   ParsecErrorExpecting(boolean nomerge, int at, int pred, Object JavaDoc exception,
37       final AbstractParsecError err, final String JavaDoc s) {
38     super(nomerge, at, pred, exception);
39     this.err = err;
40     this.s = s;
41   }
42 }
43
Popular Tags