Debian Codegraph @

rhino/src/org/mozilla/javascript/ast/ErrorNode.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 package org.mozilla.javascript.ast;
8
9 import org.mozilla.javascript.Token;
10
11 /**
12 * AST node representing a parse error or a warning. Node type is
13 * {@link Token#ERROR}.<p>
14 */
15 public class ErrorNode extends AstNode {
16
17 private String message;
18
19 {
20 type = Token.ERROR;
21 }
22
23 public ErrorNode() {
24 }
25
26 public ErrorNode(int pos) {
27 super(pos);
28 }
29
30 public ErrorNode(int pos, int len) {
31 super(pos, len);
32 }
33
34 /**
35 * Returns error message key
36 */
37 public String getMessage() {
38 return message;
39 }
40
41 /**
42 * Sets error message key
43 */
44 public void setMessage(String message) {
45 this.message = message;
46 }
47
48 @Override
49 public String toSource(int depth) {
50 return "";
51 }
52
53 /**
54 * Error nodes are not visited during normal visitor traversals,
55 * but comply with the {@link AstNode#visit} interface.
56 */
57 @Override
58 public void visit(NodeVisitor v) {
59 v.visit(this);
60 }
61 }