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.impl.BitSet;
23:
24: /**
25: * The same as LLkParser but no recognition exception thrown
26: * @author gorrus
27: */
28: public class LLkParserNoEx extends LLkParser {
29: public LLkParserNoEx(int k_) {
30: super (k_);
31: }
32:
33: public LLkParserNoEx(ParserSharedInputState state, int k_) {
34: super (state, k_);
35: }
36:
37: public LLkParserNoEx(TokenBuffer tokenBuf, int k_) {
38: super (tokenBuf, k_);
39: }
40:
41: public LLkParserNoEx(TokenStream lexer, int k_) {
42: super (lexer, k_);
43: }
44:
45: public void match(int t) {
46: if (LA(1) == t) {
47: consume();
48: //matchError=false;
49: } else {
50: if (inputState.guessing == 0) {
51: matchException = new MismatchedTokenException(
52: tokenNames, LT(1), t, false, getFilename());
53: }
54: matchError = true;
55: }
56: }
57:
58: public void match(BitSet b) {
59: if (b.member(LA(1))) {
60: consume();
61: //matchError=false;
62: } else {
63: if (inputState.guessing == 0) {
64: matchException = new MismatchedTokenException(
65: tokenNames, LT(1), b, false, getFilename());
66: }
67: matchError = true;
68: }
69: }
70:
71: public void matchNot(int t) {
72: if (LA(1) != t) {
73: consume();
74: //matchError=false;
75: } else {
76: if (inputState.guessing == 0) {
77: matchException = new MismatchedTokenException(
78: tokenNames, LT(1), t, true, getFilename());
79: }
80: matchError = true;
81: }
82: }
83: }
|