01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08:
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package antlr;
21:
22: import antlr.collections.AST;
23: import antlr.collections.impl.BitSet;
24:
25: /**
26: *
27: * @author gorrus
28: */
29: public class TreeParserNoEx extends TreeParser {
30:
31: /** Creates a new instance of TreeParserNoEx */
32: public TreeParserNoEx() {
33: super ();
34: }
35:
36: protected void match(AST t, int ttype) {
37: //System.out.println("match("+ttype+"); cursor is "+t);
38: if (t == null || t == ASTNULL || t.getType() != ttype) {
39: if (inputState.guessing == 0) {
40: matchException = new MismatchedTokenException(
41: getTokenNames(), t, ttype, false);
42: }
43: matchError = true;
44: } /*else {
45: matchError = false;
46: }*/
47: }
48:
49: public void match(AST t, BitSet b) {
50: if (t == null || t == ASTNULL || !b.member(t.getType())) {
51: if (inputState.guessing == 0) {
52: matchException = new MismatchedTokenException(
53: getTokenNames(), t, b, false);
54: }
55: matchError = true;
56: } /*else {
57: matchError = false;
58: }*/
59: }
60:
61: protected void matchNot(AST t, int ttype) {
62: if (t == null || t == ASTNULL || t.getType() == ttype) {
63: if (inputState.guessing == 0) {
64: matchException = new MismatchedTokenException(
65: getTokenNames(), t, ttype, true);
66: }
67: matchError = true;
68: } /*else {
69: matchError = false;
70: }*/
71: }
72: }
|