PageRenderTime 20ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseError.java

#
Java | 63 lines | 25 code | 10 blank | 28 comment | 0 complexity | 7c70d3334bdc1f3408db77d60ad5d4bd MD5 | raw file
 1/**
 2 * Licensed to the Apache Software Foundation (ASF) under one
 3 * or more contributor license agreements.  See the NOTICE file
 4 * distributed with this work for additional information
 5 * regarding copyright ownership.  The ASF licenses this file
 6 * to you under the Apache License, Version 2.0 (the
 7 * "License"); you may not use this file except in compliance
 8 * with the License.  You may obtain a copy of the License at
 9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.hive.ql.parse;
20
21import org.antlr.runtime.BaseRecognizer;
22import org.antlr.runtime.RecognitionException;
23
24/*
25 * SemanticException.java
26 *
27 * Created on April 1, 2008, 1:20 PM
28 *
29 * To change this template, choose Tools | Template Manager
30 * and open the template in the editor.
31 */
32
33/**
34 *
35 */
36public class ParseError {
37  private final BaseRecognizer br;
38  private final RecognitionException re;
39  private final String[] tokenNames;
40
41  ParseError(BaseRecognizer br, RecognitionException re, String[] tokenNames) {
42    this.br = br;
43    this.re = re;
44    this.tokenNames = tokenNames;
45  }
46
47  BaseRecognizer getBaseRecognizer() {
48    return br;
49  }
50
51  RecognitionException getRecognitionException() {
52    return re;
53  }
54
55  String[] getTokenNames() {
56    return tokenNames;
57  }
58
59  String getMessage() {
60    return br.getErrorHeader(re) + " " + br.getErrorMessage(re, tokenNames);
61  }
62
63}