parsing
authorMarek Fukala <mfukala@netbeans.org>
Mon, 14 Jan 2013 15:49:16 +0100
changeset 17924d8da262b50db
parent 17923 51e93e0cfb7a
child 17925 a70237790a41
parsing
o.n.antlr.editor/build.xml
o.n.antlr.editor/nbproject/project.xml
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AbstractParseTreeNode.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrCslLanguage.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrStructureScanner.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenId.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/CommonTokenUtil.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ExtANTLRv3Lexer.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrLexer.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrParser.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrParserResult.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbParseTreeBuilder.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/Node.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeType.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeUtil.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeVisitor.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ProblemDescription.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/RootNode.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/RuleNode.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/TokenNode.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Lexer.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Parser.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.java
o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.tokens
o.n.antlr.editor/test/unit/src/org/netbeans/modules/antlr/editor/NbAntlrParserTest.java
     1.1 --- a/o.n.antlr.editor/build.xml	Mon Jan 14 13:28:06 2013 +0100
     1.2 +++ b/o.n.antlr.editor/build.xml	Mon Jan 14 15:49:16 2013 +0100
     1.3 @@ -18,6 +18,19 @@
     1.4                  <pathelement location="${antlr.jar}"/>
     1.5              </classpath>
     1.6          </java>
     1.7 +        
     1.8 +        <java classname="org.antlr.Tool" fork="true" failonerror="true">
     1.9 +            <!-- use -debug option so the generated parser allows to register an DebugEventListener and hence allow to build a parse tree -->
    1.10 +            <arg value="-debug"/> 
    1.11 +            <arg value="-verbose"/>
    1.12 +            <arg value="-o"/>
    1.13 +            <arg path="src/org/netbeans/modules/antlr/editor/gen"/>
    1.14 +            <arg path="src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g"/>                
    1.15 +            <classpath>
    1.16 +                <pathelement path="${classpath}"/>
    1.17 +                <pathelement location="${antlr.jar}"/>
    1.18 +            </classpath>
    1.19 +        </java>
    1.20      </target>
    1.21      
    1.22  </project>
     2.1 --- a/o.n.antlr.editor/nbproject/project.xml	Mon Jan 14 13:28:06 2013 +0100
     2.2 +++ b/o.n.antlr.editor/nbproject/project.xml	Mon Jan 14 15:49:16 2013 +0100
     2.3 @@ -32,6 +32,15 @@
     2.4                      </run-dependency>
     2.5                  </dependency>
     2.6                  <dependency>
     2.7 +                    <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
     2.8 +                    <build-prerequisite/>
     2.9 +                    <compile-dependency/>
    2.10 +                    <run-dependency>
    2.11 +                        <release-version>1</release-version>
    2.12 +                        <specification-version>1.29</specification-version>
    2.13 +                    </run-dependency>
    2.14 +                </dependency>
    2.15 +                <dependency>
    2.16                      <code-name-base>org.netbeans.modules.lexer</code-name-base>
    2.17                      <build-prerequisite/>
    2.18                      <compile-dependency/>
     3.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g	Mon Jan 14 13:28:06 2013 +0100
     3.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g	Mon Jan 14 15:49:16 2013 +0100
     3.3 @@ -77,10 +77,10 @@
     3.4  }
     3.5  
     3.6  @lexer::header {
     3.7 -package org.netbeans.antlr.editor.gen;
     3.8 +package org.netbeans.modules.antlr.editor.gen;
     3.9  }
    3.10  @header {
    3.11 -package org.netbeans.antlr.editor.gen;
    3.12 +package org.netbeans.modules.antlr.editor.gen;
    3.13  }
    3.14  @members {
    3.15  	int gtype;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g	Mon Jan 14 15:49:16 2013 +0100
     4.3 @@ -0,0 +1,275 @@
     4.4 +/*
     4.5 + [The "BSD licence"]
     4.6 + Copyright (c) 2005-2007 Terence Parr
     4.7 + All rights reserved.
     4.8 +
     4.9 + Redistribution and use in source and binary forms, with or without
    4.10 + modification, are permitted provided that the following conditions
    4.11 + are met:
    4.12 + 1. Redistributions of source code must retain the above copyright
    4.13 +    notice, this list of conditions and the following disclaimer.
    4.14 + 2. Redistributions in binary form must reproduce the above copyright
    4.15 +    notice, this list of conditions and the following disclaimer in the
    4.16 +    documentation and/or other materials provided with the distribution.
    4.17 + 3. The name of the author may not be used to endorse or promote products
    4.18 +    derived from this software without specific prior written permission.
    4.19 +
    4.20 + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    4.21 + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    4.22 + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    4.23 + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    4.24 + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    4.25 + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    4.26 + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    4.27 + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    4.28 + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    4.29 + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    4.30 +*/
    4.31 +
    4.32 +/** ANTLR v3 tree grammar to walk trees created by ANTLRv3.g */
    4.33 +tree grammar ANTLRv3Tree;
    4.34 +
    4.35 +options {
    4.36 +	tokenVocab = ANTLRv3;
    4.37 +	ASTLabelType = CommonTree;
    4.38 +}
    4.39 +
    4.40 +@header {
    4.41 +package org.netbeans.modules.antlr.editor.gen;
    4.42 +}
    4.43 +
    4.44 +grammarDef
    4.45 +    :   ^( grammarType ID DOC_COMMENT? optionsSpec? tokensSpec? attrScope* action* rule+ )
    4.46 +    ;
    4.47 +
    4.48 +grammarType
    4.49 +	:	LEXER_GRAMMAR
    4.50 +    |	PARSER_GRAMMAR
    4.51 +    |	TREE_GRAMMAR
    4.52 +    |	COMBINED_GRAMMAR
    4.53 +    ;
    4.54 +
    4.55 +tokensSpec
    4.56 +	:	^(TOKENS tokenSpec+)
    4.57 +	;
    4.58 +
    4.59 +tokenSpec
    4.60 +	:	^('=' TOKEN_REF STRING_LITERAL)
    4.61 +	|	^('=' TOKEN_REF CHAR_LITERAL)
    4.62 +	|	TOKEN_REF
    4.63 +	;
    4.64 +
    4.65 +attrScope
    4.66 +	:	^('scope' ID ACTION)
    4.67 +	;
    4.68 +
    4.69 +action
    4.70 +	:	^('@' ID ID ACTION)
    4.71 +	|	^('@' ID ACTION)
    4.72 +	;
    4.73 +
    4.74 +optionsSpec
    4.75 +	:	^(OPTIONS option+)
    4.76 +	;
    4.77 +
    4.78 +option
    4.79 +    :   ^('=' ID optionValue)
    4.80 + 	;
    4.81 + 	
    4.82 +optionValue
    4.83 +    :   ID
    4.84 +    |   STRING_LITERAL
    4.85 +    |   CHAR_LITERAL
    4.86 +    |   INT
    4.87 +    ;
    4.88 +
    4.89 +rule
    4.90 +	:	^( RULE ID modifier? (^(ARG ARG_ACTION))? (^(RET ARG_ACTION))?
    4.91 +	       optionsSpec? ruleScopeSpec? ruleAction*
    4.92 +	       altList
    4.93 +	       exceptionGroup? EOR
    4.94 +	     )
    4.95 +	;
    4.96 +
    4.97 +modifier
    4.98 +	:	'protected'|'public'|'private'|'fragment'
    4.99 +	;
   4.100 +
   4.101 +/** Match stuff like @init {int i;} */
   4.102 +ruleAction
   4.103 +	:	^('@' ID ACTION)
   4.104 +	;
   4.105 +
   4.106 +throwsSpec
   4.107 +	:	^('throws' ID+)
   4.108 +	;
   4.109 +
   4.110 +ruleScopeSpec
   4.111 +	:	^('scope' ACTION)
   4.112 +	|	^('scope' ACTION ID+)
   4.113 +	|	^('scope' ID+)
   4.114 +	;
   4.115 +
   4.116 +block
   4.117 +    :   ^( BLOCK optionsSpec? (alternative rewrite)+ EOB )
   4.118 +    ;
   4.119 +
   4.120 +altList
   4.121 +    :   ^( BLOCK (alternative rewrite)+ EOB )
   4.122 +    ;
   4.123 +
   4.124 +alternative
   4.125 +    :   ^(ALT element+ EOA)
   4.126 +    |   ^(ALT EPSILON EOA)
   4.127 +    ;
   4.128 +
   4.129 +exceptionGroup
   4.130 +	:	exceptionHandler+ finallyClause?
   4.131 +	|	finallyClause
   4.132 +    ;
   4.133 +
   4.134 +exceptionHandler
   4.135 +    :    ^('catch' ARG_ACTION ACTION)
   4.136 +    ;
   4.137 +
   4.138 +finallyClause
   4.139 +    :    ^('finally' ACTION)
   4.140 +    ;
   4.141 +
   4.142 +element
   4.143 +	:	elementNoOptionSpec
   4.144 +	;
   4.145 +
   4.146 +elementNoOptionSpec
   4.147 +	:	^(('='|'+=') ID block)
   4.148 +	|	^(('='|'+=') ID atom)
   4.149 +	|	atom
   4.150 +	|	ebnf
   4.151 +	|   ACTION
   4.152 +	|   SEMPRED
   4.153 +	|	GATED_SEMPRED
   4.154 +	|   treeSpec
   4.155 +	;
   4.156 +
   4.157 +atom:   ^(('^'|'!') atom)
   4.158 +	|	range
   4.159 +	|	notSet
   4.160 +    |	^(RULE_REF ARG_ACTION)
   4.161 +    |	RULE_REF
   4.162 +    |   terminal
   4.163 +    ;
   4.164 +
   4.165 +notSet
   4.166 +	:	^('~' notTerminal)
   4.167 +	|	^('~' block)
   4.168 +	;
   4.169 +
   4.170 +treeSpec
   4.171 +	:	^(TREE_BEGIN element+)
   4.172 +	;
   4.173 +
   4.174 +/** Matches ENBF blocks (and token sets via block rule) */
   4.175 +ebnf
   4.176 +	:	^(SYNPRED block)
   4.177 +	|	SYN_SEMPRED
   4.178 +	|	^(ebnfSuffix block)
   4.179 +	|	block
   4.180 +	;
   4.181 +
   4.182 +range
   4.183 +	:	^(CHAR_RANGE CHAR_LITERAL CHAR_LITERAL)
   4.184 +	;
   4.185 +
   4.186 +terminal
   4.187 +    :   CHAR_LITERAL
   4.188 +    |	TOKEN_REF
   4.189 +    |	STRING_LITERAL
   4.190 +    |	^(TOKEN_REF ARG_ACTION)
   4.191 +    |	'.'
   4.192 +	;
   4.193 +
   4.194 +notTerminal
   4.195 +	:   CHAR_LITERAL
   4.196 +	|	TOKEN_REF
   4.197 +	|	STRING_LITERAL
   4.198 +	;
   4.199 +	
   4.200 +ebnfSuffix
   4.201 +	:	OPTIONAL
   4.202 +  	|	CLOSURE
   4.203 +   	|	POSITIVE_CLOSURE
   4.204 +	;
   4.205 +	
   4.206 +// R E W R I T E  S Y N T A X
   4.207 +
   4.208 +rewrite
   4.209 +	:	(^('->' SEMPRED rewrite_alternative))* ^('->' rewrite_alternative)
   4.210 +	|
   4.211 +	;
   4.212 +
   4.213 +rewrite_alternative
   4.214 +	:	rewrite_template
   4.215 +	|	rewrite_tree_alternative
   4.216 +   	|   ^(ALT EPSILON EOA)
   4.217 +	;
   4.218 +	
   4.219 +rewrite_tree_block
   4.220 +    :   ^(BLOCK rewrite_tree_alternative EOB)
   4.221 +    ;
   4.222 +
   4.223 +rewrite_tree_alternative
   4.224 +    :	^(ALT rewrite_tree_element+ EOA)
   4.225 +    ;
   4.226 +
   4.227 +rewrite_tree_element
   4.228 +	:	rewrite_tree_atom
   4.229 +	|	rewrite_tree
   4.230 +	|   rewrite_tree_block
   4.231 +	|   rewrite_tree_ebnf
   4.232 +	;
   4.233 +
   4.234 +rewrite_tree_atom
   4.235 +    :   CHAR_LITERAL
   4.236 +	|   TOKEN_REF
   4.237 +	|   ^(TOKEN_REF ARG_ACTION) // for imaginary nodes
   4.238 +    |   RULE_REF
   4.239 +	|   STRING_LITERAL
   4.240 +	|   LABEL
   4.241 +	|	ACTION
   4.242 +	;
   4.243 +
   4.244 +rewrite_tree_ebnf
   4.245 +	:	^(ebnfSuffix rewrite_tree_block)
   4.246 +	;
   4.247 +	
   4.248 +rewrite_tree
   4.249 +	:	^(TREE_BEGIN rewrite_tree_atom rewrite_tree_element* )
   4.250 +	;
   4.251 +
   4.252 +rewrite_template
   4.253 +	:   ^( TEMPLATE ID rewrite_template_args
   4.254 +		   (DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL)
   4.255 +		 )
   4.256 +	|	rewrite_template_ref
   4.257 +	|	rewrite_indirect_template_head
   4.258 +	|	ACTION
   4.259 +	;
   4.260 +
   4.261 +/** foo(a={...}, ...) */
   4.262 +rewrite_template_ref
   4.263 +	:	^(TEMPLATE ID rewrite_template_args)
   4.264 +	;
   4.265 +
   4.266 +/** ({expr})(a={...}, ...) */
   4.267 +rewrite_indirect_template_head
   4.268 +	:	^(TEMPLATE ACTION rewrite_template_args)
   4.269 +	;
   4.270 +
   4.271 +rewrite_template_args
   4.272 +	:	^(ARGLIST rewrite_template_arg+)
   4.273 +	|	ARGLIST
   4.274 +	;
   4.275 +
   4.276 +rewrite_template_arg
   4.277 +	:   ^(ARG ID ACTION)
   4.278 +	;
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AbstractParseTreeNode.java	Mon Jan 14 15:49:16 2013 +0100
     5.3 @@ -0,0 +1,122 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     5.8 + *
     5.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    5.10 + * Other names may be trademarks of their respective owners.
    5.11 + *
    5.12 + * The contents of this file are subject to the terms of either the GNU
    5.13 + * General Public License Version 2 only ("GPL") or the Common
    5.14 + * Development and Distribution License("CDDL") (collectively, the
    5.15 + * "License"). You may not use this file except in compliance with the
    5.16 + * License. You can obtain a copy of the License at
    5.17 + * http://www.netbeans.org/cddl-gplv2.html
    5.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    5.19 + * specific language governing permissions and limitations under the
    5.20 + * License.  When distributing the software, include this License Header
    5.21 + * Notice in each file and include the License file at
    5.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    5.23 + * particular file as subject to the "Classpath" exception as provided
    5.24 + * by Oracle in the GPL Version 2 section of the License file that
    5.25 + * accompanied this code. If applicable, add the following below the
    5.26 + * License Header, with the fields enclosed by brackets [] replaced by
    5.27 + * your own identifying information:
    5.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    5.29 + *
    5.30 + * If you wish your version of this file to be governed by only the CDDL
    5.31 + * or only the GPL Version 2, indicate your decision by adding
    5.32 + * "[Contributor] elects to include this software in this distribution
    5.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    5.34 + * single choice of license, a recipient has the option to distribute
    5.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    5.36 + * to extend the choice of license to its licensees as provided above.
    5.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    5.38 + * Version 2 license, then the option applies only if the new code is
    5.39 + * made subject to such option by the copyright holder.
    5.40 + *
    5.41 + * Contributor(s):
    5.42 + *
    5.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
    5.44 + */
    5.45 +package org.netbeans.modules.antlr.editor;
    5.46 +
    5.47 +import java.util.Collections;
    5.48 +import java.util.List;
    5.49 +import org.antlr.runtime.tree.ParseTree;
    5.50 +import org.antlr.runtime.tree.Tree;
    5.51 +
    5.52 +/**
    5.53 + *
    5.54 + * @author marekfukala
    5.55 + */
    5.56 +public abstract class AbstractParseTreeNode extends ParseTree implements Node {
    5.57 +
    5.58 +    Tree parent;
    5.59 +    
    5.60 +    private CharSequence source;
    5.61 +    
    5.62 +    public AbstractParseTreeNode(CharSequence source) {
    5.63 +        super(null);
    5.64 +        this.source = source;
    5.65 +    }
    5.66 +
    5.67 +    protected CharSequence getSource() {
    5.68 +        return source;
    5.69 +    }
    5.70 +
    5.71 +    @Override
    5.72 +    public CharSequence image() {
    5.73 +        return getSource().subSequence(from(), to());
    5.74 +    }
    5.75 +    
    5.76 +    public boolean deleteChild(AbstractParseTreeNode node) {
    5.77 +        if (children == null) {
    5.78 +            return false;
    5.79 +        }
    5.80 +        int childIndex = children.indexOf(node);
    5.81 +        if (childIndex == -1) {
    5.82 +            return false; //no such node
    5.83 +        }
    5.84 +
    5.85 +        return super.deleteChild(childIndex) != null;
    5.86 +    }
    5.87 +
    5.88 +    /** BaseTree doesn't track parent pointers. */
    5.89 +    @Override
    5.90 +    public Tree getParent() {
    5.91 +        return parent;
    5.92 +    }
    5.93 +
    5.94 +    @Override
    5.95 +    public void setParent(Tree t) {
    5.96 +        this.parent = t;
    5.97 +    }
    5.98 +
    5.99 +    @Override
   5.100 +    @SuppressWarnings(value="unchecked") //antlr 3.3 does not use generics
   5.101 +    public List<Node> children() {
   5.102 +        List ch = getChildren();
   5.103 +        return ch == null 
   5.104 +                ? Collections.<Node>emptyList() 
   5.105 +                : ch;
   5.106 +    }
   5.107 +
   5.108 +    @Override
   5.109 +    public Node parent() {
   5.110 +        return (Node)getParent();
   5.111 +    }
   5.112 +    
   5.113 +    @Override
   5.114 +    public String toString() {
   5.115 +        return new StringBuilder()
   5.116 +                .append(type())
   5.117 +                .append('(')
   5.118 +                .append(from())
   5.119 +                .append('-')
   5.120 +                .append(to())
   5.121 +                .append(')')
   5.122 +                .toString();
   5.123 +    }
   5.124 +
   5.125 +}
     6.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrCslLanguage.java	Mon Jan 14 13:28:06 2013 +0100
     6.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrCslLanguage.java	Mon Jan 14 15:49:16 2013 +0100
     6.3 @@ -43,8 +43,10 @@
     6.4  
     6.5  import org.netbeans.core.spi.multiview.MultiViewElement;
     6.6  import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
     6.7 +import org.netbeans.modules.csl.api.StructureScanner;
     6.8  import org.netbeans.modules.csl.spi.DefaultLanguageConfig;
     6.9  import org.netbeans.modules.csl.spi.LanguageRegistration;
    6.10 +import org.netbeans.modules.parsing.spi.Parser;
    6.11  import org.netbeans.modules.parsing.spi.indexing.PathRecognizerRegistration;
    6.12  import org.openide.filesystems.MIMEResolver;
    6.13  import org.openide.util.Lookup;
    6.14 @@ -89,4 +91,20 @@
    6.15          return Bundle.language_displaname();
    6.16      }
    6.17      
    6.18 +    @Override
    6.19 +    public Parser getParser() {
    6.20 +        return new NbAntlrParser();
    6.21 +    }
    6.22 +
    6.23 +    @Override
    6.24 +    public boolean hasStructureScanner() {
    6.25 +        return true;
    6.26 +    }
    6.27 +
    6.28 +    @Override
    6.29 +    public StructureScanner getStructureScanner() {
    6.30 +        return new AntlrStructureScanner();
    6.31 +    }
    6.32 +    
    6.33 +    
    6.34  }
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrStructureScanner.java	Mon Jan 14 15:49:16 2013 +0100
     7.3 @@ -0,0 +1,77 @@
     7.4 +/*
     7.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 + *
     7.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
     7.8 + *
     7.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    7.10 + * Other names may be trademarks of their respective owners.
    7.11 + *
    7.12 + * The contents of this file are subject to the terms of either the GNU
    7.13 + * General Public License Version 2 only ("GPL") or the Common
    7.14 + * Development and Distribution License("CDDL") (collectively, the
    7.15 + * "License"). You may not use this file except in compliance with the
    7.16 + * License. You can obtain a copy of the License at
    7.17 + * http://www.netbeans.org/cddl-gplv2.html
    7.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    7.19 + * specific language governing permissions and limitations under the
    7.20 + * License.  When distributing the software, include this License Header
    7.21 + * Notice in each file and include the License file at
    7.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    7.23 + * particular file as subject to the "Classpath" exception as provided
    7.24 + * by Oracle in the GPL Version 2 section of the License file that
    7.25 + * accompanied this code. If applicable, add the following below the
    7.26 + * License Header, with the fields enclosed by brackets [] replaced by
    7.27 + * your own identifying information:
    7.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    7.29 + *
    7.30 + * If you wish your version of this file to be governed by only the CDDL
    7.31 + * or only the GPL Version 2, indicate your decision by adding
    7.32 + * "[Contributor] elects to include this software in this distribution
    7.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.34 + * single choice of license, a recipient has the option to distribute
    7.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    7.36 + * to extend the choice of license to its licensees as provided above.
    7.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.38 + * Version 2 license, then the option applies only if the new code is
    7.39 + * made subject to such option by the copyright holder.
    7.40 + *
    7.41 + * Contributor(s):
    7.42 + *
    7.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
    7.44 + */
    7.45 +package org.netbeans.modules.antlr.editor;
    7.46 +
    7.47 +import java.util.Collections;
    7.48 +import java.util.List;
    7.49 +import java.util.Map;
    7.50 +import org.netbeans.modules.csl.api.OffsetRange;
    7.51 +import org.netbeans.modules.csl.api.StructureItem;
    7.52 +import org.netbeans.modules.csl.api.StructureScanner;
    7.53 +import org.netbeans.modules.csl.spi.ParserResult;
    7.54 +
    7.55 +/**
    7.56 + *
    7.57 + * @author marekfukala
    7.58 + */
    7.59 +public class AntlrStructureScanner implements StructureScanner {
    7.60 +
    7.61 +    @Override
    7.62 +    public List<? extends StructureItem> scan(ParserResult info) {
    7.63 +        NbAntlrParserResult result = (NbAntlrParserResult)info;
    7.64 +        
    7.65 +        
    7.66 +        
    7.67 +        return Collections.emptyList();
    7.68 +    }
    7.69 +
    7.70 +    @Override
    7.71 +    public Map<String, List<OffsetRange>> folds(ParserResult info) {
    7.72 +        return Collections.emptyMap();
    7.73 +    }
    7.74 +
    7.75 +    @Override
    7.76 +    public Configuration getConfiguration() {
    7.77 +        return null;
    7.78 +    }
    7.79 +    
    7.80 +}
     8.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenId.java	Mon Jan 14 13:28:06 2013 +0100
     8.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenId.java	Mon Jan 14 15:49:16 2013 +0100
     8.3 @@ -50,7 +50,7 @@
     8.4  import org.netbeans.api.lexer.TokenId;
     8.5  import org.netbeans.api.lexer.TokenSequence;
     8.6  import static org.netbeans.modules.antlr.editor.AntlrTokenIdCategory.*;
     8.7 -import org.netbeans.antlr.editor.gen.ANTLRv3Lexer;
     8.8 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
     8.9  
    8.10  /**
    8.11   * Token ids of CSS language
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/CommonTokenUtil.java	Mon Jan 14 15:49:16 2013 +0100
     9.3 @@ -0,0 +1,72 @@
     9.4 +/*
     9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 + *
     9.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     9.8 + *
     9.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    9.10 + * Other names may be trademarks of their respective owners.
    9.11 + *
    9.12 + * The contents of this file are subject to the terms of either the GNU
    9.13 + * General Public License Version 2 only ("GPL") or the Common
    9.14 + * Development and Distribution License("CDDL") (collectively, the
    9.15 + * "License"). You may not use this file except in compliance with the
    9.16 + * License. You can obtain a copy of the License at
    9.17 + * http://www.netbeans.org/cddl-gplv2.html
    9.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.19 + * specific language governing permissions and limitations under the
    9.20 + * License.  When distributing the software, include this License Header
    9.21 + * Notice in each file and include the License file at
    9.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    9.23 + * particular file as subject to the "Classpath" exception as provided
    9.24 + * by Oracle in the GPL Version 2 section of the License file that
    9.25 + * accompanied this code. If applicable, add the following below the
    9.26 + * License Header, with the fields enclosed by brackets [] replaced by
    9.27 + * your own identifying information:
    9.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    9.29 + *
    9.30 + * If you wish your version of this file to be governed by only the CDDL
    9.31 + * or only the GPL Version 2, indicate your decision by adding
    9.32 + * "[Contributor] elects to include this software in this distribution
    9.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.34 + * single choice of license, a recipient has the option to distribute
    9.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    9.36 + * to extend the choice of license to its licensees as provided above.
    9.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.38 + * Version 2 license, then the option applies only if the new code is
    9.39 + * made subject to such option by the copyright holder.
    9.40 + *
    9.41 + * Contributor(s):
    9.42 + *
    9.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
    9.44 + */
    9.45 +package org.netbeans.modules.antlr.editor;
    9.46 +
    9.47 +import org.antlr.runtime.CommonToken;
    9.48 +
    9.49 +/**
    9.50 + *
    9.51 + * @author marekfukala
    9.52 + */
    9.53 +public class CommonTokenUtil {
    9.54 +
    9.55 +    /**
    9.56 +     * Returns a pointer to the start and end of the token image in the
    9.57 +     * underlaying stream. The token.getStopIndex() points to the last character
    9.58 +     * of the token which is a bit confusing.
    9.59 +     *
    9.60 +     * Use this method to get CommonToken's boundaries instead of using the
    9.61 +     * getStart/StopIndex methods.
    9.62 +     *
    9.63 +     * @return two members array - arr[0] is the start offset, arr[1] is the end
    9.64 +     * offset
    9.65 +     */
    9.66 +    public static int[] getCommonTokenOffsetRange(CommonToken token) {
    9.67 +        if (token.getType() == CommonToken.EOF) {
    9.68 +            //"eof token" points at the end offset of the source, with zero length
    9.69 +            return new int[]{token.getStartIndex(), token.getStopIndex()};
    9.70 +        } else {
    9.71 +            return new int[]{token.getStartIndex(), token.getStopIndex() + 1};
    9.72 +        }
    9.73 +
    9.74 +    }
    9.75 +}
    10.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ExtANTLRv3Lexer.java	Mon Jan 14 13:28:06 2013 +0100
    10.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ExtANTLRv3Lexer.java	Mon Jan 14 15:49:16 2013 +0100
    10.3 @@ -41,11 +41,8 @@
    10.4   */
    10.5  package org.netbeans.modules.antlr.editor;
    10.6  
    10.7 -import java.util.ArrayList;
    10.8 -import java.util.List;
    10.9  import org.antlr.runtime.*;
   10.10 -import org.openide.util.NbBundle;
   10.11 -import org.netbeans.antlr.editor.gen.*;
   10.12 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   10.13  
   10.14  /**
   10.15   * Note: Funny aspect of the ANTLR lexer is that it doesn't create any kind of
    11.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrLexer.java	Mon Jan 14 13:28:06 2013 +0100
    11.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrLexer.java	Mon Jan 14 15:49:16 2013 +0100
    11.3 @@ -44,10 +44,10 @@
    11.4  package org.netbeans.modules.antlr.editor;
    11.5  
    11.6  import org.netbeans.api.lexer.Token;
    11.7 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
    11.8  import org.netbeans.spi.lexer.Lexer;
    11.9  import org.netbeans.spi.lexer.LexerRestartInfo;
   11.10  import org.netbeans.spi.lexer.TokenFactory;
   11.11 -import org.netbeans.antlr.editor.gen.ANTLRv3Lexer;
   11.12  
   11.13  /**
   11.14   * antlr lexer
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrParser.java	Mon Jan 14 15:49:16 2013 +0100
    12.3 @@ -0,0 +1,164 @@
    12.4 +/*
    12.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 + *
    12.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    12.8 + *
    12.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   12.10 + * Other names may be trademarks of their respective owners.
   12.11 + *
   12.12 + * The contents of this file are subject to the terms of either the GNU
   12.13 + * General Public License Version 2 only ("GPL") or the Common
   12.14 + * Development and Distribution License("CDDL") (collectively, the
   12.15 + * "License"). You may not use this file except in compliance with the
   12.16 + * License. You can obtain a copy of the License at
   12.17 + * http://www.netbeans.org/cddl-gplv2.html
   12.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.19 + * specific language governing permissions and limitations under the
   12.20 + * License.  When distributing the software, include this License Header
   12.21 + * Notice in each file and include the License file at
   12.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   12.23 + * particular file as subject to the "Classpath" exception as provided
   12.24 + * by Oracle in the GPL Version 2 section of the License file that
   12.25 + * accompanied this code. If applicable, add the following below the
   12.26 + * License Header, with the fields enclosed by brackets [] replaced by
   12.27 + * your own identifying information:
   12.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   12.29 + *
   12.30 + * If you wish your version of this file to be governed by only the CDDL
   12.31 + * or only the GPL Version 2, indicate your decision by adding
   12.32 + * "[Contributor] elects to include this software in this distribution
   12.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.34 + * single choice of license, a recipient has the option to distribute
   12.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   12.36 + * to extend the choice of license to its licensees as provided above.
   12.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   12.38 + * Version 2 license, then the option applies only if the new code is
   12.39 + * made subject to such option by the copyright holder.
   12.40 + *
   12.41 + * Contributor(s):
   12.42 + *
   12.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   12.44 + */
   12.45 +package org.netbeans.modules.antlr.editor;
   12.46 +
   12.47 +import java.io.PrintWriter;
   12.48 +import java.util.Collection;
   12.49 +import javax.swing.event.ChangeListener;
   12.50 +import org.antlr.runtime.ANTLRStringStream;
   12.51 +import org.antlr.runtime.CharStream;
   12.52 +import org.antlr.runtime.CommonTokenStream;
   12.53 +import org.antlr.runtime.RecognitionException;
   12.54 +import org.antlr.runtime.debug.ParseTreeBuilder;
   12.55 +import org.antlr.runtime.tree.CommonTree;
   12.56 +import org.antlr.runtime.tree.CommonTreeNodeStream;
   12.57 +import org.antlr.runtime.tree.Tree;
   12.58 +import org.netbeans.api.editor.mimelookup.MimeRegistration;
   12.59 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   12.60 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Parser;
   12.61 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Tree;
   12.62 +import org.netbeans.modules.csl.spi.ParserResult;
   12.63 +import org.netbeans.modules.parsing.api.Snapshot;
   12.64 +import org.netbeans.modules.parsing.api.Task;
   12.65 +import org.netbeans.modules.parsing.spi.ParseException;
   12.66 +import org.netbeans.modules.parsing.spi.Parser;
   12.67 +import org.netbeans.modules.parsing.spi.ParserFactory;
   12.68 +import org.netbeans.modules.parsing.spi.SourceModificationEvent;
   12.69 +
   12.70 +/**
   12.71 + *
   12.72 + * @author mfukala@netbeans.org
   12.73 + */
   12.74 +public class NbAntlrParser extends Parser {
   12.75 +
   12.76 +    private NbAntlrParserResult result;
   12.77 +
   12.78 +    public static NbAntlrParserResult parse(Snapshot snapshot) throws ParseException {
   12.79 +        if (snapshot == null) {
   12.80 +            return null;
   12.81 +        }
   12.82 +        CharSequence input = snapshot.getText();
   12.83 +
   12.84 +        try {
   12.85 +            ANTLRv3Lexer lex = new ANTLRv3Lexer(new ANTLRStringStream(input.toString()) {
   12.86 +                @Override
   12.87 +                public int LA(int i) {
   12.88 +                    if (i == 0) {
   12.89 +                        return 0; // undefined
   12.90 +                    }
   12.91 +                    if (i < 0) {
   12.92 +                        i++; // e.g., translate LA(-1) to use offset 0
   12.93 +                    }
   12.94 +
   12.95 +                    if ((p + i - 1) >= n) {
   12.96 +
   12.97 +                        return CharStream.EOF;
   12.98 +                    }
   12.99 +                    return Character.toUpperCase(data[p + i - 1]);
  12.100 +                }
  12.101 +            });
  12.102 +
  12.103 +            CommonTokenStream tokens = new CommonTokenStream(lex);
  12.104 +            NbParseTreeBuilder builder = new NbParseTreeBuilder(snapshot.getText());
  12.105 +            ANTLRv3Parser g = new ANTLRv3Parser(tokens, builder);
  12.106 +            g.grammarDef(); //parse
  12.107 +            
  12.108 +            return new NbAntlrParserResult(snapshot, builder.getTree());
  12.109 +        } catch (RecognitionException ex) {
  12.110 +            throw new ParseException(String.format("Error parsing %s snapshot.", snapshot), ex); //NOI18N
  12.111 +        }
  12.112 +    }
  12.113 +//
  12.114 +//    public static void dumpTree(Tree node) {
  12.115 +//        PrintWriter pw = new PrintWriter(System.out);
  12.116 +//        dumpTree(node, pw);
  12.117 +//        pw.flush();
  12.118 +//    }
  12.119 +//
  12.120 +//    public static void dumpTree(Tree node, PrintWriter pw) {
  12.121 +//        dump(node, 0, pw);
  12.122 +//
  12.123 +//    }
  12.124 +//
  12.125 +//    private static int x = 0;
  12.126 +//    
  12.127 +//    private static void dump(Tree tree, int level, PrintWriter pw) {
  12.128 +//        for (int i = 0; i < level; i++) {
  12.129 +//            pw.print("    ");
  12.130 +//        }
  12.131 +//        pw.print(x++ + tree.toString());
  12.132 +//        pw.println();
  12.133 +//        for (int i = 0; i < tree.getChildCount(); i++) {
  12.134 +//            Tree child = tree.getChild(i);
  12.135 +//            dump(child, level + 1, pw);
  12.136 +//        }
  12.137 +//    }
  12.138 +
  12.139 +    @Override
  12.140 +    public void parse(Snapshot snapshot, Task task, SourceModificationEvent event) throws ParseException {
  12.141 +        result = parse(snapshot);
  12.142 +    }
  12.143 +
  12.144 +    @Override
  12.145 +    public ParserResult getResult(Task task) throws ParseException {
  12.146 +        return result;
  12.147 +    }
  12.148 +
  12.149 +    @Override
  12.150 +    public void addChangeListener(ChangeListener changeListener) {
  12.151 +        //no-op
  12.152 +    }
  12.153 +
  12.154 +    @Override
  12.155 +    public void removeChangeListener(ChangeListener changeListener) {
  12.156 +        //no-op
  12.157 +    }
  12.158 +
  12.159 +    @MimeRegistration(mimeType = "text/antlr", service = ParserFactory.class)
  12.160 +    public static class Factory extends ParserFactory {
  12.161 +
  12.162 +        @Override
  12.163 +        public Parser createParser(Collection<Snapshot> snapshots) {
  12.164 +            return new NbAntlrParser();
  12.165 +        }
  12.166 +    }
  12.167 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrParserResult.java	Mon Jan 14 15:49:16 2013 +0100
    13.3 @@ -0,0 +1,117 @@
    13.4 +/*
    13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 + *
    13.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    13.8 + *
    13.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   13.10 + * Other names may be trademarks of their respective owners.
   13.11 + *
   13.12 + * The contents of this file are subject to the terms of either the GNU
   13.13 + * General Public License Version 2 only ("GPL") or the Common
   13.14 + * Development and Distribution License("CDDL") (collectively, the
   13.15 + * "License"). You may not use this file except in compliance with the
   13.16 + * License. You can obtain a copy of the License at
   13.17 + * http://www.netbeans.org/cddl-gplv2.html
   13.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   13.19 + * specific language governing permissions and limitations under the
   13.20 + * License.  When distributing the software, include this License Header
   13.21 + * Notice in each file and include the License file at
   13.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   13.23 + * particular file as subject to the "Classpath" exception as provided
   13.24 + * by Oracle in the GPL Version 2 section of the License file that
   13.25 + * accompanied this code. If applicable, add the following below the
   13.26 + * License Header, with the fields enclosed by brackets [] replaced by
   13.27 + * your own identifying information:
   13.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   13.29 + *
   13.30 + * If you wish your version of this file to be governed by only the CDDL
   13.31 + * or only the GPL Version 2, indicate your decision by adding
   13.32 + * "[Contributor] elects to include this software in this distribution
   13.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   13.34 + * single choice of license, a recipient has the option to distribute
   13.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   13.36 + * to extend the choice of license to its licensees as provided above.
   13.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   13.38 + * Version 2 license, then the option applies only if the new code is
   13.39 + * made subject to such option by the copyright holder.
   13.40 + *
   13.41 + * Contributor(s):
   13.42 + *
   13.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   13.44 + */
   13.45 +package org.netbeans.modules.antlr.editor;
   13.46 +
   13.47 +import java.util.Collections;
   13.48 +import java.util.List;
   13.49 +import java.util.Map;
   13.50 +import org.antlr.runtime.tree.CommonTree;
   13.51 +import org.netbeans.modules.csl.api.Error;
   13.52 +import org.netbeans.modules.csl.spi.ParserResult;
   13.53 +import org.netbeans.modules.parsing.api.Snapshot;
   13.54 +
   13.55 +/**
   13.56 + *
   13.57 + * @author marekfukala
   13.58 + */
   13.59 +public class NbAntlrParserResult extends ParserResult {
   13.60 +
   13.61 +    public static boolean IN_UNIT_TESTS = false;
   13.62 +    
   13.63 +    private Node parseTree;
   13.64 +    
   13.65 +    public NbAntlrParserResult(Snapshot snapshot, Node parseTree /*, List<ProblemDescription> diagnostics*/) {
   13.66 +        super(snapshot);
   13.67 +        assert parseTree != null;
   13.68 +        this.parseTree = parseTree;
   13.69 +//        this.diagnostics = diagnostics;
   13.70 +    }
   13.71 +
   13.72 +    @Override
   13.73 +    protected void invalidate() {
   13.74 +        //as CSL features uses the parser result out of the parsing task,
   13.75 +        //the invalidation needs to be disabled until fixed.
   13.76 +        
   13.77 +//        if(IN_UNIT_TESTS) {
   13.78 +//            return ; //some simplification - do not invalidate the result in unit tests
   13.79 +//        }
   13.80 +//        parseTree = null;
   13.81 +//        diagnostics = null;
   13.82 +    }
   13.83 +
   13.84 +    public Node getParseTree() {
   13.85 +        if(parseTree == null) {
   13.86 +            throw new IllegalStateException("Already invalidated parser result, you are likely trying to use it outside of the parsing task runnable!"); //NOI18N
   13.87 +        }
   13.88 +        return parseTree;
   13.89 +    }
   13.90 +    
   13.91 +//    /**
   13.92 +//     * Gets lexer / parser diagnostics w/o additional issues 
   13.93 +//     * possibly added by {@link ExtendedDiagnosticsProvider}.
   13.94 +//     */
   13.95 +//    public List<ProblemDescription> getParserDiagnostics() {
   13.96 +//        return diagnostics;
   13.97 +//    }
   13.98 +
   13.99 +    @Override
  13.100 +    public List<? extends Error> getDiagnostics() {
  13.101 +//        return ErrorsProviderQuery.getExtendedDiagnostics(this);
  13.102 +        return Collections.emptyList();
  13.103 +    }
  13.104 +    
  13.105 +//    public <T> T getProperty(Class<T> type) {
  13.106 +//        if(properties == null) {
  13.107 +//            return null;
  13.108 +//        } else {
  13.109 +//            return (T)properties.get(type);
  13.110 +//        }
  13.111 +//    }
  13.112 +//    
  13.113 +//    public <T> void setProperty(Class<T> type, T value) {
  13.114 +//        if(properties == null) {
  13.115 +//            properties = new HashMap();
  13.116 +//        }
  13.117 +//        properties.put(type, value);
  13.118 +//    }
  13.119 +    
  13.120 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbParseTreeBuilder.java	Mon Jan 14 15:49:16 2013 +0100
    14.3 @@ -0,0 +1,447 @@
    14.4 +/*
    14.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 + *
    14.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    14.8 + *
    14.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   14.10 + * Other names may be trademarks of their respective owners.
   14.11 + *
   14.12 + * The contents of this file are subject to the terms of either the GNU
   14.13 + * General Public License Version 2 only ("GPL") or the Common
   14.14 + * Development and Distribution License("CDDL") (collectively, the
   14.15 + * "License"). You may not use this file except in compliance with the
   14.16 + * License. You can obtain a copy of the License at
   14.17 + * http://www.netbeans.org/cddl-gplv2.html
   14.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.19 + * specific language governing permissions and limitations under the
   14.20 + * License.  When distributing the software, include this License Header
   14.21 + * Notice in each file and include the License file at
   14.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   14.23 + * particular file as subject to the "Classpath" exception as provided
   14.24 + * by Oracle in the GPL Version 2 section of the License file that
   14.25 + * accompanied this code. If applicable, add the following below the
   14.26 + * License Header, with the fields enclosed by brackets [] replaced by
   14.27 + * your own identifying information:
   14.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   14.29 + *
   14.30 + * If you wish your version of this file to be governed by only the CDDL
   14.31 + * or only the GPL Version 2, indicate your decision by adding
   14.32 + * "[Contributor] elects to include this software in this distribution
   14.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.34 + * single choice of license, a recipient has the option to distribute
   14.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   14.36 + * to extend the choice of license to its licensees as provided above.
   14.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   14.38 + * Version 2 license, then the option applies only if the new code is
   14.39 + * made subject to such option by the copyright holder.
   14.40 + *
   14.41 + * Contributor(s):
   14.42 + *
   14.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   14.44 + */
   14.45 +package org.netbeans.modules.antlr.editor;
   14.46 +
   14.47 +import java.util.Collection;
   14.48 +import java.util.List;
   14.49 +import java.util.Map;
   14.50 +import org.antlr.runtime.CommonToken;
   14.51 +import org.antlr.runtime.RecognitionException;
   14.52 +import org.antlr.runtime.Token;
   14.53 +import org.antlr.runtime.debug.BlankDebugEventListener;
   14.54 +
   14.55 +import java.util.Stack;
   14.56 +import java.util.ArrayList;
   14.57 +import java.util.Arrays;
   14.58 +import java.util.HashMap;
   14.59 +import java.util.LinkedHashSet;
   14.60 +import org.antlr.runtime.NoViableAltException;
   14.61 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   14.62 +import org.openide.util.NbBundle;
   14.63 +
   14.64 +/**
   14.65 + * A patched version of ANLR's ParseTreeBuilder 
   14.66 + * 
   14.67 + * @author mfukala@netbeans.org
   14.68 + */
   14.69 +public class NbParseTreeBuilder extends BlankDebugEventListener {
   14.70 +
   14.71 +    List<CommonToken> hiddenTokens = new ArrayList<CommonToken>();
   14.72 +    private int backtracking = 0;
   14.73 +    private CommonToken lastConsumedToken;
   14.74 +    private CharSequence source;
   14.75 +    static boolean debug_tokens = false; //testing 
   14.76 +    private boolean resync;
   14.77 +    private CommonToken unexpectedToken;
   14.78 +    Stack<RuleNode> callStack = new Stack<RuleNode>();
   14.79 +        
   14.80 +    public NbParseTreeBuilder(CharSequence source) {
   14.81 +        this.source = source;
   14.82 +        callStack.push(new RootNode(source));
   14.83 +    }
   14.84 +
   14.85 +    public AbstractParseTreeNode getTree() {
   14.86 +        return callStack.elementAt(0);
   14.87 +    }
   14.88 +
   14.89 +    /** Backtracking or cyclic DFA, don't want to add nodes to tree */
   14.90 +    @Override
   14.91 +    public void enterDecision(int d, boolean couldBacktrack) {
   14.92 +        backtracking++;
   14.93 +    }
   14.94 +
   14.95 +    @Override
   14.96 +    public void exitDecision(int i) {
   14.97 +        backtracking--;
   14.98 +    }
   14.99 +
  14.100 +    private boolean isIgnoredRule(String ruleName) {
  14.101 +//        return Arrays.binarySearch(IGNORED_RULES, ruleName) >= 0;
  14.102 +        return false;
  14.103 +    }
  14.104 +
  14.105 +    @Override
  14.106 +    public void enterRule(String filename, String ruleName) {
  14.107 +        if (backtracking > 0) {
  14.108 +            return;
  14.109 +        }
  14.110 +        System.out.println("entering " + ruleName);
  14.111 +        
  14.112 +        if (isIgnoredRule(ruleName)) {
  14.113 +            return;
  14.114 +        }
  14.115 +
  14.116 +        AbstractParseTreeNode parentRuleNode = callStack.peek();
  14.117 +        RuleNode ruleNode = new RuleNode(NodeType.valueOf(ruleName), source);
  14.118 +        addNodeChild(parentRuleNode, ruleNode);
  14.119 +        callStack.push(ruleNode);
  14.120 +    }
  14.121 +
  14.122 +    @Override
  14.123 +    public void exitRule(String filename, String ruleName) {
  14.124 +        if (backtracking > 0) {
  14.125 +            return;
  14.126 +        }
  14.127 +        System.out.println("exiting " + ruleName);
  14.128 +        
  14.129 +        if (isIgnoredRule(ruleName)) {
  14.130 +            return;
  14.131 +        }
  14.132 +
  14.133 +        RuleNode ruleNode = callStack.pop();
  14.134 +        if (ruleNode.getChildCount() > 0) {
  14.135 +            //set the rule end offset
  14.136 +            if (lastConsumedToken != null) {
  14.137 +                ruleNode.setLastToken(lastConsumedToken);
  14.138 +            }
  14.139 +        }
  14.140 +        
  14.141 +        
  14.142 +    }
  14.143 +
  14.144 +    @Override
  14.145 +    public void beginResync() {
  14.146 +        super.beginResync();
  14.147 +        resync = true;
  14.148 +    }
  14.149 +
  14.150 +    @Override
  14.151 +    public void endResync() {
  14.152 +        super.endResync();
  14.153 +        resync = false;
  14.154 +    }
  14.155 +    
  14.156 +    @Override
  14.157 +    public void consumeToken(Token token) {
  14.158 +        if (backtracking > 0 || resync) {
  14.159 +            return;
  14.160 +        }
  14.161 +
  14.162 +        if (debug_tokens) {
  14.163 +            CommonToken ct = (CommonToken) token;
  14.164 +            int[] ctr = CommonTokenUtil.getCommonTokenOffsetRange(ct);
  14.165 +            System.out.println(token + "(" + ctr[0] + "-" + ctr[1] + ")");
  14.166 +        }
  14.167 +
  14.168 +        //ignore the closing EOF token, we do not want it
  14.169 +        //it the parse tree
  14.170 +        if (token.getType() == ANTLRv3Lexer.EOF) {
  14.171 +            return;
  14.172 +        }
  14.173 +
  14.174 +        //also ignore error tokens - they are added as children of ErrorNode-s in the recognitionException(...) method
  14.175 +        if (token.getType() == Token.INVALID_TOKEN_TYPE) {
  14.176 +            return;
  14.177 +        }
  14.178 +
  14.179 +        lastConsumedToken = (CommonToken) token;
  14.180 +
  14.181 +        RuleNode ruleNode = callStack.peek();
  14.182 +        TokenNode elementNode = new TokenNode(source, (CommonToken) token);
  14.183 +        elementNode.hiddenTokens = this.hiddenTokens;
  14.184 +        hiddenTokens.clear();
  14.185 +        ruleNode.addChild(elementNode);
  14.186 +
  14.187 +        updateFirstTokens(ruleNode, lastConsumedToken);
  14.188 +    }
  14.189 +
  14.190 +    //set first token for all RuleNode-s in the stack without the first token set
  14.191 +    private void updateFirstTokens(RuleNode ruleNode, CommonToken token) {
  14.192 +        while (true) {
  14.193 +
  14.194 +            if (ruleNode.from() != -1) {
  14.195 +                break;
  14.196 +            }
  14.197 +            ruleNode.setFirstToken(token);
  14.198 +            ruleNode = (RuleNode) ruleNode.getParent();
  14.199 +            if (ruleNode == null) {
  14.200 +                break;
  14.201 +            }
  14.202 +        }
  14.203 +    }
  14.204 +
  14.205 +    @Override
  14.206 +    public void consumeHiddenToken(Token token) {
  14.207 +        if (backtracking > 0 || resync) {
  14.208 +            return;
  14.209 +        }
  14.210 +
  14.211 +        if (debug_tokens) {
  14.212 +            CommonToken ct = (CommonToken) token;
  14.213 +            int[] ctr = CommonTokenUtil.getCommonTokenOffsetRange(ct);
  14.214 +            System.out.println(token + "(" + ctr[0] + "-" + ctr[1] + ")");
  14.215 +        }
  14.216 +
  14.217 +        hiddenTokens.add((CommonToken) token);
  14.218 +    }
  14.219 +
  14.220 +//    @Override
  14.221 +//    public void recognitionException(RecognitionException e) {
  14.222 +//        if (backtracking > 0) {
  14.223 +//            return;
  14.224 +//        }
  14.225 +//        
  14.226 +//        RuleNode ruleNode = callStack.peek();
  14.227 +//
  14.228 +//        String message;
  14.229 +//        int from, to;
  14.230 +//
  14.231 +//        assert e.token != null;
  14.232 +//
  14.233 +//        //invalid token found int the stream
  14.234 +//        unexpectedToken = (CommonToken) e.token;
  14.235 +//        int unexpectedTokenCode = e.getUnexpectedType();
  14.236 +//        CssTokenId unexpectedTokenId = CssTokenId.forTokenTypeCode(unexpectedTokenCode);
  14.237 +//
  14.238 +//        assert unexpectedTokenId != null : "No CssTokenId for " + unexpectedToken;
  14.239 +//
  14.240 +//        //special handling for EOF token - it has lenght == 1 !
  14.241 +//        if(unexpectedTokenId == CssTokenId.EOF) {
  14.242 +//            from = to = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[0]; 
  14.243 +//        } else {
  14.244 +//            //normal tokens
  14.245 +//            from = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[0]; 
  14.246 +//            to = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[1];
  14.247 +//        }
  14.248 +//      
  14.249 +//        if (unexpectedTokenId == CssTokenId.EOF) {
  14.250 +//            message = NbBundle.getMessage(NbParseTreeBuilder.class, "MSG_Error_Premature_EOF");
  14.251 +//        } else {
  14.252 +//            message = NbBundle.getMessage(NbParseTreeBuilder.class, "MSG_Error_Unexpected_Token", unexpectedTokenId.name());
  14.253 +//        }
  14.254 +//        
  14.255 +//        //create a ParsingProblem
  14.256 +//        ProblemDescription problemDescription = new ProblemDescription(
  14.257 +//                from,
  14.258 +//                to,
  14.259 +//                message,
  14.260 +//                ProblemDescription.Keys.PARSING.name(),
  14.261 +//                ProblemDescription.Type.ERROR);
  14.262 +//
  14.263 +//        problems.add(problemDescription);
  14.264 +//        
  14.265 +//        //create an error node and add it to the parse tree
  14.266 +//        ErrorNode errorNode = new ErrorNode(from, to, problemDescription, source);
  14.267 +//
  14.268 +//        //add the unexpected token as a child of the error node
  14.269 +//        TokenNode tokenNode = new TokenNode(source, unexpectedToken);
  14.270 +//        addNodeChild(errorNode, tokenNode);
  14.271 +//        
  14.272 +//        if(e instanceof NoViableAltException) {
  14.273 +//            //error during predicate - the unexpected token may or may not be
  14.274 +//            //reported later as an error. To handle this,
  14.275 +//            //store the error node and the ruleNode where the error node should be added
  14.276 +//            noViableAltNodes.put(unexpectedToken, new Pair<Node>(ruleNode, errorNode));
  14.277 +//            errorNodes.push(errorNode);
  14.278 +//        } else {
  14.279 +//            //possibly remove the unexpectedToken from the noViableAltNodes map
  14.280 +//            
  14.281 +//            //NOTICE:
  14.282 +//            //Uncomment the following line if you want the parse tree not to produce
  14.283 +//            //multiple error nodes for the same token. If the line is active, there 
  14.284 +//            //wont be error nodes for semantic predicates if the unexpected token
  14.285 +//            //is matched by another error rule later.
  14.286 +////            noViableAltNodes.remove(unexpectedToken);
  14.287 +//            
  14.288 +//            addNodeChild(ruleNode, errorNode);
  14.289 +//            errorNodes.push(errorNode);
  14.290 +//
  14.291 +//            //create and artificial error token so the rules on stack can properly set their ranges
  14.292 +//            lastConsumedToken = new CommonToken(Token.INVALID_TOKEN_TYPE);
  14.293 +//            lastConsumedToken.setStartIndex(from);
  14.294 +//            lastConsumedToken.setStopIndex(to - 1); // ... ( -1 => last *char* index )
  14.295 +//        }
  14.296 +//
  14.297 +//
  14.298 +//    }
  14.299 +
  14.300 +//    @Override
  14.301 +//    public void terminate() {
  14.302 +//        super.terminate();
  14.303 +//
  14.304 +//        //process unreported errors from NoViableAltException
  14.305 +//        for(Pair<Node> pair : noViableAltNodes.values()) {
  14.306 +//            RuleNode ruleNode = (RuleNode)pair.n1;
  14.307 +//            ErrorNode errorNode = (ErrorNode)pair.n2;
  14.308 +//            
  14.309 +//            ruleNode.addChild(errorNode);
  14.310 +//            errorNode.setParent(ruleNode);
  14.311 +//        }
  14.312 +//        
  14.313 +//        //Finally after the parsing is done fix the error nodes and their predecessors.
  14.314 +//        //This fixes the problem with rules where RecognitionException happened
  14.315 +//        //but the errorneous or missing token has been matched in somewhere further
  14.316 +//        for (ErrorNode en : errorNodes) {
  14.317 +//            synchronizeAncestorsBoundaries(en);
  14.318 +//        }
  14.319 +//        
  14.320 +//        //clean parse tree from empty rule nodes 
  14.321 +//        //empty rule node == rule node without a single _token node_ child
  14.322 +//        for(RuleNode node : leafRuleNodes) {
  14.323 +//            removeLeafRuleNodes(node);
  14.324 +//        }
  14.325 +//
  14.326 +//    }
  14.327 +//    
  14.328 +//    //removes all empty rule nodes in the tree path from the given node to the parse tree root
  14.329 +//    private void removeLeafRuleNodes(RuleNode node) {
  14.330 +//        for(;;) {
  14.331 +//            if(node.children().isEmpty()) {
  14.332 +//                RuleNode parent = (RuleNode)node.parent();
  14.333 +//                if(parent == null) {
  14.334 +//                    return ;
  14.335 +//                }
  14.336 +//                parent.deleteChild(node);
  14.337 +//                node = parent;
  14.338 +//            } else {
  14.339 +//                break;
  14.340 +//            }
  14.341 +//        }
  14.342 +//    }
  14.343 +//    
  14.344 +//    private void synchronizeAncestorsBoundaries(RuleNode en) {
  14.345 +//        RuleNode n = en;
  14.346 +//            for (;;) {
  14.347 +//                if (n == null) {
  14.348 +//                    break;
  14.349 +//                }
  14.350 +//                
  14.351 +//                //adjust the parent nodes ranges to the errorNode
  14.352 +//                if (n.from() == -1 || n.from() > en.from()) {
  14.353 +//                    n.from = en.from();
  14.354 +//                }
  14.355 +//                if(n.to() == -1 || n.to() < en.to()) {                    
  14.356 +//                    n.to = en.to();
  14.357 +//                }
  14.358 +//                
  14.359 +//                n = (RuleNode) n.parent();
  14.360 +//            }
  14.361 +//    }
  14.362 +//
  14.363 +//    public Collection<ProblemDescription> getProblems() {
  14.364 +//        return problems;
  14.365 +//    }
  14.366 +//
  14.367 +//    //note: it would be possible to handle this all in consumeToken since it is called from the
  14.368 +//    //BaseRecognizer.consumeUntil(...) {   input.consume();   } but for the better usability
  14.369 +//    //it is done this way. So the beginResyn/endResync doesn't have to be used.
  14.370 +//    //the NbParseTreeBuilder.consumeToken() method ignores tokens with ERROR type so they
  14.371 +//    //won't be duplicated in the parse tree
  14.372 +//    
  14.373 +//    //creates a "recovery" node with all the skipped tokens as children
  14.374 +//    void consumeSkippedTokens(List<Token> tokens) {
  14.375 +//        if(tokens.isEmpty()) {
  14.376 +//            return ;
  14.377 +//        }
  14.378 +//
  14.379 +//        CommonToken first = (CommonToken)tokens.get(0);
  14.380 +//        CommonToken last = (CommonToken)tokens.get(tokens.size() - 1);
  14.381 +//        
  14.382 +//        
  14.383 +//
  14.384 +//        //if there's just one recovered token and the token is the same as the unexpectedToken just skip the 
  14.385 +//        //recovery node creation, the parse tree for the errorneous piece of code is already complete
  14.386 +//        boolean ignoreFirstToken = unexpectedToken  == first;
  14.387 +//        if(ignoreFirstToken && tokens.size() == 1) {
  14.388 +//            return ;
  14.389 +//        }
  14.390 +//        
  14.391 +//        //do not add the first token as children of the recovery node if it has been already
  14.392 +//        //added as a child of the error node created for the RecognitionException
  14.393 +//        if(ignoreFirstToken) {
  14.394 +//            first = (CommonToken)tokens.get(1); //use second
  14.395 +//        }
  14.396 +//        
  14.397 +//        //find last error which triggered this recovery and add the skipped tokens to it
  14.398 +////        ErrorNode errorNode = errorNodes.peek();
  14.399 +////        RuleNode peek = callStack.peek();
  14.400 +////        if(!(peek instanceof ErrorNode)) {
  14.401 +//        
  14.402 +//        RuleNode peek = errorNodes.peek();
  14.403 +//        
  14.404 +//            RuleNode node = new RuleNode(NodeType.recovery, source);
  14.405 +//            peek.addChild(node);
  14.406 +//            node.setParent(peek);
  14.407 +//            peek = node;
  14.408 +//            
  14.409 +////        }
  14.410 +//            
  14.411 +//        
  14.412 +//        //set first and last token
  14.413 +//        peek.setFirstToken(first);
  14.414 +//        peek.setLastToken(last);
  14.415 +//        
  14.416 +//        synchronizeAncestorsBoundaries(peek);
  14.417 +//        
  14.418 +//        //set range
  14.419 +//        peek.from = CommonTokenUtil.getCommonTokenOffsetRange(first)[0]; 
  14.420 +//        peek.to = CommonTokenUtil.getCommonTokenOffsetRange(last)[1]; 
  14.421 +//        
  14.422 +//        //set the error tokens as children of the error node
  14.423 +//        for(int i = (ignoreFirstToken ? 1 : 0); i < tokens.size(); i++) {
  14.424 +//            CommonToken token = (CommonToken)tokens.get(i);
  14.425 +//            TokenNode tokenNode = new TokenNode(source, token);
  14.426 +//            addNodeChild(peek, tokenNode);
  14.427 +//        }
  14.428 +//        
  14.429 +//        //create and artificial error token so the rules on stack can properly set their ranges
  14.430 +//        lastConsumedToken = new CommonToken(Token.INVALID_TOKEN_TYPE);
  14.431 +//        lastConsumedToken.setStartIndex(first.getStartIndex());
  14.432 +//        lastConsumedToken.setStopIndex(last.getStopIndex()); 
  14.433 +//                
  14.434 +//    }
  14.435 +//    
  14.436 +//    
  14.437 +    private void addNodeChild(AbstractParseTreeNode parent, AbstractParseTreeNode child) {
  14.438 +        parent.addChild(child);
  14.439 +        child.setParent(parent);
  14.440 +    }
  14.441 +//    
  14.442 +//    private static class Pair<T> {
  14.443 +//        T n1, n2;
  14.444 +//        public Pair(T n1, T n2) {
  14.445 +//            this.n1 = n1;
  14.446 +//            this.n2 = n2;
  14.447 +//        }
  14.448 +//    }
  14.449 +//    
  14.450 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/Node.java	Mon Jan 14 15:49:16 2013 +0100
    15.3 @@ -0,0 +1,68 @@
    15.4 +/*
    15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 + *
    15.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    15.8 + *
    15.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   15.10 + * Other names may be trademarks of their respective owners.
   15.11 + *
   15.12 + * The contents of this file are subject to the terms of either the GNU
   15.13 + * General Public License Version 2 only ("GPL") or the Common
   15.14 + * Development and Distribution License("CDDL") (collectively, the
   15.15 + * "License"). You may not use this file except in compliance with the
   15.16 + * License. You can obtain a copy of the License at
   15.17 + * http://www.netbeans.org/cddl-gplv2.html
   15.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   15.19 + * specific language governing permissions and limitations under the
   15.20 + * License.  When distributing the software, include this License Header
   15.21 + * Notice in each file and include the License file at
   15.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   15.23 + * particular file as subject to the "Classpath" exception as provided
   15.24 + * by Oracle in the GPL Version 2 section of the License file that
   15.25 + * accompanied this code. If applicable, add the following below the
   15.26 + * License Header, with the fields enclosed by brackets [] replaced by
   15.27 + * your own identifying information:
   15.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   15.29 + *
   15.30 + * If you wish your version of this file to be governed by only the CDDL
   15.31 + * or only the GPL Version 2, indicate your decision by adding
   15.32 + * "[Contributor] elects to include this software in this distribution
   15.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   15.34 + * single choice of license, a recipient has the option to distribute
   15.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   15.36 + * to extend the choice of license to its licensees as provided above.
   15.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   15.38 + * Version 2 license, then the option applies only if the new code is
   15.39 + * made subject to such option by the copyright holder.
   15.40 + *
   15.41 + * Contributor(s):
   15.42 + *
   15.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   15.44 + */
   15.45 +package org.netbeans.modules.antlr.editor;
   15.46 +
   15.47 +import java.util.List;
   15.48 +import java.util.Map;
   15.49 +
   15.50 +/**
   15.51 + * Node of the css source parse tree.
   15.52 + *
   15.53 + * @author marekfukala
   15.54 + */
   15.55 +public interface Node {
   15.56 +    
   15.57 +    public int from();
   15.58 +
   15.59 +    public int to();
   15.60 +    
   15.61 +    public String name();
   15.62 +
   15.63 +    public NodeType type();
   15.64 +    
   15.65 +    public List<Node> children();
   15.66 +    
   15.67 +    public Node parent();
   15.68 +    
   15.69 +    public CharSequence image();
   15.70 +    
   15.71 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeType.java	Mon Jan 14 15:49:16 2013 +0100
    16.3 @@ -0,0 +1,68 @@
    16.4 +/*
    16.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.6 + *
    16.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    16.8 + *
    16.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   16.10 + * Other names may be trademarks of their respective owners.
   16.11 + *
   16.12 + * The contents of this file are subject to the terms of either the GNU
   16.13 + * General Public License Version 2 only (GPL) or the Common
   16.14 + * Development and Distribution License(CDDL) (collectively, the
   16.15 + * License). You may not use this file except in compliance with the
   16.16 + * License. You can obtain a copy of the License at
   16.17 + * http://www.netbeans.org/cddl-gplv2.html
   16.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   16.19 + * specific language governing permissions and limitations under the
   16.20 + * License.  When distributing the software, include this License Header
   16.21 + * Notice in each file and include the License file at
   16.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   16.23 + * particular file as subject to the Classpath exception as provided
   16.24 + * by Oracle in the GPL Version 2 section of the License file that
   16.25 + * accompanied this code. If applicable, add the following below the
   16.26 + * License Header, with the fields enclosed by brackets [] replaced by
   16.27 + * your own identifying information:
   16.28 + * Portions Copyrighted [year] [name of copyright owner]
   16.29 + *
   16.30 + * If you wish your version of this file to be governed by only the CDDL
   16.31 + * or only the GPL Version 2, indicate your decision by adding
   16.32 + * "[Contributor] elects to include this software in this distribution
   16.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   16.34 + * single choice of license, a recipient has the option to distribute
   16.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   16.36 + * to extend the choice of license to its licensees as provided above.
   16.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   16.38 + * Version 2 license, then the option applies only if the new code is
   16.39 + * made subject to such option by the copyright holder.
   16.40 + *
   16.41 + * Contributor(s):
   16.42 + *
   16.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   16.44 + */
   16.45 +package org.netbeans.modules.antlr.editor;
   16.46 +
   16.47 +/**
   16.48 + * Node types for all the CSS3 ANTLR grammar elements.
   16.49 + * 
   16.50 + * This enum must keep in sync with the ANTLR grammar set of rules!!!
   16.51 + *
   16.52 + * @author mfukala@netbeans.org
   16.53 + */
   16.54 +public enum NodeType {
   16.55 +
   16.56 +    root,
   16.57 +    token,
   16.58 +   
   16.59 +    invalidRule, ebnf, finallyClause, notSet, option, attrScope, 
   16.60 +        element, tokensSpec, treeSpec, ruleScopeSpec, tokenSpec, 
   16.61 +        rewrite_tree_ebnf, optionsSpec, rewrite_template_ref, throwsSpec, 
   16.62 +        exceptionGroup, ebnfSuffix, rewrite_alternative, rewrite_tree, 
   16.63 +        synpred1_ANTLRv3, elementNoOptionSpec, block, rule, rewrite_template, 
   16.64 +        rewrite_tree_alternative, terminal, rewrite_tree_block, range, 
   16.65 +        rewrite_tree_atom, altList, rewrite_template_arg, rewrite, 
   16.66 +        action, rewrite_tree_element, ruleAction, grammarDef, synpred2_ANTLRv3, 
   16.67 +        actionScopeName, id, rewrite_template_args, notTerminal, 
   16.68 +        optionValue, alternative, atom, rewrite_indirect_template_head, 
   16.69 +        exceptionHandler
   16.70 +    
   16.71 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeUtil.java	Mon Jan 14 15:49:16 2013 +0100
    17.3 @@ -0,0 +1,330 @@
    17.4 +/*
    17.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.6 + *
    17.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
    17.8 + *
    17.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   17.10 + * Other names may be trademarks of their respective owners.
   17.11 + *
   17.12 + * The contents of this file are subject to the terms of either the GNU
   17.13 + * General Public License Version 2 only ("GPL") or the Common
   17.14 + * Development and Distribution License("CDDL") (collectively, the
   17.15 + * "License"). You may not use this file except in compliance with the
   17.16 + * License. You can obtain a copy of the License at
   17.17 + * http://www.netbeans.org/cddl-gplv2.html
   17.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   17.19 + * specific language governing permissions and limitations under the
   17.20 + * License.  When distributing the software, include this License Header
   17.21 + * Notice in each file and include the License file at
   17.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   17.23 + * particular file as subject to the "Classpath" exception as provided
   17.24 + * by Oracle in the GPL Version 2 section of the License file that
   17.25 + * accompanied this code. If applicable, add the following below the
   17.26 + * License Header, with the fields enclosed by brackets [] replaced by
   17.27 + * your own identifying information:
   17.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   17.29 + * 
   17.30 + * If you wish your version of this file to be governed by only the CDDL
   17.31 + * or only the GPL Version 2, indicate your decision by adding
   17.32 + * "[Contributor] elects to include this software in this distribution
   17.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   17.34 + * single choice of license, a recipient has the option to distribute
   17.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   17.36 + * to extend the choice of license to its licensees as provided above.
   17.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   17.38 + * Version 2 license, then the option applies only if the new code is
   17.39 + * made subject to such option by the copyright holder.
   17.40 + * 
   17.41 + * Contributor(s):
   17.42 + * 
   17.43 + * Portions Copyrighted 2008 Sun Microsystems, Inc.
   17.44 + */
   17.45 +package org.netbeans.modules.antlr.editor;
   17.46 +
   17.47 +import java.io.PrintWriter;
   17.48 +import java.util.ArrayList;
   17.49 +import java.util.EnumSet;
   17.50 +import java.util.List;
   17.51 +import java.util.Locale;
   17.52 +import java.util.StringTokenizer;
   17.53 +import java.util.concurrent.atomic.AtomicBoolean;
   17.54 +import java.util.concurrent.atomic.AtomicReference;
   17.55 +
   17.56 +/**
   17.57 + * Utility methods to work with the css source parse trees.
   17.58 + *
   17.59 + * @author mfukala@netbeans.org
   17.60 + */
   17.61 +public final class NodeUtil {
   17.62 +
   17.63 +    private static final String INDENT = "    ";//NOI18N
   17.64 +
   17.65 +    private NodeUtil() {
   17.66 +    }
   17.67 +
   17.68 +    public static int[] getTrimmedNodeRange(Node node) {
   17.69 +        CharSequence text = node.image();
   17.70 +        int from_diff;
   17.71 +        int to_diff;
   17.72 +        for (from_diff = 0; from_diff < text.length(); from_diff++) {
   17.73 +            if (!Character.isWhitespace(text.charAt(from_diff))) {
   17.74 +                break;
   17.75 +            }
   17.76 +        }
   17.77 +
   17.78 +        for (to_diff = 0; to_diff < text.length() - from_diff; to_diff++) {
   17.79 +            if (!Character.isWhitespace(text.charAt(text.length() - 1 - to_diff))) {
   17.80 +                break;
   17.81 +            }
   17.82 +        }
   17.83 +
   17.84 +        return new int[]{node.from() + from_diff, node.to() - to_diff};
   17.85 +    }
   17.86 +
   17.87 +    public static Node findNonTokenNodeAtOffset(Node node, int offset) {
   17.88 +        Node found = findNodeAtOffset(node, offset);
   17.89 +        return found instanceof TokenNode
   17.90 +                ? found.parent()
   17.91 +                : found;
   17.92 +
   17.93 +    }
   17.94 +
   17.95 +    public static Node findNodeAtOffset(Node node, int astOffset) {
   17.96 +        int so = node.from();
   17.97 +        int eo = node.to();
   17.98 +
   17.99 +
  17.100 +        if (astOffset < so || astOffset > eo) {
  17.101 +            //we are out of the scope - may happen just with the first client call
  17.102 +            return null;
  17.103 +        }
  17.104 +
  17.105 +        if (astOffset >= so && astOffset <= eo && node.children().isEmpty()) {
  17.106 +            //if the node matches and has no children we found it
  17.107 +            return node;
  17.108 +        }
  17.109 +
  17.110 +        for (Node child : node.children()) {
  17.111 +
  17.112 +            int ch_so = child.from();
  17.113 +            int ch_eo = child.to();
  17.114 +            if (astOffset >= ch_so && astOffset <= ch_eo) {
  17.115 +                //the child is or contains the searched node
  17.116 +                return findNodeAtOffset(child, astOffset);
  17.117 +            }
  17.118 +
  17.119 +        }
  17.120 +
  17.121 +        return node;
  17.122 +    }
  17.123 +
  17.124 +    /** @return first child of the node with the specified kind. */
  17.125 +    public static Node getChildByType(Node node, NodeType type) {
  17.126 +        Node[] children = getChildrenByType(node, type);
  17.127 +        return children.length == 0 ? null : children[0];
  17.128 +    }
  17.129 +
  17.130 +    /**
  17.131 +     * 
  17.132 +     * @param node
  17.133 +     * @param tokenId
  17.134 +     * @return 
  17.135 +     */
  17.136 +    public static Node getChildTokenNode(Node node, AntlrTokenId tokenId) {
  17.137 +        Node[] children = getChildrenByType(node, NodeType.token);
  17.138 +        for (Node n : children) {
  17.139 +            TokenNode tn = (TokenNode) n;
  17.140 +            if (tn.getTokenId() == tokenId) {
  17.141 +                return n;
  17.142 +            }
  17.143 +        }
  17.144 +        return null;
  17.145 +    }
  17.146 +
  17.147 +    public static AntlrTokenId getTokenNodeTokenId(Node node) {
  17.148 +        //strange, possibly better expose TokenNode!
  17.149 +        if (node.type() != NodeType.token) {
  17.150 +            throw new IllegalArgumentException(
  17.151 +                    String.format("The argument must by of NodeType.token type. The actual type is %s", node.type()));
  17.152 +        }
  17.153 +        return ((TokenNode) node).getTokenId();
  17.154 +    }
  17.155 +
  17.156 +    public static Node getAncestorByType(Node node, final NodeType type) {
  17.157 +        AtomicReference<Node> found = new AtomicReference<Node>();
  17.158 +        NodeVisitor visitor = new NodeVisitor<AtomicReference<Node>>(found) {
  17.159 +
  17.160 +            @Override
  17.161 +            public boolean visit(Node node) {
  17.162 +                if (node.type() == type) {
  17.163 +                    getResult().set(node);
  17.164 +                    return true;
  17.165 +                }
  17.166 +                return false;
  17.167 +            }
  17.168 +        };
  17.169 +        visitor.visitAncestors(node);
  17.170 +        return found.get();
  17.171 +    }
  17.172 +    
  17.173 +    public static List<Node> getChildrenRecursivelyByType(Node root, final NodeType... type) {
  17.174 +        final EnumSet<NodeType> nodeTypes = EnumSet.of(type[0], type);
  17.175 +        List<Node> found = new ArrayList<Node>();
  17.176 +        NodeVisitor<List<Node>> visitor = new NodeVisitor<List<Node>>(found) {
  17.177 +
  17.178 +            @Override
  17.179 +            public boolean visit(Node node) {
  17.180 +                if(nodeTypes.contains(node.type())) {
  17.181 +                    getResult().add(node);
  17.182 +                }
  17.183 +                return false;
  17.184 +            }
  17.185 +        };
  17.186 +        
  17.187 +        visitor.visitChildren(root);
  17.188 +        return visitor.getResult();
  17.189 +    }
  17.190 +
  17.191 +    /** @return list of children of the node with the specified kind. */
  17.192 +    public static Node[] getChildrenByType(Node node, NodeType type) {
  17.193 +        ArrayList<Node> list = new ArrayList<Node>(node.children().size() / 4);
  17.194 +        for (Node child : node.children()) {
  17.195 +            if (child.type() == type) {
  17.196 +                list.add(child);
  17.197 +            }
  17.198 +        }
  17.199 +        return list.toArray(new Node[]{});
  17.200 +    }
  17.201 +
  17.202 +    /** @return A sibling node before or after the given node. */
  17.203 +    public static Node getSibling(Node node, boolean before) {
  17.204 +        Node parent = node.parent();
  17.205 +        if (parent == null) {
  17.206 +            return null;
  17.207 +        }
  17.208 +        Node sibling = null;
  17.209 +        for (int i = 0; i < parent.children().size(); i++) {
  17.210 +            List<Node> children = parent.children();
  17.211 +            Node child = children.get(i);
  17.212 +            if (child == node) {
  17.213 +                //we found myself
  17.214 +                if (before) {
  17.215 +                    if (i == 0) {
  17.216 +                        //we are first node, no sibling before
  17.217 +                        return null;
  17.218 +                    } else {
  17.219 +                        return children.get(i - 1);
  17.220 +                    }
  17.221 +                } else {
  17.222 +                    //after
  17.223 +                    if (i == children.size() - 1) {
  17.224 +                        //we are last node, no sibling after
  17.225 +                        return null;
  17.226 +                    } else {
  17.227 +                        return children.get(i + 1);
  17.228 +                    }
  17.229 +                }
  17.230 +            }
  17.231 +        }
  17.232 +        return sibling;
  17.233 +    }
  17.234 +
  17.235 +    public static Node query(Node base, String path) {
  17.236 +        return query(base, path, false);
  17.237 +    }
  17.238 +
  17.239 +    /** find an Node according to the given tree path
  17.240 +     * example of path: declaration/property|1/color -- find a second color property  (index from zero)
  17.241 +     */
  17.242 +    public static Node query(Node base, String path, boolean caseInsensitive) {
  17.243 +        StringTokenizer st = new StringTokenizer(path, "/");
  17.244 +        Node found = base;
  17.245 +        while (st.hasMoreTokens()) {
  17.246 +            String token = st.nextToken();
  17.247 +            int indexDelim = token.indexOf('|');
  17.248 +
  17.249 +            String nodeName = indexDelim >= 0 ? token.substring(0, indexDelim) : token;
  17.250 +            if (caseInsensitive) {
  17.251 +                nodeName = nodeName.toLowerCase(Locale.ENGLISH);
  17.252 +            }
  17.253 +            String sindex = indexDelim >= 0 ? token.substring(indexDelim + 1, token.length()) : "0";
  17.254 +            int index = Integer.parseInt(sindex);
  17.255 +
  17.256 +            int count = 0;
  17.257 +            Node foundLocal = null;
  17.258 +            for (Node child : found.children()) {
  17.259 +                String childName = child.name();
  17.260 +                if ((caseInsensitive ? childName = childName.toLowerCase(Locale.ENGLISH) : childName).equals(nodeName) && count++ == index) {
  17.261 +                    foundLocal = child;
  17.262 +                    break;
  17.263 +                }
  17.264 +            }
  17.265 +            if (foundLocal != null) {
  17.266 +                found = foundLocal;
  17.267 +
  17.268 +                if (!st.hasMoreTokens()) {
  17.269 +                    //last token, we may return
  17.270 +                    assert found.name().equals(nodeName);
  17.271 +                    return found;
  17.272 +                }
  17.273 +
  17.274 +            } else {
  17.275 +                System.err.println(String.format("NodeUtil.query: Could find child '%s' in the node '%s'!", nodeName, found.name()));
  17.276 +                return null; //no found
  17.277 +            }
  17.278 +        }
  17.279 +
  17.280 +        return null;
  17.281 +    }
  17.282 +
  17.283 +    public static void dumpTree(Node node) {
  17.284 +        PrintWriter pw = new PrintWriter(System.out);
  17.285 +        dumpTree(node, pw);
  17.286 +        pw.flush();
  17.287 +    }
  17.288 +
  17.289 +    public static void dumpTree(Node node, PrintWriter pw) {
  17.290 +        dump(node, 0, pw);
  17.291 +
  17.292 +    }
  17.293 +
  17.294 +    private static void dump(Node tree, int level, PrintWriter pw) {
  17.295 +        for (int i = 0; i < level; i++) {
  17.296 +            pw.print(INDENT);
  17.297 +        }
  17.298 +        pw.print(tree.toString());
  17.299 +        pw.println();
  17.300 +        for (Node c : tree.children()) {
  17.301 +            dump(c, level + 1, pw);
  17.302 +        }
  17.303 +    }
  17.304 +
  17.305 +
  17.306 +    public static boolean isOfType(Node node, NodeType... types) {
  17.307 +        for(NodeType type : types) {
  17.308 +            if(node.type() == type) {
  17.309 +                return true;
  17.310 +            }
  17.311 +        }
  17.312 +        return false;
  17.313 +    }
  17.314 +    
  17.315 +//    public static boolean containsError(Node node) {
  17.316 +//        AtomicBoolean error = new AtomicBoolean(false);
  17.317 +//        NodeVisitor<AtomicBoolean> visitor = new NodeVisitor<AtomicBoolean>(error) {
  17.318 +//
  17.319 +//            @Override
  17.320 +//            public boolean visit(Node node) {
  17.321 +//                if(node.type() == NodeType.error) {
  17.322 +//                    getResult().set(true);
  17.323 +//                    return true;
  17.324 +//                }
  17.325 +//                return false;
  17.326 +//            }
  17.327 +//        };
  17.328 +//        
  17.329 +//        visitor.visitChildren(node);
  17.330 +//        
  17.331 +//        return visitor.getResult().get();
  17.332 +//    }
  17.333 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NodeVisitor.java	Mon Jan 14 15:49:16 2013 +0100
    18.3 @@ -0,0 +1,142 @@
    18.4 +/*
    18.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.6 + *
    18.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    18.8 + *
    18.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   18.10 + * Other names may be trademarks of their respective owners.
   18.11 + *
   18.12 + * The contents of this file are subject to the terms of either the GNU
   18.13 + * General Public License Version 2 only ("GPL") or the Common
   18.14 + * Development and Distribution License("CDDL") (collectively, the
   18.15 + * "License"). You may not use this file except in compliance with the
   18.16 + * License. You can obtain a copy of the License at
   18.17 + * http://www.netbeans.org/cddl-gplv2.html
   18.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   18.19 + * specific language governing permissions and limitations under the
   18.20 + * License.  When distributing the software, include this License Header
   18.21 + * Notice in each file and include the License file at
   18.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   18.23 + * particular file as subject to the "Classpath" exception as provided
   18.24 + * by Oracle in the GPL Version 2 section of the License file that
   18.25 + * accompanied this code. If applicable, add the following below the
   18.26 + * License Header, with the fields enclosed by brackets [] replaced by
   18.27 + * your own identifying information:
   18.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   18.29 + *
   18.30 + * If you wish your version of this file to be governed by only the CDDL
   18.31 + * or only the GPL Version 2, indicate your decision by adding
   18.32 + * "[Contributor] elects to include this software in this distribution
   18.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   18.34 + * single choice of license, a recipient has the option to distribute
   18.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   18.36 + * to extend the choice of license to its licensees as provided above.
   18.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   18.38 + * Version 2 license, then the option applies only if the new code is
   18.39 + * made subject to such option by the copyright holder.
   18.40 + *
   18.41 + * Contributor(s):
   18.42 + *
   18.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   18.44 + */
   18.45 +package org.netbeans.modules.antlr.editor;
   18.46 +
   18.47 +import java.util.Collection;
   18.48 +import java.util.List;
   18.49 +
   18.50 +/**
   18.51 + * Allows to visit the css source parse trees.
   18.52 + *
   18.53 + * @author marekfukala
   18.54 + */
   18.55 +public abstract class NodeVisitor<T> {
   18.56 +    
   18.57 +    private T result;
   18.58 +    private boolean cancelled = false;
   18.59 +    
   18.60 +    
   18.61 +    public NodeVisitor(T result) {
   18.62 +        this.result = result;
   18.63 +    }
   18.64 +    
   18.65 +    public NodeVisitor() {
   18.66 +        this(null);
   18.67 +    }
   18.68 +    
   18.69 +    /**
   18.70 +     * Performs the given node visit.
   18.71 +     * @param node
   18.72 +     * @return true if the visiting process should be interrupted
   18.73 +     */
   18.74 +    public abstract boolean visit(Node node);
   18.75 +    
   18.76 +    public T getResult() {
   18.77 +        return result;
   18.78 +    }
   18.79 +    
   18.80 +    /**
   18.81 +     * Implementors may use this flag to possibly stop the visit(...) method 
   18.82 +     * execution. The nodes recursive visiting is canceled automatically once
   18.83 +     * cancel() method is called.
   18.84 +     * 
   18.85 +     * @return true if the visitor should stop performing the code.
   18.86 +     */
   18.87 +    protected boolean isCancelled() {
   18.88 +        return cancelled;
   18.89 +    }
   18.90 +    
   18.91 +    public void cancel() {
   18.92 +        cancelled = true;
   18.93 +    }
   18.94 +    
   18.95 +    public void visitAncestors(Node node) {
   18.96 +        Node parent = node.parent();
   18.97 +        if (parent != null) {
   18.98 +            if(isCancelled()) {
   18.99 +                return ;
  18.100 +            }
  18.101 +            if(visit(parent)) {
  18.102 +                return; //visiting stopped by the visitor
  18.103 +            }
  18.104 +            visitAncestors(parent);
  18.105 +        }
  18.106 +    }
  18.107 +    
  18.108 +    public Node visitChildren(Node node) {
  18.109 +        List<Node> children = node.children();
  18.110 +        if (children != null) {
  18.111 +            for (Node child : children) {
  18.112 +                if(isCancelled()) {
  18.113 +                    return null;
  18.114 +                }
  18.115 +                if(visit(child)) {
  18.116 +                    return child; //visiting stopped by the visitor
  18.117 +                }
  18.118 +                //recursion
  18.119 +                Node breakNode = visitChildren(child); 
  18.120 +                if(breakNode != null) {
  18.121 +                    return breakNode;
  18.122 +                }
  18.123 +            }
  18.124 +        }
  18.125 +        return null;
  18.126 +    }
  18.127 +    
  18.128 +    public static <TE> void visitChildren(Node node, Collection<NodeVisitor<TE>> visitors) {
  18.129 +        List<Node> children = node.children();
  18.130 +        if (children != null) {
  18.131 +            for (Node child : children) {
  18.132 +                for(NodeVisitor v : visitors) {
  18.133 +                    if(v.isCancelled()) {
  18.134 +                        continue; //skip the cancelled visitors
  18.135 +                    }
  18.136 +                    v.visit(child);
  18.137 +                }
  18.138 +                //recursion
  18.139 +                visitChildren(child, visitors); 
  18.140 +            }
  18.141 +        }
  18.142 +    }
  18.143 +    
  18.144 +    
  18.145 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ProblemDescription.java	Mon Jan 14 15:49:16 2013 +0100
    19.3 @@ -0,0 +1,137 @@
    19.4 +/*
    19.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    19.6 + *
    19.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    19.8 + *
    19.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   19.10 + * Other names may be trademarks of their respective owners.
   19.11 + *
   19.12 + * The contents of this file are subject to the terms of either the GNU
   19.13 + * General Public License Version 2 only ("GPL") or the Common
   19.14 + * Development and Distribution License("CDDL") (collectively, the
   19.15 + * "License"). You may not use this file except in compliance with the
   19.16 + * License. You can obtain a copy of the License at
   19.17 + * http://www.netbeans.org/cddl-gplv2.html
   19.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   19.19 + * specific language governing permissions and limitations under the
   19.20 + * License.  When distributing the software, include this License Header
   19.21 + * Notice in each file and include the License file at
   19.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   19.23 + * particular file as subject to the "Classpath" exception as provided
   19.24 + * by Oracle in the GPL Version 2 section of the License file that
   19.25 + * accompanied this code. If applicable, add the following below the
   19.26 + * License Header, with the fields enclosed by brackets [] replaced by
   19.27 + * your own identifying information:
   19.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   19.29 + *
   19.30 + * If you wish your version of this file to be governed by only the CDDL
   19.31 + * or only the GPL Version 2, indicate your decision by adding
   19.32 + * "[Contributor] elects to include this software in this distribution
   19.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   19.34 + * single choice of license, a recipient has the option to distribute
   19.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   19.36 + * to extend the choice of license to its licensees as provided above.
   19.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   19.38 + * Version 2 license, then the option applies only if the new code is
   19.39 + * made subject to such option by the copyright holder.
   19.40 + *
   19.41 + * Contributor(s):
   19.42 + *
   19.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   19.44 + */
   19.45 +package org.netbeans.modules.antlr.editor;
   19.46 +
   19.47 +/**
   19.48 + * Representation of an error in css source.
   19.49 + *
   19.50 + * @author marekfukala
   19.51 + */
   19.52 +public final class ProblemDescription {
   19.53 +    
   19.54 +    public enum Type {
   19.55 +        INFO, WARNING, ERROR, FATAL;
   19.56 +    }
   19.57 +    
   19.58 +    public enum Keys {
   19.59 +        LEXING, PARSING, AST;
   19.60 +    }
   19.61 +    
   19.62 +    private final int from, to;
   19.63 +    private final String description;
   19.64 +    private final String key;
   19.65 +    private Type type;
   19.66 +    
   19.67 +    public ProblemDescription(int from, int to, String description, String key, Type type) {
   19.68 +        this.from = from;
   19.69 +        this.to = to;
   19.70 +        this.description = description;
   19.71 +        this.key = key;
   19.72 +        this.type = type;
   19.73 +    }
   19.74 +
   19.75 +    public String getDescription() {
   19.76 +        return description;
   19.77 +    }
   19.78 +
   19.79 +    public int getFrom() {
   19.80 +        return from;
   19.81 +    }
   19.82 +
   19.83 +    public String getKey() {
   19.84 +        return key;
   19.85 +    }
   19.86 +
   19.87 +    public int getTo() {
   19.88 +        return to;
   19.89 +    }
   19.90 +
   19.91 +    public Type getType() {
   19.92 +        return type;
   19.93 +    }
   19.94 +    
   19.95 +    @Override
   19.96 +    public String toString() {
   19.97 +        return "ProblemDescription{" + "from=" + from + ", to=" + to + ", description=" + description + ", key=" + key + ", type=" + type + '}';
   19.98 +    }
   19.99 +
  19.100 +    @Override
  19.101 +    public boolean equals(Object obj) {
  19.102 +        if (obj == null) {
  19.103 +            return false;
  19.104 +        }
  19.105 +        if (getClass() != obj.getClass()) {
  19.106 +            return false;
  19.107 +        }
  19.108 +        final ProblemDescription other = (ProblemDescription) obj;
  19.109 +        if (this.from != other.from) {
  19.110 +            return false;
  19.111 +        }
  19.112 +        if (this.to != other.to) {
  19.113 +            return false;
  19.114 +        }
  19.115 +        if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
  19.116 +            return false;
  19.117 +        }
  19.118 +        if ((this.key == null) ? (other.key != null) : !this.key.equals(other.key)) {
  19.119 +            return false;
  19.120 +        }
  19.121 +        if (this.type != other.type) {
  19.122 +            return false;
  19.123 +        }
  19.124 +        return true;
  19.125 +    }
  19.126 +
  19.127 +    @Override
  19.128 +    public int hashCode() {
  19.129 +        int hash = 5;
  19.130 +        hash = 19 * hash + this.from;
  19.131 +        hash = 19 * hash + this.to;
  19.132 +        hash = 19 * hash + (this.description != null ? this.description.hashCode() : 0);
  19.133 +        hash = 19 * hash + (this.key != null ? this.key.hashCode() : 0);
  19.134 +        hash = 19 * hash + (this.type != null ? this.type.hashCode() : 0);
  19.135 +        return hash;
  19.136 +    }
  19.137 +    
  19.138 +    
  19.139 +    
  19.140 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/RootNode.java	Mon Jan 14 15:49:16 2013 +0100
    20.3 @@ -0,0 +1,65 @@
    20.4 +/*
    20.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    20.6 + *
    20.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    20.8 + *
    20.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   20.10 + * Other names may be trademarks of their respective owners.
   20.11 + *
   20.12 + * The contents of this file are subject to the terms of either the GNU
   20.13 + * General Public License Version 2 only ("GPL") or the Common
   20.14 + * Development and Distribution License("CDDL") (collectively, the
   20.15 + * "License"). You may not use this file except in compliance with the
   20.16 + * License. You can obtain a copy of the License at
   20.17 + * http://www.netbeans.org/cddl-gplv2.html
   20.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   20.19 + * specific language governing permissions and limitations under the
   20.20 + * License.  When distributing the software, include this License Header
   20.21 + * Notice in each file and include the License file at
   20.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   20.23 + * particular file as subject to the "Classpath" exception as provided
   20.24 + * by Oracle in the GPL Version 2 section of the License file that
   20.25 + * accompanied this code. If applicable, add the following below the
   20.26 + * License Header, with the fields enclosed by brackets [] replaced by
   20.27 + * your own identifying information:
   20.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   20.29 + *
   20.30 + * If you wish your version of this file to be governed by only the CDDL
   20.31 + * or only the GPL Version 2, indicate your decision by adding
   20.32 + * "[Contributor] elects to include this software in this distribution
   20.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   20.34 + * single choice of license, a recipient has the option to distribute
   20.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   20.36 + * to extend the choice of license to its licensees as provided above.
   20.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   20.38 + * Version 2 license, then the option applies only if the new code is
   20.39 + * made subject to such option by the copyright holder.
   20.40 + *
   20.41 + * Contributor(s):
   20.42 + *
   20.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   20.44 + */
   20.45 +package org.netbeans.modules.antlr.editor;
   20.46 +
   20.47 +
   20.48 +/**
   20.49 + *
   20.50 + * @author marekfukala
   20.51 + */
   20.52 +public class RootNode extends RuleNode {
   20.53 +
   20.54 +    public RootNode(CharSequence source) {
   20.55 +        super(NodeType.root, source);
   20.56 +    }
   20.57 +    
   20.58 +    @Override
   20.59 +    public int from() {
   20.60 +        return 0;
   20.61 +    }
   20.62 +
   20.63 +    @Override
   20.64 +    public int to() {
   20.65 +        return getSource().length();
   20.66 +    }
   20.67 +    
   20.68 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/RuleNode.java	Mon Jan 14 15:49:16 2013 +0100
    21.3 @@ -0,0 +1,91 @@
    21.4 +/*
    21.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    21.6 + *
    21.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    21.8 + *
    21.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   21.10 + * Other names may be trademarks of their respective owners.
   21.11 + *
   21.12 + * The contents of this file are subject to the terms of either the GNU
   21.13 + * General Public License Version 2 only ("GPL") or the Common
   21.14 + * Development and Distribution License("CDDL") (collectively, the
   21.15 + * "License"). You may not use this file except in compliance with the
   21.16 + * License. You can obtain a copy of the License at
   21.17 + * http://www.netbeans.org/cddl-gplv2.html
   21.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   21.19 + * specific language governing permissions and limitations under the
   21.20 + * License.  When distributing the software, include this License Header
   21.21 + * Notice in each file and include the License file at
   21.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   21.23 + * particular file as subject to the "Classpath" exception as provided
   21.24 + * by Oracle in the GPL Version 2 section of the License file that
   21.25 + * accompanied this code. If applicable, add the following below the
   21.26 + * License Header, with the fields enclosed by brackets [] replaced by
   21.27 + * your own identifying information:
   21.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   21.29 + *
   21.30 + * If you wish your version of this file to be governed by only the CDDL
   21.31 + * or only the GPL Version 2, indicate your decision by adding
   21.32 + * "[Contributor] elects to include this software in this distribution
   21.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   21.34 + * single choice of license, a recipient has the option to distribute
   21.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   21.36 + * to extend the choice of license to its licensees as provided above.
   21.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   21.38 + * Version 2 license, then the option applies only if the new code is
   21.39 + * made subject to such option by the copyright holder.
   21.40 + *
   21.41 + * Contributor(s):
   21.42 + *
   21.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   21.44 + */
   21.45 +package org.netbeans.modules.antlr.editor;
   21.46 +
   21.47 +import org.antlr.runtime.CommonToken;
   21.48 +
   21.49 +/**
   21.50 + *
   21.51 + * @author marekfukala
   21.52 + */
   21.53 +public class RuleNode extends AbstractParseTreeNode {
   21.54 +    
   21.55 +    private NodeType rule;
   21.56 +    int from = -1, to = -1;
   21.57 +    
   21.58 +    RuleNode(NodeType rule, CharSequence source) {
   21.59 +        super(source);
   21.60 +        this.rule = rule;
   21.61 +    }
   21.62 +    
   21.63 +    //used by NbParseTreeBuilder
   21.64 +    void setFirstToken(CommonToken token) {
   21.65 +        assert token != null : "Attempting to set null first token in rule " + name();
   21.66 +        this.from = CommonTokenUtil.getCommonTokenOffsetRange(token)[0];
   21.67 +    }
   21.68 +    
   21.69 +    void setLastToken(CommonToken token) {
   21.70 +        assert token != null : "Attempting to set null last token in rule " + name();
   21.71 +        this.to = CommonTokenUtil.getCommonTokenOffsetRange(token)[1];
   21.72 +    }
   21.73 +
   21.74 +    @Override
   21.75 +    public int from() {
   21.76 +        return from;
   21.77 +    }
   21.78 +
   21.79 +    @Override
   21.80 +    public int to() {
   21.81 +        return to;
   21.82 +    }
   21.83 +
   21.84 +    @Override
   21.85 +    public NodeType type() {
   21.86 +        return rule;
   21.87 +    }
   21.88 +
   21.89 +    @Override
   21.90 +    public String name() {
   21.91 +        return type().name();
   21.92 +    }
   21.93 +
   21.94 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/TokenNode.java	Mon Jan 14 15:49:16 2013 +0100
    22.3 @@ -0,0 +1,109 @@
    22.4 +/*
    22.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    22.6 + *
    22.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    22.8 + *
    22.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   22.10 + * Other names may be trademarks of their respective owners.
   22.11 + *
   22.12 + * The contents of this file are subject to the terms of either the GNU
   22.13 + * General Public License Version 2 only ("GPL") or the Common
   22.14 + * Development and Distribution License("CDDL") (collectively, the
   22.15 + * "License"). You may not use this file except in compliance with the
   22.16 + * License. You can obtain a copy of the License at
   22.17 + * http://www.netbeans.org/cddl-gplv2.html
   22.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   22.19 + * specific language governing permissions and limitations under the
   22.20 + * License.  When distributing the software, include this License Header
   22.21 + * Notice in each file and include the License file at
   22.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   22.23 + * particular file as subject to the "Classpath" exception as provided
   22.24 + * by Oracle in the GPL Version 2 section of the License file that
   22.25 + * accompanied this code. If applicable, add the following below the
   22.26 + * License Header, with the fields enclosed by brackets [] replaced by
   22.27 + * your own identifying information:
   22.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   22.29 + *
   22.30 + * If you wish your version of this file to be governed by only the CDDL
   22.31 + * or only the GPL Version 2, indicate your decision by adding
   22.32 + * "[Contributor] elects to include this software in this distribution
   22.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   22.34 + * single choice of license, a recipient has the option to distribute
   22.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   22.36 + * to extend the choice of license to its licensees as provided above.
   22.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   22.38 + * Version 2 license, then the option applies only if the new code is
   22.39 + * made subject to such option by the copyright holder.
   22.40 + *
   22.41 + * Contributor(s):
   22.42 + *
   22.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   22.44 + */
   22.45 +package org.netbeans.modules.antlr.editor;
   22.46 +
   22.47 +import org.antlr.runtime.CommonToken;
   22.48 +
   22.49 +/**
   22.50 + *
   22.51 + * @author marekfukala
   22.52 + */
   22.53 +public class TokenNode extends AbstractParseTreeNode {
   22.54 +
   22.55 +    private final int from, to;
   22.56 +    private AntlrTokenId tokenId;
   22.57 +
   22.58 +    public TokenNode(CharSequence source, CommonToken token) {
   22.59 +        super(source); 
   22.60 +        int[] range = CommonTokenUtil.getCommonTokenOffsetRange(token);
   22.61 +        from = range[0];
   22.62 +        to = range[1];
   22.63 +        tokenId = AntlrTokenId.forTokenTypeCode(token.getType());
   22.64 +    }
   22.65 +
   22.66 +    @Override
   22.67 +    public String name() {
   22.68 +        return image().toString();
   22.69 +    }
   22.70 +    
   22.71 +    @Override
   22.72 +    public NodeType type() {
   22.73 +        return NodeType.token;
   22.74 +    }
   22.75 +
   22.76 +    /**
   22.77 +     * Gets the kind of the token encapsulated by this TokenNode. Please notice
   22.78 +     * that it's not possible to get the token itself since the parser source
   22.79 +     * is not a stream of the netbeans tokens, but tokens generated by the antlr lexer.
   22.80 +     */
   22.81 +    public AntlrTokenId getTokenId() {
   22.82 +        return tokenId;
   22.83 +    }
   22.84 +
   22.85 +    @Override
   22.86 +    public int from() {
   22.87 +        return from;
   22.88 +    }
   22.89 +
   22.90 +    @Override
   22.91 +    public int to() {
   22.92 +        return to;
   22.93 +    }
   22.94 +
   22.95 +    @Override
   22.96 +    public String toString() {
   22.97 +        return new StringBuilder(super.toString())
   22.98 +                .append(' ')
   22.99 +                .append('\'')
  22.100 +                .append(escapeNL(image()))
  22.101 +                .append('\'')
  22.102 +                .append(' ')
  22.103 +                .append('[')
  22.104 +                .append(getTokenId())
  22.105 +                .append(']')
  22.106 +                .toString();
  22.107 +    }
  22.108 +    
  22.109 +    private CharSequence escapeNL(CharSequence text) {
  22.110 +        return text.toString().replaceAll("\n", "\\\\n");
  22.111 +    }
  22.112 +}
    23.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Lexer.java	Mon Jan 14 13:28:06 2013 +0100
    23.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Lexer.java	Mon Jan 14 15:49:16 2013 +0100
    23.3 @@ -1,6 +1,6 @@
    23.4 -// $ANTLR 3.3 Nov 30, 2010 12:50:56 /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g 2013-01-11 15:01:27
    23.5 -
    23.6 -package org.netbeans.antlr.editor.gen;
    23.7 +// $ANTLR 3.3 Nov 30, 2010 12:50:56 /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g 2013-01-14 14:05:31
    23.8 +
    23.9 +package org.netbeans.modules.antlr.editor.gen;
   23.10  
   23.11  
   23.12  import org.antlr.runtime.*;
    24.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Parser.java	Mon Jan 14 13:28:06 2013 +0100
    24.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Parser.java	Mon Jan 14 15:49:16 2013 +0100
    24.3 @@ -1,6 +1,6 @@
    24.4 -// $ANTLR 3.3 Nov 30, 2010 12:50:56 /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g 2013-01-11 15:01:26
    24.5 -
    24.6 -package org.netbeans.antlr.editor.gen;
    24.7 +// $ANTLR 3.3 Nov 30, 2010 12:50:56 /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g 2013-01-14 14:05:30
    24.8 +
    24.9 +package org.netbeans.modules.antlr.editor.gen;
   24.10  
   24.11  
   24.12  import org.antlr.runtime.*;
   24.13 @@ -115,17 +115,17 @@
   24.14      // delegators
   24.15  
   24.16      public static final String[] ruleNames = new String[] {
   24.17 -        "invalidRule", "elementNoOptionSpec", "ruleAction", "synpred2_ANTLRv3", 
   24.18 -        "rewrite_tree_ebnf", "id", "rule", "treeSpec", "rewrite_template", 
   24.19 -        "tokensSpec", "ebnfSuffix", "alternative", "notTerminal", "terminal", 
   24.20 -        "ruleScopeSpec", "notSet", "range", "ebnf", "rewrite_alternative", 
   24.21 -        "rewrite_template_ref", "rewrite_tree_block", "option", "exceptionHandler", 
   24.22 -        "synpred1_ANTLRv3", "rewrite_template_args", "throwsSpec", "actionScopeName", 
   24.23 -        "finallyClause", "rewrite_tree_element", "rewrite_tree_alternative", 
   24.24 -        "optionsSpec", "rewrite_template_arg", "tokenSpec", "attrScope", 
   24.25 -        "altList", "exceptionGroup", "atom", "rewrite_tree", "element", 
   24.26 -        "rewrite_tree_atom", "rewrite_indirect_template_head", "grammarDef", 
   24.27 -        "block", "rewrite", "optionValue", "action"
   24.28 +        "invalidRule", "ebnf", "finallyClause", "notSet", "option", "attrScope", 
   24.29 +        "element", "tokensSpec", "treeSpec", "ruleScopeSpec", "tokenSpec", 
   24.30 +        "rewrite_tree_ebnf", "optionsSpec", "rewrite_template_ref", "throwsSpec", 
   24.31 +        "exceptionGroup", "ebnfSuffix", "rewrite_alternative", "rewrite_tree", 
   24.32 +        "synpred1_ANTLRv3", "elementNoOptionSpec", "block", "rule", "rewrite_template", 
   24.33 +        "rewrite_tree_alternative", "terminal", "rewrite_tree_block", "range", 
   24.34 +        "rewrite_tree_atom", "altList", "rewrite_template_arg", "rewrite", 
   24.35 +        "action", "rewrite_tree_element", "ruleAction", "grammarDef", "synpred2_ANTLRv3", 
   24.36 +        "actionScopeName", "id", "rewrite_template_args", "notTerminal", 
   24.37 +        "optionValue", "alternative", "atom", "rewrite_indirect_template_head", 
   24.38 +        "exceptionHandler"
   24.39      };
   24.40      public static final boolean[] decisionCanBacktrack = new boolean[] {
   24.41          false, // invalid decision
   24.42 @@ -610,7 +610,7 @@
   24.43  
   24.44  
   24.45              // AST REWRITE
   24.46 -            // elements: tokensSpec, DOC_COMMENT, rule, action, optionsSpec, id, attrScope
   24.47 +            // elements: optionsSpec, action, tokensSpec, attrScope, id, rule, DOC_COMMENT
   24.48              // token labels: 
   24.49              // rule labels: retval
   24.50              // token list labels: 
   24.51 @@ -1015,7 +1015,7 @@
   24.52  
   24.53  
   24.54                      // AST REWRITE
   24.55 -                    // elements: lit, TOKEN_REF, 71
   24.56 +                    // elements: TOKEN_REF, lit, 71
   24.57                      // token labels: lit
   24.58                      // rule labels: retval
   24.59                      // token list labels: 
   24.60 @@ -1169,7 +1169,7 @@
   24.61  
   24.62  
   24.63              // AST REWRITE
   24.64 -            // elements: ACTION, SCOPE, id
   24.65 +            // elements: id, ACTION, SCOPE
   24.66              // token labels: 
   24.67              // rule labels: retval
   24.68              // token list labels: 
   24.69 @@ -1348,7 +1348,7 @@
   24.70  
   24.71  
   24.72              // AST REWRITE
   24.73 -            // elements: ACTION, id, 72, actionScopeName
   24.74 +            // elements: 72, ACTION, id, actionScopeName
   24.75              // token labels: 
   24.76              // rule labels: retval
   24.77              // token list labels: 
   24.78 @@ -1695,7 +1695,7 @@
   24.79  
   24.80  
   24.81              // AST REWRITE
   24.82 -            // elements: OPTIONS, option
   24.83 +            // elements: option, OPTIONS
   24.84              // token labels: 
   24.85              // rule labels: retval
   24.86              // token list labels: 
   24.87 @@ -1818,7 +1818,7 @@
   24.88  
   24.89  
   24.90              // AST REWRITE
   24.91 -            // elements: 71, optionValue, id
   24.92 +            // elements: id, optionValue, 71
   24.93              // token labels: 
   24.94              // rule labels: retval
   24.95              // token list labels: 
   24.96 @@ -2613,7 +2613,7 @@
   24.97  
   24.98  
   24.99              // AST REWRITE
  24.100 -            // elements: ruleAction, arg, optionsSpec, ruleScopeSpec, id, altList, exceptionGroup, rt
  24.101 +            // elements: ruleScopeSpec, arg, altList, exceptionGroup, ruleAction, rt, id, optionsSpec
  24.102              // token labels: arg, rt
  24.103              // rule labels: retval
  24.104              // token list labels: 
  24.105 @@ -2802,7 +2802,7 @@
  24.106  
  24.107  
  24.108              // AST REWRITE
  24.109 -            // elements: id, 72, ACTION
  24.110 +            // elements: ACTION, id, 72
  24.111              // token labels: 
  24.112              // rule labels: retval
  24.113              // token list labels: 
  24.114 @@ -3245,7 +3245,7 @@
  24.115  
  24.116  
  24.117                      // AST REWRITE
  24.118 -                    // elements: SCOPE, id
  24.119 +                    // elements: id, SCOPE
  24.120                      // token labels: 
  24.121                      // rule labels: retval
  24.122                      // token list labels: 
  24.123 @@ -3622,7 +3622,7 @@
  24.124  
  24.125  
  24.126              // AST REWRITE
  24.127 -            // elements: rewrite, optionsSpec, alternative
  24.128 +            // elements: optionsSpec, alternative, rewrite
  24.129              // token labels: 
  24.130              // rule labels: retval
  24.131              // token list labels: 
  24.132 @@ -3821,7 +3821,7 @@
  24.133  
  24.134  
  24.135              // AST REWRITE
  24.136 -            // elements: rewrite, alternative
  24.137 +            // elements: alternative, rewrite
  24.138              // token labels: 
  24.139              // rule labels: retval
  24.140              // token list labels: 
  24.141 @@ -4463,7 +4463,7 @@
  24.142  
  24.143  
  24.144              // AST REWRITE
  24.145 -            // elements: 86, ACTION
  24.146 +            // elements: ACTION, 86
  24.147              // token labels: 
  24.148              // rule labels: retval
  24.149              // token list labels: 
  24.150 @@ -4778,7 +4778,7 @@
  24.151  
  24.152  
  24.153                              // AST REWRITE
  24.154 -                            // elements: ebnfSuffix, labelOp, atom, id
  24.155 +                            // elements: atom, labelOp, id, ebnfSuffix
  24.156                              // token labels: labelOp
  24.157                              // rule labels: retval
  24.158                              // token list labels: 
  24.159 @@ -4853,7 +4853,7 @@
  24.160                              {
  24.161  
  24.162                              // AST REWRITE
  24.163 -                            // elements: atom, labelOp, id
  24.164 +                            // elements: id, atom, labelOp
  24.165                              // token labels: labelOp
  24.166                              // rule labels: retval
  24.167                              // token list labels: 
  24.168 @@ -5006,7 +5006,7 @@
  24.169  
  24.170  
  24.171                              // AST REWRITE
  24.172 -                            // elements: labelOp, ebnfSuffix, block, id
  24.173 +                            // elements: id, ebnfSuffix, block, labelOp
  24.174                              // token labels: labelOp
  24.175                              // rule labels: retval
  24.176                              // token list labels: 
  24.177 @@ -5174,7 +5174,7 @@
  24.178  
  24.179  
  24.180                              // AST REWRITE
  24.181 -                            // elements: ebnfSuffix, atom
  24.182 +                            // elements: atom, ebnfSuffix
  24.183                              // token labels: 
  24.184                              // rule labels: retval
  24.185                              // token list labels: 
  24.186 @@ -5451,7 +5451,7 @@
  24.187  
  24.188  
  24.189                              // AST REWRITE
  24.190 -                            // elements: ebnfSuffix, treeSpec
  24.191 +                            // elements: treeSpec, ebnfSuffix
  24.192                              // token labels: 
  24.193                              // rule labels: retval
  24.194                              // token list labels: 
  24.195 @@ -5944,7 +5944,7 @@
  24.196  
  24.197  
  24.198                              // AST REWRITE
  24.199 -                            // elements: notSet, op
  24.200 +                            // elements: op, notSet
  24.201                              // token labels: op
  24.202                              // rule labels: retval
  24.203                              // token list labels: 
  24.204 @@ -6132,7 +6132,7 @@
  24.205  
  24.206  
  24.207                      // AST REWRITE
  24.208 -                    // elements: op, op, RULE_REF, arg, RULE_REF, RULE_REF, RULE_REF, arg
  24.209 +                    // elements: RULE_REF, op, arg, RULE_REF, arg, op, RULE_REF, RULE_REF
  24.210                      // token labels: arg, op
  24.211                      // rule labels: retval
  24.212                      // token list labels: 
  24.213 @@ -6314,7 +6314,7 @@
  24.214  
  24.215  
  24.216                      // AST REWRITE
  24.217 -                    // elements: 89, notTerminal
  24.218 +                    // elements: notTerminal, 89
  24.219                      // token labels: 
  24.220                      // rule labels: retval
  24.221                      // token list labels: 
  24.222 @@ -6360,7 +6360,7 @@
  24.223  
  24.224  
  24.225                      // AST REWRITE
  24.226 -                    // elements: block, 89
  24.227 +                    // elements: 89, block
  24.228                      // token labels: 
  24.229                      // rule labels: retval
  24.230                      // token list labels: 
  24.231 @@ -6999,7 +6999,7 @@
  24.232  
  24.233  
  24.234              // AST REWRITE
  24.235 -            // elements: c1, c2
  24.236 +            // elements: c2, c1
  24.237              // token labels: c1, c2
  24.238              // rule labels: retval
  24.239              // token list labels: 
  24.240 @@ -7393,7 +7393,7 @@
  24.241  
  24.242  
  24.243                      // AST REWRITE
  24.244 -                    // elements: ROOT, terminal
  24.245 +                    // elements: terminal, ROOT
  24.246                      // token labels: 
  24.247                      // rule labels: retval
  24.248                      // token list labels: 
  24.249 @@ -7917,7 +7917,7 @@
  24.250  
  24.251  
  24.252                      // AST REWRITE
  24.253 -                    // elements: predicated, last, preds, rew2, rew
  24.254 +                    // elements: predicated, preds, last, rew, rew2
  24.255                      // token labels: rew2
  24.256                      // rule labels: retval, last
  24.257                      // token list labels: rew, preds
  24.258 @@ -9271,7 +9271,7 @@
  24.259  
  24.260  
  24.261              // AST REWRITE
  24.262 -            // elements: rewrite_tree_element, rewrite_tree_atom
  24.263 +            // elements: rewrite_tree_atom, rewrite_tree_element
  24.264              // token labels: 
  24.265              // rule labels: retval
  24.266              // token list labels: 
  24.267 @@ -9479,7 +9479,7 @@
  24.268  
  24.269  
  24.270                      // AST REWRITE
  24.271 -                    // elements: id, str, rewrite_template_args
  24.272 +                    // elements: rewrite_template_args, str, id
  24.273                      // token labels: str
  24.274                      // rule labels: retval
  24.275                      // token list labels: 
  24.276 @@ -9791,7 +9791,7 @@
  24.277  
  24.278  
  24.279              // AST REWRITE
  24.280 -            // elements: ACTION, rewrite_template_args
  24.281 +            // elements: rewrite_template_args, ACTION
  24.282              // token labels: 
  24.283              // rule labels: retval
  24.284              // token list labels: 
  24.285 @@ -10114,7 +10114,7 @@
  24.286  
  24.287  
  24.288              // AST REWRITE
  24.289 -            // elements: ACTION, id
  24.290 +            // elements: id, ACTION
  24.291              // token labels: 
  24.292              // rule labels: retval
  24.293              // token list labels: 
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.java	Mon Jan 14 15:49:16 2013 +0100
    25.3 @@ -0,0 +1,5081 @@
    25.4 +// $ANTLR 3.3 Nov 30, 2010 12:50:56 /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g 2013-01-14 14:05:33
    25.5 +
    25.6 +package org.netbeans.modules.antlr.editor.gen;
    25.7 +
    25.8 +
    25.9 +import org.antlr.runtime.*;
   25.10 +import org.antlr.runtime.tree.*;import java.util.Stack;
   25.11 +import java.util.List;
   25.12 +import java.util.ArrayList;
   25.13 +
   25.14 +import org.antlr.runtime.debug.*;
   25.15 +import java.io.IOException;
   25.16 +/** ANTLR v3 tree grammar to walk trees created by ANTLRv3.g */
   25.17 +public class ANTLRv3Tree extends DebugTreeParser {
   25.18 +    public static final String[] tokenNames = new String[] {
   25.19 +        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "DOC_COMMENT", "PARSER", "LEXER", "RULE", "BLOCK", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "RANGE", "CHAR_RANGE", "EPSILON", "ALT", "EOR", "EOB", "EOA", "ID", "ARG", "ARGLIST", "RET", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "TEMPLATE", "SCOPE", "SEMPRED", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "FRAGMENT", "TREE_BEGIN", "ROOT", "BANG", "REWRITE", "TOKENS", "TOKEN_REF", "STRING_LITERAL", "CHAR_LITERAL", "ACTION", "OPTIONS", "INT", "ARG_ACTION", "RULE_REF", "DOUBLE_QUOTE_STRING_LITERAL", "DOUBLE_ANGLE_STRING_LITERAL", "SRC", "SL_COMMENT", "ML_COMMENT", "LITERAL_CHAR", "ESC", "XDIGIT", "NESTED_ARG_ACTION", "ACTION_STRING_LITERAL", "ACTION_CHAR_LITERAL", "NESTED_ACTION", "ACTION_ESC", "WS_LOOP", "WS", "'lexer'", "'parser'", "'tree'", "'grammar'", "';'", "'}'", "'='", "'@'", "'::'", "'*'", "'protected'", "'public'", "'private'", "'returns'", "':'", "'throws'", "','", "'('", "'|'", "')'", "'catch'", "'finally'", "'+='", "'=>'", "'~'", "'?'", "'+'", "'.'", "'$'"
   25.20 +    };
   25.21 +    public static final int EOF=-1;
   25.22 +    public static final int T__65=65;
   25.23 +    public static final int T__66=66;
   25.24 +    public static final int T__67=67;
   25.25 +    public static final int T__68=68;
   25.26 +    public static final int T__69=69;
   25.27 +    public static final int T__70=70;
   25.28 +    public static final int T__71=71;
   25.29 +    public static final int T__72=72;
   25.30 +    public static final int T__73=73;
   25.31 +    public static final int T__74=74;
   25.32 +    public static final int T__75=75;
   25.33 +    public static final int T__76=76;
   25.34 +    public static final int T__77=77;
   25.35 +    public static final int T__78=78;
   25.36 +    public static final int T__79=79;
   25.37 +    public static final int T__80=80;
   25.38 +    public static final int T__81=81;
   25.39 +    public static final int T__82=82;
   25.40 +    public static final int T__83=83;
   25.41 +    public static final int T__84=84;
   25.42 +    public static final int T__85=85;
   25.43 +    public static final int T__86=86;
   25.44 +    public static final int T__87=87;
   25.45 +    public static final int T__88=88;
   25.46 +    public static final int T__89=89;
   25.47 +    public static final int T__90=90;
   25.48 +    public static final int T__91=91;
   25.49 +    public static final int T__92=92;
   25.50 +    public static final int T__93=93;
   25.51 +    public static final int DOC_COMMENT=4;
   25.52 +    public static final int PARSER=5;
   25.53 +    public static final int LEXER=6;
   25.54 +    public static final int RULE=7;
   25.55 +    public static final int BLOCK=8;
   25.56 +    public static final int OPTIONAL=9;
   25.57 +    public static final int CLOSURE=10;
   25.58 +    public static final int POSITIVE_CLOSURE=11;
   25.59 +    public static final int SYNPRED=12;
   25.60 +    public static final int RANGE=13;
   25.61 +    public static final int CHAR_RANGE=14;
   25.62 +    public static final int EPSILON=15;
   25.63 +    public static final int ALT=16;
   25.64 +    public static final int EOR=17;
   25.65 +    public static final int EOB=18;
   25.66 +    public static final int EOA=19;
   25.67 +    public static final int ID=20;
   25.68 +    public static final int ARG=21;
   25.69 +    public static final int ARGLIST=22;
   25.70 +    public static final int RET=23;
   25.71 +    public static final int LEXER_GRAMMAR=24;
   25.72 +    public static final int PARSER_GRAMMAR=25;
   25.73 +    public static final int TREE_GRAMMAR=26;
   25.74 +    public static final int COMBINED_GRAMMAR=27;
   25.75 +    public static final int INITACTION=28;
   25.76 +    public static final int LABEL=29;
   25.77 +    public static final int TEMPLATE=30;
   25.78 +    public static final int SCOPE=31;
   25.79 +    public static final int SEMPRED=32;
   25.80 +    public static final int GATED_SEMPRED=33;
   25.81 +    public static final int SYN_SEMPRED=34;
   25.82 +    public static final int BACKTRACK_SEMPRED=35;
   25.83 +    public static final int FRAGMENT=36;
   25.84 +    public static final int TREE_BEGIN=37;
   25.85 +    public static final int ROOT=38;
   25.86 +    public static final int BANG=39;
   25.87 +    public static final int REWRITE=40;
   25.88 +    public static final int TOKENS=41;
   25.89 +    public static final int TOKEN_REF=42;
   25.90 +    public static final int STRING_LITERAL=43;
   25.91 +    public static final int CHAR_LITERAL=44;
   25.92 +    public static final int ACTION=45;
   25.93 +    public static final int OPTIONS=46;
   25.94 +    public static final int INT=47;
   25.95 +    public static final int ARG_ACTION=48;
   25.96 +    public static final int RULE_REF=49;
   25.97 +    public static final int DOUBLE_QUOTE_STRING_LITERAL=50;
   25.98 +    public static final int DOUBLE_ANGLE_STRING_LITERAL=51;
   25.99 +    public static final int SRC=52;
  25.100 +    public static final int SL_COMMENT=53;
  25.101 +    public static final int ML_COMMENT=54;
  25.102 +    public static final int LITERAL_CHAR=55;
  25.103 +    public static final int ESC=56;
  25.104 +    public static final int XDIGIT=57;
  25.105 +    public static final int NESTED_ARG_ACTION=58;
  25.106 +    public static final int ACTION_STRING_LITERAL=59;
  25.107 +    public static final int ACTION_CHAR_LITERAL=60;
  25.108 +    public static final int NESTED_ACTION=61;
  25.109 +    public static final int ACTION_ESC=62;
  25.110 +    public static final int WS_LOOP=63;
  25.111 +    public static final int WS=64;
  25.112 +
  25.113 +    // delegates
  25.114 +    // delegators
  25.115 +
  25.116 +    public static final String[] ruleNames = new String[] {
  25.117 +        "invalidRule", "rewrite_tree_ebnf", "modifier", "rewrite_indirect_template_head", 
  25.118 +        "grammarType", "rewrite_tree_element", "terminal", "ruleAction", 
  25.119 +        "elementNoOptionSpec", "rewrite_template_args", "tokensSpec", "option", 
  25.120 +        "atom", "altList", "action", "rewrite_tree_block", "optionValue", 
  25.121 +        "rewrite_tree_alternative", "attrScope", "tokenSpec", "rewrite_template", 
  25.122 +        "rewrite_tree", "rewrite", "exceptionGroup", "block", "notTerminal", 
  25.123 +        "exceptionHandler", "notSet", "rewrite_tree_atom", "rewrite_alternative", 
  25.124 +        "ebnfSuffix", "range", "ebnf", "throwsSpec", "optionsSpec", "grammarDef", 
  25.125 +        "alternative", "rewrite_template_ref", "treeSpec", "finallyClause", 
  25.126 +        "element", "ruleScopeSpec", "rewrite_template_arg", "rule"
  25.127 +    };
  25.128 +    public static final boolean[] decisionCanBacktrack = new boolean[] {
  25.129 +        false, // invalid decision
  25.130 +        false, false, false, false, false, false, false, false, false, false, 
  25.131 +            false, false, false, false, false, false, false, false, false, 
  25.132 +            false, false, false, false, false, false, false, false, false, 
  25.133 +            false, false, false, false, false, false, false, false, false, 
  25.134 +            false, false, false, false, false, false, false, false
  25.135 +    };
  25.136 +
  25.137 +     
  25.138 +        public int ruleLevel = 0;
  25.139 +        public int getRuleLevel() { return ruleLevel; }
  25.140 +        public void incRuleLevel() { ruleLevel++; }
  25.141 +        public void decRuleLevel() { ruleLevel--; }
  25.142 +        public ANTLRv3Tree(TreeNodeStream input) {
  25.143 +            this(input, DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT, new RecognizerSharedState());
  25.144 +        }
  25.145 +        public ANTLRv3Tree(TreeNodeStream input, int port, RecognizerSharedState state) {
  25.146 +            super(input, state);
  25.147 +            DebugEventSocketProxy proxy =
  25.148 +                new DebugEventSocketProxy(this, port, input.getTreeAdaptor());
  25.149 +            setDebugListener(proxy);
  25.150 +            try {
  25.151 +                proxy.handshake();
  25.152 +            }
  25.153 +            catch (IOException ioe) {
  25.154 +                reportError(ioe);
  25.155 +            }
  25.156 +        }
  25.157 +    public ANTLRv3Tree(TreeNodeStream input, DebugEventListener dbg) {
  25.158 +        super(input, dbg, new RecognizerSharedState());
  25.159 +
  25.160 +    }
  25.161 +    protected boolean evalPredicate(boolean result, String predicate) {
  25.162 +        dbg.semanticPredicate(result, predicate);
  25.163 +        return result;
  25.164 +    }
  25.165 +
  25.166 +
  25.167 +    public String[] getTokenNames() { return ANTLRv3Tree.tokenNames; }
  25.168 +    public String getGrammarFileName() { return "/Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g"; }
  25.169 +
  25.170 +
  25.171 +
  25.172 +    // $ANTLR start "grammarDef"
  25.173 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:41:1: grammarDef : ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ ) ;
  25.174 +    public final void grammarDef() throws RecognitionException {
  25.175 +        try { dbg.enterRule(getGrammarFileName(), "grammarDef");
  25.176 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.177 +        incRuleLevel();
  25.178 +        dbg.location(41, 1);
  25.179 +
  25.180 +        try {
  25.181 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:5: ( ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ ) )
  25.182 +            dbg.enterAlt(1);
  25.183 +
  25.184 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:9: ^( grammarType ID ( DOC_COMMENT )? ( optionsSpec )? ( tokensSpec )? ( attrScope )* ( action )* ( rule )+ )
  25.185 +            {
  25.186 +            dbg.location(42,9);
  25.187 +            dbg.location(42,12);
  25.188 +            pushFollow(FOLLOW_grammarType_in_grammarDef52);
  25.189 +            grammarType();
  25.190 +
  25.191 +            state._fsp--;
  25.192 +
  25.193 +
  25.194 +            match(input, Token.DOWN, null); 
  25.195 +            dbg.location(42,24);
  25.196 +            match(input,ID,FOLLOW_ID_in_grammarDef54); 
  25.197 +            dbg.location(42,27);
  25.198 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:27: ( DOC_COMMENT )?
  25.199 +            int alt1=2;
  25.200 +            try { dbg.enterSubRule(1);
  25.201 +            try { dbg.enterDecision(1, decisionCanBacktrack[1]);
  25.202 +
  25.203 +            int LA1_0 = input.LA(1);
  25.204 +
  25.205 +            if ( (LA1_0==DOC_COMMENT) ) {
  25.206 +                alt1=1;
  25.207 +            }
  25.208 +            } finally {dbg.exitDecision(1);}
  25.209 +
  25.210 +            switch (alt1) {
  25.211 +                case 1 :
  25.212 +                    dbg.enterAlt(1);
  25.213 +
  25.214 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:27: DOC_COMMENT
  25.215 +                    {
  25.216 +                    dbg.location(42,27);
  25.217 +                    match(input,DOC_COMMENT,FOLLOW_DOC_COMMENT_in_grammarDef56); 
  25.218 +
  25.219 +                    }
  25.220 +                    break;
  25.221 +
  25.222 +            }
  25.223 +            } finally {dbg.exitSubRule(1);}
  25.224 +
  25.225 +            dbg.location(42,40);
  25.226 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:40: ( optionsSpec )?
  25.227 +            int alt2=2;
  25.228 +            try { dbg.enterSubRule(2);
  25.229 +            try { dbg.enterDecision(2, decisionCanBacktrack[2]);
  25.230 +
  25.231 +            int LA2_0 = input.LA(1);
  25.232 +
  25.233 +            if ( (LA2_0==OPTIONS) ) {
  25.234 +                alt2=1;
  25.235 +            }
  25.236 +            } finally {dbg.exitDecision(2);}
  25.237 +
  25.238 +            switch (alt2) {
  25.239 +                case 1 :
  25.240 +                    dbg.enterAlt(1);
  25.241 +
  25.242 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:40: optionsSpec
  25.243 +                    {
  25.244 +                    dbg.location(42,40);
  25.245 +                    pushFollow(FOLLOW_optionsSpec_in_grammarDef59);
  25.246 +                    optionsSpec();
  25.247 +
  25.248 +                    state._fsp--;
  25.249 +
  25.250 +
  25.251 +                    }
  25.252 +                    break;
  25.253 +
  25.254 +            }
  25.255 +            } finally {dbg.exitSubRule(2);}
  25.256 +
  25.257 +            dbg.location(42,53);
  25.258 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:53: ( tokensSpec )?
  25.259 +            int alt3=2;
  25.260 +            try { dbg.enterSubRule(3);
  25.261 +            try { dbg.enterDecision(3, decisionCanBacktrack[3]);
  25.262 +
  25.263 +            int LA3_0 = input.LA(1);
  25.264 +
  25.265 +            if ( (LA3_0==TOKENS) ) {
  25.266 +                alt3=1;
  25.267 +            }
  25.268 +            } finally {dbg.exitDecision(3);}
  25.269 +
  25.270 +            switch (alt3) {
  25.271 +                case 1 :
  25.272 +                    dbg.enterAlt(1);
  25.273 +
  25.274 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:53: tokensSpec
  25.275 +                    {
  25.276 +                    dbg.location(42,53);
  25.277 +                    pushFollow(FOLLOW_tokensSpec_in_grammarDef62);
  25.278 +                    tokensSpec();
  25.279 +
  25.280 +                    state._fsp--;
  25.281 +
  25.282 +
  25.283 +                    }
  25.284 +                    break;
  25.285 +
  25.286 +            }
  25.287 +            } finally {dbg.exitSubRule(3);}
  25.288 +
  25.289 +            dbg.location(42,65);
  25.290 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:65: ( attrScope )*
  25.291 +            try { dbg.enterSubRule(4);
  25.292 +
  25.293 +            loop4:
  25.294 +            do {
  25.295 +                int alt4=2;
  25.296 +                try { dbg.enterDecision(4, decisionCanBacktrack[4]);
  25.297 +
  25.298 +                int LA4_0 = input.LA(1);
  25.299 +
  25.300 +                if ( (LA4_0==SCOPE) ) {
  25.301 +                    alt4=1;
  25.302 +                }
  25.303 +
  25.304 +
  25.305 +                } finally {dbg.exitDecision(4);}
  25.306 +
  25.307 +                switch (alt4) {
  25.308 +            	case 1 :
  25.309 +            	    dbg.enterAlt(1);
  25.310 +
  25.311 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:65: attrScope
  25.312 +            	    {
  25.313 +            	    dbg.location(42,65);
  25.314 +            	    pushFollow(FOLLOW_attrScope_in_grammarDef65);
  25.315 +            	    attrScope();
  25.316 +
  25.317 +            	    state._fsp--;
  25.318 +
  25.319 +
  25.320 +            	    }
  25.321 +            	    break;
  25.322 +
  25.323 +            	default :
  25.324 +            	    break loop4;
  25.325 +                }
  25.326 +            } while (true);
  25.327 +            } finally {dbg.exitSubRule(4);}
  25.328 +
  25.329 +            dbg.location(42,76);
  25.330 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:76: ( action )*
  25.331 +            try { dbg.enterSubRule(5);
  25.332 +
  25.333 +            loop5:
  25.334 +            do {
  25.335 +                int alt5=2;
  25.336 +                try { dbg.enterDecision(5, decisionCanBacktrack[5]);
  25.337 +
  25.338 +                int LA5_0 = input.LA(1);
  25.339 +
  25.340 +                if ( (LA5_0==72) ) {
  25.341 +                    alt5=1;
  25.342 +                }
  25.343 +
  25.344 +
  25.345 +                } finally {dbg.exitDecision(5);}
  25.346 +
  25.347 +                switch (alt5) {
  25.348 +            	case 1 :
  25.349 +            	    dbg.enterAlt(1);
  25.350 +
  25.351 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:76: action
  25.352 +            	    {
  25.353 +            	    dbg.location(42,76);
  25.354 +            	    pushFollow(FOLLOW_action_in_grammarDef68);
  25.355 +            	    action();
  25.356 +
  25.357 +            	    state._fsp--;
  25.358 +
  25.359 +
  25.360 +            	    }
  25.361 +            	    break;
  25.362 +
  25.363 +            	default :
  25.364 +            	    break loop5;
  25.365 +                }
  25.366 +            } while (true);
  25.367 +            } finally {dbg.exitSubRule(5);}
  25.368 +
  25.369 +            dbg.location(42,84);
  25.370 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:84: ( rule )+
  25.371 +            int cnt6=0;
  25.372 +            try { dbg.enterSubRule(6);
  25.373 +
  25.374 +            loop6:
  25.375 +            do {
  25.376 +                int alt6=2;
  25.377 +                try { dbg.enterDecision(6, decisionCanBacktrack[6]);
  25.378 +
  25.379 +                int LA6_0 = input.LA(1);
  25.380 +
  25.381 +                if ( (LA6_0==RULE) ) {
  25.382 +                    alt6=1;
  25.383 +                }
  25.384 +
  25.385 +
  25.386 +                } finally {dbg.exitDecision(6);}
  25.387 +
  25.388 +                switch (alt6) {
  25.389 +            	case 1 :
  25.390 +            	    dbg.enterAlt(1);
  25.391 +
  25.392 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:84: rule
  25.393 +            	    {
  25.394 +            	    dbg.location(42,84);
  25.395 +            	    pushFollow(FOLLOW_rule_in_grammarDef71);
  25.396 +            	    rule();
  25.397 +
  25.398 +            	    state._fsp--;
  25.399 +
  25.400 +
  25.401 +            	    }
  25.402 +            	    break;
  25.403 +
  25.404 +            	default :
  25.405 +            	    if ( cnt6 >= 1 ) break loop6;
  25.406 +                        EarlyExitException eee =
  25.407 +                            new EarlyExitException(6, input);
  25.408 +                        dbg.recognitionException(eee);
  25.409 +
  25.410 +                        throw eee;
  25.411 +                }
  25.412 +                cnt6++;
  25.413 +            } while (true);
  25.414 +            } finally {dbg.exitSubRule(6);}
  25.415 +
  25.416 +
  25.417 +            match(input, Token.UP, null); 
  25.418 +
  25.419 +            }
  25.420 +
  25.421 +        }
  25.422 +        catch (RecognitionException re) {
  25.423 +            reportError(re);
  25.424 +            recover(input,re);
  25.425 +        }
  25.426 +        finally {
  25.427 +        }
  25.428 +        dbg.location(43, 5);
  25.429 +
  25.430 +        }
  25.431 +        finally {
  25.432 +            dbg.exitRule(getGrammarFileName(), "grammarDef");
  25.433 +            decRuleLevel();
  25.434 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.435 +        }
  25.436 +
  25.437 +        return ;
  25.438 +    }
  25.439 +    // $ANTLR end "grammarDef"
  25.440 +
  25.441 +
  25.442 +    // $ANTLR start "grammarType"
  25.443 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:45:1: grammarType : ( LEXER_GRAMMAR | PARSER_GRAMMAR | TREE_GRAMMAR | COMBINED_GRAMMAR );
  25.444 +    public final void grammarType() throws RecognitionException {
  25.445 +        try { dbg.enterRule(getGrammarFileName(), "grammarType");
  25.446 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.447 +        incRuleLevel();
  25.448 +        dbg.location(45, 1);
  25.449 +
  25.450 +        try {
  25.451 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:46:2: ( LEXER_GRAMMAR | PARSER_GRAMMAR | TREE_GRAMMAR | COMBINED_GRAMMAR )
  25.452 +            dbg.enterAlt(1);
  25.453 +
  25.454 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
  25.455 +            {
  25.456 +            dbg.location(46,2);
  25.457 +            if ( (input.LA(1)>=LEXER_GRAMMAR && input.LA(1)<=COMBINED_GRAMMAR) ) {
  25.458 +                input.consume();
  25.459 +                state.errorRecovery=false;
  25.460 +            }
  25.461 +            else {
  25.462 +                MismatchedSetException mse = new MismatchedSetException(null,input);
  25.463 +                dbg.recognitionException(mse);
  25.464 +                throw mse;
  25.465 +            }
  25.466 +
  25.467 +
  25.468 +            }
  25.469 +
  25.470 +        }
  25.471 +        catch (RecognitionException re) {
  25.472 +            reportError(re);
  25.473 +            recover(input,re);
  25.474 +        }
  25.475 +        finally {
  25.476 +        }
  25.477 +        dbg.location(50, 5);
  25.478 +
  25.479 +        }
  25.480 +        finally {
  25.481 +            dbg.exitRule(getGrammarFileName(), "grammarType");
  25.482 +            decRuleLevel();
  25.483 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.484 +        }
  25.485 +
  25.486 +        return ;
  25.487 +    }
  25.488 +    // $ANTLR end "grammarType"
  25.489 +
  25.490 +
  25.491 +    // $ANTLR start "tokensSpec"
  25.492 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:52:1: tokensSpec : ^( TOKENS ( tokenSpec )+ ) ;
  25.493 +    public final void tokensSpec() throws RecognitionException {
  25.494 +        try { dbg.enterRule(getGrammarFileName(), "tokensSpec");
  25.495 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.496 +        incRuleLevel();
  25.497 +        dbg.location(52, 1);
  25.498 +
  25.499 +        try {
  25.500 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:2: ( ^( TOKENS ( tokenSpec )+ ) )
  25.501 +            dbg.enterAlt(1);
  25.502 +
  25.503 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:4: ^( TOKENS ( tokenSpec )+ )
  25.504 +            {
  25.505 +            dbg.location(53,4);
  25.506 +            dbg.location(53,6);
  25.507 +            match(input,TOKENS,FOLLOW_TOKENS_in_tokensSpec127); 
  25.508 +
  25.509 +            match(input, Token.DOWN, null); 
  25.510 +            dbg.location(53,13);
  25.511 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:13: ( tokenSpec )+
  25.512 +            int cnt7=0;
  25.513 +            try { dbg.enterSubRule(7);
  25.514 +
  25.515 +            loop7:
  25.516 +            do {
  25.517 +                int alt7=2;
  25.518 +                try { dbg.enterDecision(7, decisionCanBacktrack[7]);
  25.519 +
  25.520 +                int LA7_0 = input.LA(1);
  25.521 +
  25.522 +                if ( (LA7_0==TOKEN_REF||LA7_0==71) ) {
  25.523 +                    alt7=1;
  25.524 +                }
  25.525 +
  25.526 +
  25.527 +                } finally {dbg.exitDecision(7);}
  25.528 +
  25.529 +                switch (alt7) {
  25.530 +            	case 1 :
  25.531 +            	    dbg.enterAlt(1);
  25.532 +
  25.533 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:13: tokenSpec
  25.534 +            	    {
  25.535 +            	    dbg.location(53,13);
  25.536 +            	    pushFollow(FOLLOW_tokenSpec_in_tokensSpec129);
  25.537 +            	    tokenSpec();
  25.538 +
  25.539 +            	    state._fsp--;
  25.540 +
  25.541 +
  25.542 +            	    }
  25.543 +            	    break;
  25.544 +
  25.545 +            	default :
  25.546 +            	    if ( cnt7 >= 1 ) break loop7;
  25.547 +                        EarlyExitException eee =
  25.548 +                            new EarlyExitException(7, input);
  25.549 +                        dbg.recognitionException(eee);
  25.550 +
  25.551 +                        throw eee;
  25.552 +                }
  25.553 +                cnt7++;
  25.554 +            } while (true);
  25.555 +            } finally {dbg.exitSubRule(7);}
  25.556 +
  25.557 +
  25.558 +            match(input, Token.UP, null); 
  25.559 +
  25.560 +            }
  25.561 +
  25.562 +        }
  25.563 +        catch (RecognitionException re) {
  25.564 +            reportError(re);
  25.565 +            recover(input,re);
  25.566 +        }
  25.567 +        finally {
  25.568 +        }
  25.569 +        dbg.location(54, 2);
  25.570 +
  25.571 +        }
  25.572 +        finally {
  25.573 +            dbg.exitRule(getGrammarFileName(), "tokensSpec");
  25.574 +            decRuleLevel();
  25.575 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.576 +        }
  25.577 +
  25.578 +        return ;
  25.579 +    }
  25.580 +    // $ANTLR end "tokensSpec"
  25.581 +
  25.582 +
  25.583 +    // $ANTLR start "tokenSpec"
  25.584 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:56:1: tokenSpec : ( ^( '=' TOKEN_REF STRING_LITERAL ) | ^( '=' TOKEN_REF CHAR_LITERAL ) | TOKEN_REF );
  25.585 +    public final void tokenSpec() throws RecognitionException {
  25.586 +        try { dbg.enterRule(getGrammarFileName(), "tokenSpec");
  25.587 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.588 +        incRuleLevel();
  25.589 +        dbg.location(56, 1);
  25.590 +
  25.591 +        try {
  25.592 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:57:2: ( ^( '=' TOKEN_REF STRING_LITERAL ) | ^( '=' TOKEN_REF CHAR_LITERAL ) | TOKEN_REF )
  25.593 +            int alt8=3;
  25.594 +            try { dbg.enterDecision(8, decisionCanBacktrack[8]);
  25.595 +
  25.596 +            int LA8_0 = input.LA(1);
  25.597 +
  25.598 +            if ( (LA8_0==71) ) {
  25.599 +                int LA8_1 = input.LA(2);
  25.600 +
  25.601 +                if ( (LA8_1==DOWN) ) {
  25.602 +                    int LA8_3 = input.LA(3);
  25.603 +
  25.604 +                    if ( (LA8_3==TOKEN_REF) ) {
  25.605 +                        int LA8_4 = input.LA(4);
  25.606 +
  25.607 +                        if ( (LA8_4==STRING_LITERAL) ) {
  25.608 +                            alt8=1;
  25.609 +                        }
  25.610 +                        else if ( (LA8_4==CHAR_LITERAL) ) {
  25.611 +                            alt8=2;
  25.612 +                        }
  25.613 +                        else {
  25.614 +                            NoViableAltException nvae =
  25.615 +                                new NoViableAltException("", 8, 4, input);
  25.616 +
  25.617 +                            dbg.recognitionException(nvae);
  25.618 +                            throw nvae;
  25.619 +                        }
  25.620 +                    }
  25.621 +                    else {
  25.622 +                        NoViableAltException nvae =
  25.623 +                            new NoViableAltException("", 8, 3, input);
  25.624 +
  25.625 +                        dbg.recognitionException(nvae);
  25.626 +                        throw nvae;
  25.627 +                    }
  25.628 +                }
  25.629 +                else {
  25.630 +                    NoViableAltException nvae =
  25.631 +                        new NoViableAltException("", 8, 1, input);
  25.632 +
  25.633 +                    dbg.recognitionException(nvae);
  25.634 +                    throw nvae;
  25.635 +                }
  25.636 +            }
  25.637 +            else if ( (LA8_0==TOKEN_REF) ) {
  25.638 +                alt8=3;
  25.639 +            }
  25.640 +            else {
  25.641 +                NoViableAltException nvae =
  25.642 +                    new NoViableAltException("", 8, 0, input);
  25.643 +
  25.644 +                dbg.recognitionException(nvae);
  25.645 +                throw nvae;
  25.646 +            }
  25.647 +            } finally {dbg.exitDecision(8);}
  25.648 +
  25.649 +            switch (alt8) {
  25.650 +                case 1 :
  25.651 +                    dbg.enterAlt(1);
  25.652 +
  25.653 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:57:4: ^( '=' TOKEN_REF STRING_LITERAL )
  25.654 +                    {
  25.655 +                    dbg.location(57,4);
  25.656 +                    dbg.location(57,6);
  25.657 +                    match(input,71,FOLLOW_71_in_tokenSpec143); 
  25.658 +
  25.659 +                    match(input, Token.DOWN, null); 
  25.660 +                    dbg.location(57,10);
  25.661 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec145); 
  25.662 +                    dbg.location(57,20);
  25.663 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenSpec147); 
  25.664 +
  25.665 +                    match(input, Token.UP, null); 
  25.666 +
  25.667 +                    }
  25.668 +                    break;
  25.669 +                case 2 :
  25.670 +                    dbg.enterAlt(2);
  25.671 +
  25.672 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:58:4: ^( '=' TOKEN_REF CHAR_LITERAL )
  25.673 +                    {
  25.674 +                    dbg.location(58,4);
  25.675 +                    dbg.location(58,6);
  25.676 +                    match(input,71,FOLLOW_71_in_tokenSpec154); 
  25.677 +
  25.678 +                    match(input, Token.DOWN, null); 
  25.679 +                    dbg.location(58,10);
  25.680 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec156); 
  25.681 +                    dbg.location(58,20);
  25.682 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_tokenSpec158); 
  25.683 +
  25.684 +                    match(input, Token.UP, null); 
  25.685 +
  25.686 +                    }
  25.687 +                    break;
  25.688 +                case 3 :
  25.689 +                    dbg.enterAlt(3);
  25.690 +
  25.691 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:59:4: TOKEN_REF
  25.692 +                    {
  25.693 +                    dbg.location(59,4);
  25.694 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec164); 
  25.695 +
  25.696 +                    }
  25.697 +                    break;
  25.698 +
  25.699 +            }
  25.700 +        }
  25.701 +        catch (RecognitionException re) {
  25.702 +            reportError(re);
  25.703 +            recover(input,re);
  25.704 +        }
  25.705 +        finally {
  25.706 +        }
  25.707 +        dbg.location(60, 2);
  25.708 +
  25.709 +        }
  25.710 +        finally {
  25.711 +            dbg.exitRule(getGrammarFileName(), "tokenSpec");
  25.712 +            decRuleLevel();
  25.713 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.714 +        }
  25.715 +
  25.716 +        return ;
  25.717 +    }
  25.718 +    // $ANTLR end "tokenSpec"
  25.719 +
  25.720 +
  25.721 +    // $ANTLR start "attrScope"
  25.722 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:62:1: attrScope : ^( 'scope' ID ACTION ) ;
  25.723 +    public final void attrScope() throws RecognitionException {
  25.724 +        try { dbg.enterRule(getGrammarFileName(), "attrScope");
  25.725 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.726 +        incRuleLevel();
  25.727 +        dbg.location(62, 1);
  25.728 +
  25.729 +        try {
  25.730 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:63:2: ( ^( 'scope' ID ACTION ) )
  25.731 +            dbg.enterAlt(1);
  25.732 +
  25.733 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:63:4: ^( 'scope' ID ACTION )
  25.734 +            {
  25.735 +            dbg.location(63,4);
  25.736 +            dbg.location(63,6);
  25.737 +            match(input,SCOPE,FOLLOW_SCOPE_in_attrScope176); 
  25.738 +
  25.739 +            match(input, Token.DOWN, null); 
  25.740 +            dbg.location(63,14);
  25.741 +            match(input,ID,FOLLOW_ID_in_attrScope178); 
  25.742 +            dbg.location(63,17);
  25.743 +            match(input,ACTION,FOLLOW_ACTION_in_attrScope180); 
  25.744 +
  25.745 +            match(input, Token.UP, null); 
  25.746 +
  25.747 +            }
  25.748 +
  25.749 +        }
  25.750 +        catch (RecognitionException re) {
  25.751 +            reportError(re);
  25.752 +            recover(input,re);
  25.753 +        }
  25.754 +        finally {
  25.755 +        }
  25.756 +        dbg.location(64, 2);
  25.757 +
  25.758 +        }
  25.759 +        finally {
  25.760 +            dbg.exitRule(getGrammarFileName(), "attrScope");
  25.761 +            decRuleLevel();
  25.762 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.763 +        }
  25.764 +
  25.765 +        return ;
  25.766 +    }
  25.767 +    // $ANTLR end "attrScope"
  25.768 +
  25.769 +
  25.770 +    // $ANTLR start "action"
  25.771 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:66:1: action : ( ^( '@' ID ID ACTION ) | ^( '@' ID ACTION ) );
  25.772 +    public final void action() throws RecognitionException {
  25.773 +        try { dbg.enterRule(getGrammarFileName(), "action");
  25.774 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.775 +        incRuleLevel();
  25.776 +        dbg.location(66, 1);
  25.777 +
  25.778 +        try {
  25.779 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:67:2: ( ^( '@' ID ID ACTION ) | ^( '@' ID ACTION ) )
  25.780 +            int alt9=2;
  25.781 +            try { dbg.enterDecision(9, decisionCanBacktrack[9]);
  25.782 +
  25.783 +            int LA9_0 = input.LA(1);
  25.784 +
  25.785 +            if ( (LA9_0==72) ) {
  25.786 +                int LA9_1 = input.LA(2);
  25.787 +
  25.788 +                if ( (LA9_1==DOWN) ) {
  25.789 +                    int LA9_2 = input.LA(3);
  25.790 +
  25.791 +                    if ( (LA9_2==ID) ) {
  25.792 +                        int LA9_3 = input.LA(4);
  25.793 +
  25.794 +                        if ( (LA9_3==ID) ) {
  25.795 +                            alt9=1;
  25.796 +                        }
  25.797 +                        else if ( (LA9_3==ACTION) ) {
  25.798 +                            alt9=2;
  25.799 +                        }
  25.800 +                        else {
  25.801 +                            NoViableAltException nvae =
  25.802 +                                new NoViableAltException("", 9, 3, input);
  25.803 +
  25.804 +                            dbg.recognitionException(nvae);
  25.805 +                            throw nvae;
  25.806 +                        }
  25.807 +                    }
  25.808 +                    else {
  25.809 +                        NoViableAltException nvae =
  25.810 +                            new NoViableAltException("", 9, 2, input);
  25.811 +
  25.812 +                        dbg.recognitionException(nvae);
  25.813 +                        throw nvae;
  25.814 +                    }
  25.815 +                }
  25.816 +                else {
  25.817 +                    NoViableAltException nvae =
  25.818 +                        new NoViableAltException("", 9, 1, input);
  25.819 +
  25.820 +                    dbg.recognitionException(nvae);
  25.821 +                    throw nvae;
  25.822 +                }
  25.823 +            }
  25.824 +            else {
  25.825 +                NoViableAltException nvae =
  25.826 +                    new NoViableAltException("", 9, 0, input);
  25.827 +
  25.828 +                dbg.recognitionException(nvae);
  25.829 +                throw nvae;
  25.830 +            }
  25.831 +            } finally {dbg.exitDecision(9);}
  25.832 +
  25.833 +            switch (alt9) {
  25.834 +                case 1 :
  25.835 +                    dbg.enterAlt(1);
  25.836 +
  25.837 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:67:4: ^( '@' ID ID ACTION )
  25.838 +                    {
  25.839 +                    dbg.location(67,4);
  25.840 +                    dbg.location(67,6);
  25.841 +                    match(input,72,FOLLOW_72_in_action193); 
  25.842 +
  25.843 +                    match(input, Token.DOWN, null); 
  25.844 +                    dbg.location(67,10);
  25.845 +                    match(input,ID,FOLLOW_ID_in_action195); 
  25.846 +                    dbg.location(67,13);
  25.847 +                    match(input,ID,FOLLOW_ID_in_action197); 
  25.848 +                    dbg.location(67,16);
  25.849 +                    match(input,ACTION,FOLLOW_ACTION_in_action199); 
  25.850 +
  25.851 +                    match(input, Token.UP, null); 
  25.852 +
  25.853 +                    }
  25.854 +                    break;
  25.855 +                case 2 :
  25.856 +                    dbg.enterAlt(2);
  25.857 +
  25.858 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:68:4: ^( '@' ID ACTION )
  25.859 +                    {
  25.860 +                    dbg.location(68,4);
  25.861 +                    dbg.location(68,6);
  25.862 +                    match(input,72,FOLLOW_72_in_action206); 
  25.863 +
  25.864 +                    match(input, Token.DOWN, null); 
  25.865 +                    dbg.location(68,10);
  25.866 +                    match(input,ID,FOLLOW_ID_in_action208); 
  25.867 +                    dbg.location(68,13);
  25.868 +                    match(input,ACTION,FOLLOW_ACTION_in_action210); 
  25.869 +
  25.870 +                    match(input, Token.UP, null); 
  25.871 +
  25.872 +                    }
  25.873 +                    break;
  25.874 +
  25.875 +            }
  25.876 +        }
  25.877 +        catch (RecognitionException re) {
  25.878 +            reportError(re);
  25.879 +            recover(input,re);
  25.880 +        }
  25.881 +        finally {
  25.882 +        }
  25.883 +        dbg.location(69, 2);
  25.884 +
  25.885 +        }
  25.886 +        finally {
  25.887 +            dbg.exitRule(getGrammarFileName(), "action");
  25.888 +            decRuleLevel();
  25.889 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.890 +        }
  25.891 +
  25.892 +        return ;
  25.893 +    }
  25.894 +    // $ANTLR end "action"
  25.895 +
  25.896 +
  25.897 +    // $ANTLR start "optionsSpec"
  25.898 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:71:1: optionsSpec : ^( OPTIONS ( option )+ ) ;
  25.899 +    public final void optionsSpec() throws RecognitionException {
  25.900 +        try { dbg.enterRule(getGrammarFileName(), "optionsSpec");
  25.901 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.902 +        incRuleLevel();
  25.903 +        dbg.location(71, 1);
  25.904 +
  25.905 +        try {
  25.906 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:2: ( ^( OPTIONS ( option )+ ) )
  25.907 +            dbg.enterAlt(1);
  25.908 +
  25.909 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:4: ^( OPTIONS ( option )+ )
  25.910 +            {
  25.911 +            dbg.location(72,4);
  25.912 +            dbg.location(72,6);
  25.913 +            match(input,OPTIONS,FOLLOW_OPTIONS_in_optionsSpec223); 
  25.914 +
  25.915 +            match(input, Token.DOWN, null); 
  25.916 +            dbg.location(72,14);
  25.917 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:14: ( option )+
  25.918 +            int cnt10=0;
  25.919 +            try { dbg.enterSubRule(10);
  25.920 +
  25.921 +            loop10:
  25.922 +            do {
  25.923 +                int alt10=2;
  25.924 +                try { dbg.enterDecision(10, decisionCanBacktrack[10]);
  25.925 +
  25.926 +                int LA10_0 = input.LA(1);
  25.927 +
  25.928 +                if ( (LA10_0==71) ) {
  25.929 +                    alt10=1;
  25.930 +                }
  25.931 +
  25.932 +
  25.933 +                } finally {dbg.exitDecision(10);}
  25.934 +
  25.935 +                switch (alt10) {
  25.936 +            	case 1 :
  25.937 +            	    dbg.enterAlt(1);
  25.938 +
  25.939 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:14: option
  25.940 +            	    {
  25.941 +            	    dbg.location(72,14);
  25.942 +            	    pushFollow(FOLLOW_option_in_optionsSpec225);
  25.943 +            	    option();
  25.944 +
  25.945 +            	    state._fsp--;
  25.946 +
  25.947 +
  25.948 +            	    }
  25.949 +            	    break;
  25.950 +
  25.951 +            	default :
  25.952 +            	    if ( cnt10 >= 1 ) break loop10;
  25.953 +                        EarlyExitException eee =
  25.954 +                            new EarlyExitException(10, input);
  25.955 +                        dbg.recognitionException(eee);
  25.956 +
  25.957 +                        throw eee;
  25.958 +                }
  25.959 +                cnt10++;
  25.960 +            } while (true);
  25.961 +            } finally {dbg.exitSubRule(10);}
  25.962 +
  25.963 +
  25.964 +            match(input, Token.UP, null); 
  25.965 +
  25.966 +            }
  25.967 +
  25.968 +        }
  25.969 +        catch (RecognitionException re) {
  25.970 +            reportError(re);
  25.971 +            recover(input,re);
  25.972 +        }
  25.973 +        finally {
  25.974 +        }
  25.975 +        dbg.location(73, 2);
  25.976 +
  25.977 +        }
  25.978 +        finally {
  25.979 +            dbg.exitRule(getGrammarFileName(), "optionsSpec");
  25.980 +            decRuleLevel();
  25.981 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  25.982 +        }
  25.983 +
  25.984 +        return ;
  25.985 +    }
  25.986 +    // $ANTLR end "optionsSpec"
  25.987 +
  25.988 +
  25.989 +    // $ANTLR start "option"
  25.990 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:75:1: option : ^( '=' ID optionValue ) ;
  25.991 +    public final void option() throws RecognitionException {
  25.992 +        try { dbg.enterRule(getGrammarFileName(), "option");
  25.993 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  25.994 +        incRuleLevel();
  25.995 +        dbg.location(75, 1);
  25.996 +
  25.997 +        try {
  25.998 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:76:5: ( ^( '=' ID optionValue ) )
  25.999 +            dbg.enterAlt(1);
 25.1000 +
 25.1001 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:76:9: ^( '=' ID optionValue )
 25.1002 +            {
 25.1003 +            dbg.location(76,9);
 25.1004 +            dbg.location(76,11);
 25.1005 +            match(input,71,FOLLOW_71_in_option244); 
 25.1006 +
 25.1007 +            match(input, Token.DOWN, null); 
 25.1008 +            dbg.location(76,15);
 25.1009 +            match(input,ID,FOLLOW_ID_in_option246); 
 25.1010 +            dbg.location(76,18);
 25.1011 +            pushFollow(FOLLOW_optionValue_in_option248);
 25.1012 +            optionValue();
 25.1013 +
 25.1014 +            state._fsp--;
 25.1015 +
 25.1016 +
 25.1017 +            match(input, Token.UP, null); 
 25.1018 +
 25.1019 +            }
 25.1020 +
 25.1021 +        }
 25.1022 +        catch (RecognitionException re) {
 25.1023 +            reportError(re);
 25.1024 +            recover(input,re);
 25.1025 +        }
 25.1026 +        finally {
 25.1027 +        }
 25.1028 +        dbg.location(77, 3);
 25.1029 +
 25.1030 +        }
 25.1031 +        finally {
 25.1032 +            dbg.exitRule(getGrammarFileName(), "option");
 25.1033 +            decRuleLevel();
 25.1034 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1035 +        }
 25.1036 +
 25.1037 +        return ;
 25.1038 +    }
 25.1039 +    // $ANTLR end "option"
 25.1040 +
 25.1041 +
 25.1042 +    // $ANTLR start "optionValue"
 25.1043 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:79:1: optionValue : ( ID | STRING_LITERAL | CHAR_LITERAL | INT );
 25.1044 +    public final void optionValue() throws RecognitionException {
 25.1045 +        try { dbg.enterRule(getGrammarFileName(), "optionValue");
 25.1046 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1047 +        incRuleLevel();
 25.1048 +        dbg.location(79, 1);
 25.1049 +
 25.1050 +        try {
 25.1051 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:80:5: ( ID | STRING_LITERAL | CHAR_LITERAL | INT )
 25.1052 +            dbg.enterAlt(1);
 25.1053 +
 25.1054 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 25.1055 +            {
 25.1056 +            dbg.location(80,5);
 25.1057 +            if ( input.LA(1)==ID||(input.LA(1)>=STRING_LITERAL && input.LA(1)<=CHAR_LITERAL)||input.LA(1)==INT ) {
 25.1058 +                input.consume();
 25.1059 +                state.errorRecovery=false;
 25.1060 +            }
 25.1061 +            else {
 25.1062 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 25.1063 +                dbg.recognitionException(mse);
 25.1064 +                throw mse;
 25.1065 +            }
 25.1066 +
 25.1067 +
 25.1068 +            }
 25.1069 +
 25.1070 +        }
 25.1071 +        catch (RecognitionException re) {
 25.1072 +            reportError(re);
 25.1073 +            recover(input,re);
 25.1074 +        }
 25.1075 +        finally {
 25.1076 +        }
 25.1077 +        dbg.location(84, 5);
 25.1078 +
 25.1079 +        }
 25.1080 +        finally {
 25.1081 +            dbg.exitRule(getGrammarFileName(), "optionValue");
 25.1082 +            decRuleLevel();
 25.1083 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1084 +        }
 25.1085 +
 25.1086 +        return ;
 25.1087 +    }
 25.1088 +    // $ANTLR end "optionValue"
 25.1089 +
 25.1090 +
 25.1091 +    // $ANTLR start "rule"
 25.1092 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:86:1: rule : ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR ) ;
 25.1093 +    public final void rule() throws RecognitionException {
 25.1094 +        try { dbg.enterRule(getGrammarFileName(), "rule");
 25.1095 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1096 +        incRuleLevel();
 25.1097 +        dbg.location(86, 1);
 25.1098 +
 25.1099 +        try {
 25.1100 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:2: ( ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR ) )
 25.1101 +            dbg.enterAlt(1);
 25.1102 +
 25.1103 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:4: ^( RULE ID ( modifier )? ( ^( ARG ARG_ACTION ) )? ( ^( RET ARG_ACTION ) )? ( optionsSpec )? ( ruleScopeSpec )? ( ruleAction )* altList ( exceptionGroup )? EOR )
 25.1104 +            {
 25.1105 +            dbg.location(87,4);
 25.1106 +            dbg.location(87,7);
 25.1107 +            match(input,RULE,FOLLOW_RULE_in_rule314); 
 25.1108 +
 25.1109 +            match(input, Token.DOWN, null); 
 25.1110 +            dbg.location(87,12);
 25.1111 +            match(input,ID,FOLLOW_ID_in_rule316); 
 25.1112 +            dbg.location(87,15);
 25.1113 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:15: ( modifier )?
 25.1114 +            int alt11=2;
 25.1115 +            try { dbg.enterSubRule(11);
 25.1116 +            try { dbg.enterDecision(11, decisionCanBacktrack[11]);
 25.1117 +
 25.1118 +            int LA11_0 = input.LA(1);
 25.1119 +
 25.1120 +            if ( (LA11_0==FRAGMENT||(LA11_0>=75 && LA11_0<=77)) ) {
 25.1121 +                alt11=1;
 25.1122 +            }
 25.1123 +            } finally {dbg.exitDecision(11);}
 25.1124 +
 25.1125 +            switch (alt11) {
 25.1126 +                case 1 :
 25.1127 +                    dbg.enterAlt(1);
 25.1128 +
 25.1129 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:15: modifier
 25.1130 +                    {
 25.1131 +                    dbg.location(87,15);
 25.1132 +                    pushFollow(FOLLOW_modifier_in_rule318);
 25.1133 +                    modifier();
 25.1134 +
 25.1135 +                    state._fsp--;
 25.1136 +
 25.1137 +
 25.1138 +                    }
 25.1139 +                    break;
 25.1140 +
 25.1141 +            }
 25.1142 +            } finally {dbg.exitSubRule(11);}
 25.1143 +
 25.1144 +            dbg.location(87,25);
 25.1145 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:25: ( ^( ARG ARG_ACTION ) )?
 25.1146 +            int alt12=2;
 25.1147 +            try { dbg.enterSubRule(12);
 25.1148 +            try { dbg.enterDecision(12, decisionCanBacktrack[12]);
 25.1149 +
 25.1150 +            int LA12_0 = input.LA(1);
 25.1151 +
 25.1152 +            if ( (LA12_0==ARG) ) {
 25.1153 +                alt12=1;
 25.1154 +            }
 25.1155 +            } finally {dbg.exitDecision(12);}
 25.1156 +
 25.1157 +            switch (alt12) {
 25.1158 +                case 1 :
 25.1159 +                    dbg.enterAlt(1);
 25.1160 +
 25.1161 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:26: ^( ARG ARG_ACTION )
 25.1162 +                    {
 25.1163 +                    dbg.location(87,26);
 25.1164 +                    dbg.location(87,28);
 25.1165 +                    match(input,ARG,FOLLOW_ARG_in_rule323); 
 25.1166 +
 25.1167 +                    match(input, Token.DOWN, null); 
 25.1168 +                    dbg.location(87,32);
 25.1169 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule325); 
 25.1170 +
 25.1171 +                    match(input, Token.UP, null); 
 25.1172 +
 25.1173 +                    }
 25.1174 +                    break;
 25.1175 +
 25.1176 +            }
 25.1177 +            } finally {dbg.exitSubRule(12);}
 25.1178 +
 25.1179 +            dbg.location(87,46);
 25.1180 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:46: ( ^( RET ARG_ACTION ) )?
 25.1181 +            int alt13=2;
 25.1182 +            try { dbg.enterSubRule(13);
 25.1183 +            try { dbg.enterDecision(13, decisionCanBacktrack[13]);
 25.1184 +
 25.1185 +            int LA13_0 = input.LA(1);
 25.1186 +
 25.1187 +            if ( (LA13_0==RET) ) {
 25.1188 +                alt13=1;
 25.1189 +            }
 25.1190 +            } finally {dbg.exitDecision(13);}
 25.1191 +
 25.1192 +            switch (alt13) {
 25.1193 +                case 1 :
 25.1194 +                    dbg.enterAlt(1);
 25.1195 +
 25.1196 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:47: ^( RET ARG_ACTION )
 25.1197 +                    {
 25.1198 +                    dbg.location(87,47);
 25.1199 +                    dbg.location(87,49);
 25.1200 +                    match(input,RET,FOLLOW_RET_in_rule332); 
 25.1201 +
 25.1202 +                    match(input, Token.DOWN, null); 
 25.1203 +                    dbg.location(87,53);
 25.1204 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule334); 
 25.1205 +
 25.1206 +                    match(input, Token.UP, null); 
 25.1207 +
 25.1208 +                    }
 25.1209 +                    break;
 25.1210 +
 25.1211 +            }
 25.1212 +            } finally {dbg.exitSubRule(13);}
 25.1213 +
 25.1214 +            dbg.location(88,9);
 25.1215 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:9: ( optionsSpec )?
 25.1216 +            int alt14=2;
 25.1217 +            try { dbg.enterSubRule(14);
 25.1218 +            try { dbg.enterDecision(14, decisionCanBacktrack[14]);
 25.1219 +
 25.1220 +            int LA14_0 = input.LA(1);
 25.1221 +
 25.1222 +            if ( (LA14_0==OPTIONS) ) {
 25.1223 +                alt14=1;
 25.1224 +            }
 25.1225 +            } finally {dbg.exitDecision(14);}
 25.1226 +
 25.1227 +            switch (alt14) {
 25.1228 +                case 1 :
 25.1229 +                    dbg.enterAlt(1);
 25.1230 +
 25.1231 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:9: optionsSpec
 25.1232 +                    {
 25.1233 +                    dbg.location(88,9);
 25.1234 +                    pushFollow(FOLLOW_optionsSpec_in_rule347);
 25.1235 +                    optionsSpec();
 25.1236 +
 25.1237 +                    state._fsp--;
 25.1238 +
 25.1239 +
 25.1240 +                    }
 25.1241 +                    break;
 25.1242 +
 25.1243 +            }
 25.1244 +            } finally {dbg.exitSubRule(14);}
 25.1245 +
 25.1246 +            dbg.location(88,22);
 25.1247 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:22: ( ruleScopeSpec )?
 25.1248 +            int alt15=2;
 25.1249 +            try { dbg.enterSubRule(15);
 25.1250 +            try { dbg.enterDecision(15, decisionCanBacktrack[15]);
 25.1251 +
 25.1252 +            int LA15_0 = input.LA(1);
 25.1253 +
 25.1254 +            if ( (LA15_0==SCOPE) ) {
 25.1255 +                alt15=1;
 25.1256 +            }
 25.1257 +            } finally {dbg.exitDecision(15);}
 25.1258 +
 25.1259 +            switch (alt15) {
 25.1260 +                case 1 :
 25.1261 +                    dbg.enterAlt(1);
 25.1262 +
 25.1263 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:22: ruleScopeSpec
 25.1264 +                    {
 25.1265 +                    dbg.location(88,22);
 25.1266 +                    pushFollow(FOLLOW_ruleScopeSpec_in_rule350);
 25.1267 +                    ruleScopeSpec();
 25.1268 +
 25.1269 +                    state._fsp--;
 25.1270 +
 25.1271 +
 25.1272 +                    }
 25.1273 +                    break;
 25.1274 +
 25.1275 +            }
 25.1276 +            } finally {dbg.exitSubRule(15);}
 25.1277 +
 25.1278 +            dbg.location(88,37);
 25.1279 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:37: ( ruleAction )*
 25.1280 +            try { dbg.enterSubRule(16);
 25.1281 +
 25.1282 +            loop16:
 25.1283 +            do {
 25.1284 +                int alt16=2;
 25.1285 +                try { dbg.enterDecision(16, decisionCanBacktrack[16]);
 25.1286 +
 25.1287 +                int LA16_0 = input.LA(1);
 25.1288 +
 25.1289 +                if ( (LA16_0==72) ) {
 25.1290 +                    alt16=1;
 25.1291 +                }
 25.1292 +
 25.1293 +
 25.1294 +                } finally {dbg.exitDecision(16);}
 25.1295 +
 25.1296 +                switch (alt16) {
 25.1297 +            	case 1 :
 25.1298 +            	    dbg.enterAlt(1);
 25.1299 +
 25.1300 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:37: ruleAction
 25.1301 +            	    {
 25.1302 +            	    dbg.location(88,37);
 25.1303 +            	    pushFollow(FOLLOW_ruleAction_in_rule353);
 25.1304 +            	    ruleAction();
 25.1305 +
 25.1306 +            	    state._fsp--;
 25.1307 +
 25.1308 +
 25.1309 +            	    }
 25.1310 +            	    break;
 25.1311 +
 25.1312 +            	default :
 25.1313 +            	    break loop16;
 25.1314 +                }
 25.1315 +            } while (true);
 25.1316 +            } finally {dbg.exitSubRule(16);}
 25.1317 +
 25.1318 +            dbg.location(89,9);
 25.1319 +            pushFollow(FOLLOW_altList_in_rule364);
 25.1320 +            altList();
 25.1321 +
 25.1322 +            state._fsp--;
 25.1323 +
 25.1324 +            dbg.location(90,9);
 25.1325 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:90:9: ( exceptionGroup )?
 25.1326 +            int alt17=2;
 25.1327 +            try { dbg.enterSubRule(17);
 25.1328 +            try { dbg.enterDecision(17, decisionCanBacktrack[17]);
 25.1329 +
 25.1330 +            int LA17_0 = input.LA(1);
 25.1331 +
 25.1332 +            if ( ((LA17_0>=85 && LA17_0<=86)) ) {
 25.1333 +                alt17=1;
 25.1334 +            }
 25.1335 +            } finally {dbg.exitDecision(17);}
 25.1336 +
 25.1337 +            switch (alt17) {
 25.1338 +                case 1 :
 25.1339 +                    dbg.enterAlt(1);
 25.1340 +
 25.1341 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:90:9: exceptionGroup
 25.1342 +                    {
 25.1343 +                    dbg.location(90,9);
 25.1344 +                    pushFollow(FOLLOW_exceptionGroup_in_rule374);
 25.1345 +                    exceptionGroup();
 25.1346 +
 25.1347 +                    state._fsp--;
 25.1348 +
 25.1349 +
 25.1350 +                    }
 25.1351 +                    break;
 25.1352 +
 25.1353 +            }
 25.1354 +            } finally {dbg.exitSubRule(17);}
 25.1355 +
 25.1356 +            dbg.location(90,25);
 25.1357 +            match(input,EOR,FOLLOW_EOR_in_rule377); 
 25.1358 +
 25.1359 +            match(input, Token.UP, null); 
 25.1360 +
 25.1361 +            }
 25.1362 +
 25.1363 +        }
 25.1364 +        catch (RecognitionException re) {
 25.1365 +            reportError(re);
 25.1366 +            recover(input,re);
 25.1367 +        }
 25.1368 +        finally {
 25.1369 +        }
 25.1370 +        dbg.location(92, 2);
 25.1371 +
 25.1372 +        }
 25.1373 +        finally {
 25.1374 +            dbg.exitRule(getGrammarFileName(), "rule");
 25.1375 +            decRuleLevel();
 25.1376 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1377 +        }
 25.1378 +
 25.1379 +        return ;
 25.1380 +    }
 25.1381 +    // $ANTLR end "rule"
 25.1382 +
 25.1383 +
 25.1384 +    // $ANTLR start "modifier"
 25.1385 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:94:1: modifier : ( 'protected' | 'public' | 'private' | 'fragment' );
 25.1386 +    public final void modifier() throws RecognitionException {
 25.1387 +        try { dbg.enterRule(getGrammarFileName(), "modifier");
 25.1388 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1389 +        incRuleLevel();
 25.1390 +        dbg.location(94, 1);
 25.1391 +
 25.1392 +        try {
 25.1393 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:95:2: ( 'protected' | 'public' | 'private' | 'fragment' )
 25.1394 +            dbg.enterAlt(1);
 25.1395 +
 25.1396 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 25.1397 +            {
 25.1398 +            dbg.location(95,2);
 25.1399 +            if ( input.LA(1)==FRAGMENT||(input.LA(1)>=75 && input.LA(1)<=77) ) {
 25.1400 +                input.consume();
 25.1401 +                state.errorRecovery=false;
 25.1402 +            }
 25.1403 +            else {
 25.1404 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 25.1405 +                dbg.recognitionException(mse);
 25.1406 +                throw mse;
 25.1407 +            }
 25.1408 +
 25.1409 +
 25.1410 +            }
 25.1411 +
 25.1412 +        }
 25.1413 +        catch (RecognitionException re) {
 25.1414 +            reportError(re);
 25.1415 +            recover(input,re);
 25.1416 +        }
 25.1417 +        finally {
 25.1418 +        }
 25.1419 +        dbg.location(96, 2);
 25.1420 +
 25.1421 +        }
 25.1422 +        finally {
 25.1423 +            dbg.exitRule(getGrammarFileName(), "modifier");
 25.1424 +            decRuleLevel();
 25.1425 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1426 +        }
 25.1427 +
 25.1428 +        return ;
 25.1429 +    }
 25.1430 +    // $ANTLR end "modifier"
 25.1431 +
 25.1432 +
 25.1433 +    // $ANTLR start "ruleAction"
 25.1434 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:98:1: ruleAction : ^( '@' ID ACTION ) ;
 25.1435 +    public final void ruleAction() throws RecognitionException {
 25.1436 +        try { dbg.enterRule(getGrammarFileName(), "ruleAction");
 25.1437 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1438 +        incRuleLevel();
 25.1439 +        dbg.location(98, 1);
 25.1440 +
 25.1441 +        try {
 25.1442 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:100:2: ( ^( '@' ID ACTION ) )
 25.1443 +            dbg.enterAlt(1);
 25.1444 +
 25.1445 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:100:4: ^( '@' ID ACTION )
 25.1446 +            {
 25.1447 +            dbg.location(100,4);
 25.1448 +            dbg.location(100,6);
 25.1449 +            match(input,72,FOLLOW_72_in_ruleAction416); 
 25.1450 +
 25.1451 +            match(input, Token.DOWN, null); 
 25.1452 +            dbg.location(100,10);
 25.1453 +            match(input,ID,FOLLOW_ID_in_ruleAction418); 
 25.1454 +            dbg.location(100,13);
 25.1455 +            match(input,ACTION,FOLLOW_ACTION_in_ruleAction420); 
 25.1456 +
 25.1457 +            match(input, Token.UP, null); 
 25.1458 +
 25.1459 +            }
 25.1460 +
 25.1461 +        }
 25.1462 +        catch (RecognitionException re) {
 25.1463 +            reportError(re);
 25.1464 +            recover(input,re);
 25.1465 +        }
 25.1466 +        finally {
 25.1467 +        }
 25.1468 +        dbg.location(101, 2);
 25.1469 +
 25.1470 +        }
 25.1471 +        finally {
 25.1472 +            dbg.exitRule(getGrammarFileName(), "ruleAction");
 25.1473 +            decRuleLevel();
 25.1474 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1475 +        }
 25.1476 +
 25.1477 +        return ;
 25.1478 +    }
 25.1479 +    // $ANTLR end "ruleAction"
 25.1480 +
 25.1481 +
 25.1482 +    // $ANTLR start "throwsSpec"
 25.1483 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:103:1: throwsSpec : ^( 'throws' ( ID )+ ) ;
 25.1484 +    public final void throwsSpec() throws RecognitionException {
 25.1485 +        try { dbg.enterRule(getGrammarFileName(), "throwsSpec");
 25.1486 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1487 +        incRuleLevel();
 25.1488 +        dbg.location(103, 1);
 25.1489 +
 25.1490 +        try {
 25.1491 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:2: ( ^( 'throws' ( ID )+ ) )
 25.1492 +            dbg.enterAlt(1);
 25.1493 +
 25.1494 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:4: ^( 'throws' ( ID )+ )
 25.1495 +            {
 25.1496 +            dbg.location(104,4);
 25.1497 +            dbg.location(104,6);
 25.1498 +            match(input,80,FOLLOW_80_in_throwsSpec433); 
 25.1499 +
 25.1500 +            match(input, Token.DOWN, null); 
 25.1501 +            dbg.location(104,15);
 25.1502 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:15: ( ID )+
 25.1503 +            int cnt18=0;
 25.1504 +            try { dbg.enterSubRule(18);
 25.1505 +
 25.1506 +            loop18:
 25.1507 +            do {
 25.1508 +                int alt18=2;
 25.1509 +                try { dbg.enterDecision(18, decisionCanBacktrack[18]);
 25.1510 +
 25.1511 +                int LA18_0 = input.LA(1);
 25.1512 +
 25.1513 +                if ( (LA18_0==ID) ) {
 25.1514 +                    alt18=1;
 25.1515 +                }
 25.1516 +
 25.1517 +
 25.1518 +                } finally {dbg.exitDecision(18);}
 25.1519 +
 25.1520 +                switch (alt18) {
 25.1521 +            	case 1 :
 25.1522 +            	    dbg.enterAlt(1);
 25.1523 +
 25.1524 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:15: ID
 25.1525 +            	    {
 25.1526 +            	    dbg.location(104,15);
 25.1527 +            	    match(input,ID,FOLLOW_ID_in_throwsSpec435); 
 25.1528 +
 25.1529 +            	    }
 25.1530 +            	    break;
 25.1531 +
 25.1532 +            	default :
 25.1533 +            	    if ( cnt18 >= 1 ) break loop18;
 25.1534 +                        EarlyExitException eee =
 25.1535 +                            new EarlyExitException(18, input);
 25.1536 +                        dbg.recognitionException(eee);
 25.1537 +
 25.1538 +                        throw eee;
 25.1539 +                }
 25.1540 +                cnt18++;
 25.1541 +            } while (true);
 25.1542 +            } finally {dbg.exitSubRule(18);}
 25.1543 +
 25.1544 +
 25.1545 +            match(input, Token.UP, null); 
 25.1546 +
 25.1547 +            }
 25.1548 +
 25.1549 +        }
 25.1550 +        catch (RecognitionException re) {
 25.1551 +            reportError(re);
 25.1552 +            recover(input,re);
 25.1553 +        }
 25.1554 +        finally {
 25.1555 +        }
 25.1556 +        dbg.location(105, 2);
 25.1557 +
 25.1558 +        }
 25.1559 +        finally {
 25.1560 +            dbg.exitRule(getGrammarFileName(), "throwsSpec");
 25.1561 +            decRuleLevel();
 25.1562 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1563 +        }
 25.1564 +
 25.1565 +        return ;
 25.1566 +    }
 25.1567 +    // $ANTLR end "throwsSpec"
 25.1568 +
 25.1569 +
 25.1570 +    // $ANTLR start "ruleScopeSpec"
 25.1571 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:107:1: ruleScopeSpec : ( ^( 'scope' ACTION ) | ^( 'scope' ACTION ( ID )+ ) | ^( 'scope' ( ID )+ ) );
 25.1572 +    public final void ruleScopeSpec() throws RecognitionException {
 25.1573 +        try { dbg.enterRule(getGrammarFileName(), "ruleScopeSpec");
 25.1574 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1575 +        incRuleLevel();
 25.1576 +        dbg.location(107, 1);
 25.1577 +
 25.1578 +        try {
 25.1579 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:108:2: ( ^( 'scope' ACTION ) | ^( 'scope' ACTION ( ID )+ ) | ^( 'scope' ( ID )+ ) )
 25.1580 +            int alt21=3;
 25.1581 +            try { dbg.enterDecision(21, decisionCanBacktrack[21]);
 25.1582 +
 25.1583 +            int LA21_0 = input.LA(1);
 25.1584 +
 25.1585 +            if ( (LA21_0==SCOPE) ) {
 25.1586 +                int LA21_1 = input.LA(2);
 25.1587 +
 25.1588 +                if ( (LA21_1==DOWN) ) {
 25.1589 +                    int LA21_2 = input.LA(3);
 25.1590 +
 25.1591 +                    if ( (LA21_2==ACTION) ) {
 25.1592 +                        int LA21_3 = input.LA(4);
 25.1593 +
 25.1594 +                        if ( (LA21_3==UP) ) {
 25.1595 +                            alt21=1;
 25.1596 +                        }
 25.1597 +                        else if ( (LA21_3==ID) ) {
 25.1598 +                            alt21=2;
 25.1599 +                        }
 25.1600 +                        else {
 25.1601 +                            NoViableAltException nvae =
 25.1602 +                                new NoViableAltException("", 21, 3, input);
 25.1603 +
 25.1604 +                            dbg.recognitionException(nvae);
 25.1605 +                            throw nvae;
 25.1606 +                        }
 25.1607 +                    }
 25.1608 +                    else if ( (LA21_2==ID) ) {
 25.1609 +                        alt21=3;
 25.1610 +                    }
 25.1611 +                    else {
 25.1612 +                        NoViableAltException nvae =
 25.1613 +                            new NoViableAltException("", 21, 2, input);
 25.1614 +
 25.1615 +                        dbg.recognitionException(nvae);
 25.1616 +                        throw nvae;
 25.1617 +                    }
 25.1618 +                }
 25.1619 +                else {
 25.1620 +                    NoViableAltException nvae =
 25.1621 +                        new NoViableAltException("", 21, 1, input);
 25.1622 +
 25.1623 +                    dbg.recognitionException(nvae);
 25.1624 +                    throw nvae;
 25.1625 +                }
 25.1626 +            }
 25.1627 +            else {
 25.1628 +                NoViableAltException nvae =
 25.1629 +                    new NoViableAltException("", 21, 0, input);
 25.1630 +
 25.1631 +                dbg.recognitionException(nvae);
 25.1632 +                throw nvae;
 25.1633 +            }
 25.1634 +            } finally {dbg.exitDecision(21);}
 25.1635 +
 25.1636 +            switch (alt21) {
 25.1637 +                case 1 :
 25.1638 +                    dbg.enterAlt(1);
 25.1639 +
 25.1640 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:108:4: ^( 'scope' ACTION )
 25.1641 +                    {
 25.1642 +                    dbg.location(108,4);
 25.1643 +                    dbg.location(108,6);
 25.1644 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec449); 
 25.1645 +
 25.1646 +                    match(input, Token.DOWN, null); 
 25.1647 +                    dbg.location(108,14);
 25.1648 +                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec451); 
 25.1649 +
 25.1650 +                    match(input, Token.UP, null); 
 25.1651 +
 25.1652 +                    }
 25.1653 +                    break;
 25.1654 +                case 2 :
 25.1655 +                    dbg.enterAlt(2);
 25.1656 +
 25.1657 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:4: ^( 'scope' ACTION ( ID )+ )
 25.1658 +                    {
 25.1659 +                    dbg.location(109,4);
 25.1660 +                    dbg.location(109,6);
 25.1661 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec458); 
 25.1662 +
 25.1663 +                    match(input, Token.DOWN, null); 
 25.1664 +                    dbg.location(109,14);
 25.1665 +                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec460); 
 25.1666 +                    dbg.location(109,21);
 25.1667 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:21: ( ID )+
 25.1668 +                    int cnt19=0;
 25.1669 +                    try { dbg.enterSubRule(19);
 25.1670 +
 25.1671 +                    loop19:
 25.1672 +                    do {
 25.1673 +                        int alt19=2;
 25.1674 +                        try { dbg.enterDecision(19, decisionCanBacktrack[19]);
 25.1675 +
 25.1676 +                        int LA19_0 = input.LA(1);
 25.1677 +
 25.1678 +                        if ( (LA19_0==ID) ) {
 25.1679 +                            alt19=1;
 25.1680 +                        }
 25.1681 +
 25.1682 +
 25.1683 +                        } finally {dbg.exitDecision(19);}
 25.1684 +
 25.1685 +                        switch (alt19) {
 25.1686 +                    	case 1 :
 25.1687 +                    	    dbg.enterAlt(1);
 25.1688 +
 25.1689 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:21: ID
 25.1690 +                    	    {
 25.1691 +                    	    dbg.location(109,21);
 25.1692 +                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec462); 
 25.1693 +
 25.1694 +                    	    }
 25.1695 +                    	    break;
 25.1696 +
 25.1697 +                    	default :
 25.1698 +                    	    if ( cnt19 >= 1 ) break loop19;
 25.1699 +                                EarlyExitException eee =
 25.1700 +                                    new EarlyExitException(19, input);
 25.1701 +                                dbg.recognitionException(eee);
 25.1702 +
 25.1703 +                                throw eee;
 25.1704 +                        }
 25.1705 +                        cnt19++;
 25.1706 +                    } while (true);
 25.1707 +                    } finally {dbg.exitSubRule(19);}
 25.1708 +
 25.1709 +
 25.1710 +                    match(input, Token.UP, null); 
 25.1711 +
 25.1712 +                    }
 25.1713 +                    break;
 25.1714 +                case 3 :
 25.1715 +                    dbg.enterAlt(3);
 25.1716 +
 25.1717 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:4: ^( 'scope' ( ID )+ )
 25.1718 +                    {
 25.1719 +                    dbg.location(110,4);
 25.1720 +                    dbg.location(110,6);
 25.1721 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec470); 
 25.1722 +
 25.1723 +                    match(input, Token.DOWN, null); 
 25.1724 +                    dbg.location(110,14);
 25.1725 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:14: ( ID )+
 25.1726 +                    int cnt20=0;
 25.1727 +                    try { dbg.enterSubRule(20);
 25.1728 +
 25.1729 +                    loop20:
 25.1730 +                    do {
 25.1731 +                        int alt20=2;
 25.1732 +                        try { dbg.enterDecision(20, decisionCanBacktrack[20]);
 25.1733 +
 25.1734 +                        int LA20_0 = input.LA(1);
 25.1735 +
 25.1736 +                        if ( (LA20_0==ID) ) {
 25.1737 +                            alt20=1;
 25.1738 +                        }
 25.1739 +
 25.1740 +
 25.1741 +                        } finally {dbg.exitDecision(20);}
 25.1742 +
 25.1743 +                        switch (alt20) {
 25.1744 +                    	case 1 :
 25.1745 +                    	    dbg.enterAlt(1);
 25.1746 +
 25.1747 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:14: ID
 25.1748 +                    	    {
 25.1749 +                    	    dbg.location(110,14);
 25.1750 +                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec472); 
 25.1751 +
 25.1752 +                    	    }
 25.1753 +                    	    break;
 25.1754 +
 25.1755 +                    	default :
 25.1756 +                    	    if ( cnt20 >= 1 ) break loop20;
 25.1757 +                                EarlyExitException eee =
 25.1758 +                                    new EarlyExitException(20, input);
 25.1759 +                                dbg.recognitionException(eee);
 25.1760 +
 25.1761 +                                throw eee;
 25.1762 +                        }
 25.1763 +                        cnt20++;
 25.1764 +                    } while (true);
 25.1765 +                    } finally {dbg.exitSubRule(20);}
 25.1766 +
 25.1767 +
 25.1768 +                    match(input, Token.UP, null); 
 25.1769 +
 25.1770 +                    }
 25.1771 +                    break;
 25.1772 +
 25.1773 +            }
 25.1774 +        }
 25.1775 +        catch (RecognitionException re) {
 25.1776 +            reportError(re);
 25.1777 +            recover(input,re);
 25.1778 +        }
 25.1779 +        finally {
 25.1780 +        }
 25.1781 +        dbg.location(111, 2);
 25.1782 +
 25.1783 +        }
 25.1784 +        finally {
 25.1785 +            dbg.exitRule(getGrammarFileName(), "ruleScopeSpec");
 25.1786 +            decRuleLevel();
 25.1787 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1788 +        }
 25.1789 +
 25.1790 +        return ;
 25.1791 +    }
 25.1792 +    // $ANTLR end "ruleScopeSpec"
 25.1793 +
 25.1794 +
 25.1795 +    // $ANTLR start "block"
 25.1796 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:113:1: block : ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB ) ;
 25.1797 +    public final void block() throws RecognitionException {
 25.1798 +        try { dbg.enterRule(getGrammarFileName(), "block");
 25.1799 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1800 +        incRuleLevel();
 25.1801 +        dbg.location(113, 1);
 25.1802 +
 25.1803 +        try {
 25.1804 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:5: ( ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB ) )
 25.1805 +            dbg.enterAlt(1);
 25.1806 +
 25.1807 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:9: ^( BLOCK ( optionsSpec )? ( alternative rewrite )+ EOB )
 25.1808 +            {
 25.1809 +            dbg.location(114,9);
 25.1810 +            dbg.location(114,12);
 25.1811 +            match(input,BLOCK,FOLLOW_BLOCK_in_block492); 
 25.1812 +
 25.1813 +            match(input, Token.DOWN, null); 
 25.1814 +            dbg.location(114,18);
 25.1815 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:18: ( optionsSpec )?
 25.1816 +            int alt22=2;
 25.1817 +            try { dbg.enterSubRule(22);
 25.1818 +            try { dbg.enterDecision(22, decisionCanBacktrack[22]);
 25.1819 +
 25.1820 +            int LA22_0 = input.LA(1);
 25.1821 +
 25.1822 +            if ( (LA22_0==OPTIONS) ) {
 25.1823 +                alt22=1;
 25.1824 +            }
 25.1825 +            } finally {dbg.exitDecision(22);}
 25.1826 +
 25.1827 +            switch (alt22) {
 25.1828 +                case 1 :
 25.1829 +                    dbg.enterAlt(1);
 25.1830 +
 25.1831 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:18: optionsSpec
 25.1832 +                    {
 25.1833 +                    dbg.location(114,18);
 25.1834 +                    pushFollow(FOLLOW_optionsSpec_in_block494);
 25.1835 +                    optionsSpec();
 25.1836 +
 25.1837 +                    state._fsp--;
 25.1838 +
 25.1839 +
 25.1840 +                    }
 25.1841 +                    break;
 25.1842 +
 25.1843 +            }
 25.1844 +            } finally {dbg.exitSubRule(22);}
 25.1845 +
 25.1846 +            dbg.location(114,31);
 25.1847 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:31: ( alternative rewrite )+
 25.1848 +            int cnt23=0;
 25.1849 +            try { dbg.enterSubRule(23);
 25.1850 +
 25.1851 +            loop23:
 25.1852 +            do {
 25.1853 +                int alt23=2;
 25.1854 +                try { dbg.enterDecision(23, decisionCanBacktrack[23]);
 25.1855 +
 25.1856 +                int LA23_0 = input.LA(1);
 25.1857 +
 25.1858 +                if ( (LA23_0==ALT) ) {
 25.1859 +                    alt23=1;
 25.1860 +                }
 25.1861 +
 25.1862 +
 25.1863 +                } finally {dbg.exitDecision(23);}
 25.1864 +
 25.1865 +                switch (alt23) {
 25.1866 +            	case 1 :
 25.1867 +            	    dbg.enterAlt(1);
 25.1868 +
 25.1869 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:32: alternative rewrite
 25.1870 +            	    {
 25.1871 +            	    dbg.location(114,32);
 25.1872 +            	    pushFollow(FOLLOW_alternative_in_block498);
 25.1873 +            	    alternative();
 25.1874 +
 25.1875 +            	    state._fsp--;
 25.1876 +
 25.1877 +            	    dbg.location(114,44);
 25.1878 +            	    pushFollow(FOLLOW_rewrite_in_block500);
 25.1879 +            	    rewrite();
 25.1880 +
 25.1881 +            	    state._fsp--;
 25.1882 +
 25.1883 +
 25.1884 +            	    }
 25.1885 +            	    break;
 25.1886 +
 25.1887 +            	default :
 25.1888 +            	    if ( cnt23 >= 1 ) break loop23;
 25.1889 +                        EarlyExitException eee =
 25.1890 +                            new EarlyExitException(23, input);
 25.1891 +                        dbg.recognitionException(eee);
 25.1892 +
 25.1893 +                        throw eee;
 25.1894 +                }
 25.1895 +                cnt23++;
 25.1896 +            } while (true);
 25.1897 +            } finally {dbg.exitSubRule(23);}
 25.1898 +
 25.1899 +            dbg.location(114,54);
 25.1900 +            match(input,EOB,FOLLOW_EOB_in_block504); 
 25.1901 +
 25.1902 +            match(input, Token.UP, null); 
 25.1903 +
 25.1904 +            }
 25.1905 +
 25.1906 +        }
 25.1907 +        catch (RecognitionException re) {
 25.1908 +            reportError(re);
 25.1909 +            recover(input,re);
 25.1910 +        }
 25.1911 +        finally {
 25.1912 +        }
 25.1913 +        dbg.location(115, 5);
 25.1914 +
 25.1915 +        }
 25.1916 +        finally {
 25.1917 +            dbg.exitRule(getGrammarFileName(), "block");
 25.1918 +            decRuleLevel();
 25.1919 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.1920 +        }
 25.1921 +
 25.1922 +        return ;
 25.1923 +    }
 25.1924 +    // $ANTLR end "block"
 25.1925 +
 25.1926 +
 25.1927 +    // $ANTLR start "altList"
 25.1928 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:117:1: altList : ^( BLOCK ( alternative rewrite )+ EOB ) ;
 25.1929 +    public final void altList() throws RecognitionException {
 25.1930 +        try { dbg.enterRule(getGrammarFileName(), "altList");
 25.1931 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.1932 +        incRuleLevel();
 25.1933 +        dbg.location(117, 1);
 25.1934 +
 25.1935 +        try {
 25.1936 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:5: ( ^( BLOCK ( alternative rewrite )+ EOB ) )
 25.1937 +            dbg.enterAlt(1);
 25.1938 +
 25.1939 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:9: ^( BLOCK ( alternative rewrite )+ EOB )
 25.1940 +            {
 25.1941 +            dbg.location(118,9);
 25.1942 +            dbg.location(118,12);
 25.1943 +            match(input,BLOCK,FOLLOW_BLOCK_in_altList527); 
 25.1944 +
 25.1945 +            match(input, Token.DOWN, null); 
 25.1946 +            dbg.location(118,18);
 25.1947 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:18: ( alternative rewrite )+
 25.1948 +            int cnt24=0;
 25.1949 +            try { dbg.enterSubRule(24);
 25.1950 +
 25.1951 +            loop24:
 25.1952 +            do {
 25.1953 +                int alt24=2;
 25.1954 +                try { dbg.enterDecision(24, decisionCanBacktrack[24]);
 25.1955 +
 25.1956 +                int LA24_0 = input.LA(1);
 25.1957 +
 25.1958 +                if ( (LA24_0==ALT) ) {
 25.1959 +                    alt24=1;
 25.1960 +                }
 25.1961 +
 25.1962 +
 25.1963 +                } finally {dbg.exitDecision(24);}
 25.1964 +
 25.1965 +                switch (alt24) {
 25.1966 +            	case 1 :
 25.1967 +            	    dbg.enterAlt(1);
 25.1968 +
 25.1969 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:19: alternative rewrite
 25.1970 +            	    {
 25.1971 +            	    dbg.location(118,19);
 25.1972 +            	    pushFollow(FOLLOW_alternative_in_altList530);
 25.1973 +            	    alternative();
 25.1974 +
 25.1975 +            	    state._fsp--;
 25.1976 +
 25.1977 +            	    dbg.location(118,31);
 25.1978 +            	    pushFollow(FOLLOW_rewrite_in_altList532);
 25.1979 +            	    rewrite();
 25.1980 +
 25.1981 +            	    state._fsp--;
 25.1982 +
 25.1983 +
 25.1984 +            	    }
 25.1985 +            	    break;
 25.1986 +
 25.1987 +            	default :
 25.1988 +            	    if ( cnt24 >= 1 ) break loop24;
 25.1989 +                        EarlyExitException eee =
 25.1990 +                            new EarlyExitException(24, input);
 25.1991 +                        dbg.recognitionException(eee);
 25.1992 +
 25.1993 +                        throw eee;
 25.1994 +                }
 25.1995 +                cnt24++;
 25.1996 +            } while (true);
 25.1997 +            } finally {dbg.exitSubRule(24);}
 25.1998 +
 25.1999 +            dbg.location(118,41);
 25.2000 +            match(input,EOB,FOLLOW_EOB_in_altList536); 
 25.2001 +
 25.2002 +            match(input, Token.UP, null); 
 25.2003 +
 25.2004 +            }
 25.2005 +
 25.2006 +        }
 25.2007 +        catch (RecognitionException re) {
 25.2008 +            reportError(re);
 25.2009 +            recover(input,re);
 25.2010 +        }
 25.2011 +        finally {
 25.2012 +        }
 25.2013 +        dbg.location(119, 5);
 25.2014 +
 25.2015 +        }
 25.2016 +        finally {
 25.2017 +            dbg.exitRule(getGrammarFileName(), "altList");
 25.2018 +            decRuleLevel();
 25.2019 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2020 +        }
 25.2021 +
 25.2022 +        return ;
 25.2023 +    }
 25.2024 +    // $ANTLR end "altList"
 25.2025 +
 25.2026 +
 25.2027 +    // $ANTLR start "alternative"
 25.2028 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:121:1: alternative : ( ^( ALT ( element )+ EOA ) | ^( ALT EPSILON EOA ) );
 25.2029 +    public final void alternative() throws RecognitionException {
 25.2030 +        try { dbg.enterRule(getGrammarFileName(), "alternative");
 25.2031 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2032 +        incRuleLevel();
 25.2033 +        dbg.location(121, 1);
 25.2034 +
 25.2035 +        try {
 25.2036 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:5: ( ^( ALT ( element )+ EOA ) | ^( ALT EPSILON EOA ) )
 25.2037 +            int alt26=2;
 25.2038 +            try { dbg.enterDecision(26, decisionCanBacktrack[26]);
 25.2039 +
 25.2040 +            int LA26_0 = input.LA(1);
 25.2041 +
 25.2042 +            if ( (LA26_0==ALT) ) {
 25.2043 +                int LA26_1 = input.LA(2);
 25.2044 +
 25.2045 +                if ( (LA26_1==DOWN) ) {
 25.2046 +                    int LA26_2 = input.LA(3);
 25.2047 +
 25.2048 +                    if ( (LA26_2==EPSILON) ) {
 25.2049 +                        alt26=2;
 25.2050 +                    }
 25.2051 +                    else if ( ((LA26_2>=BLOCK && LA26_2<=SYNPRED)||LA26_2==CHAR_RANGE||(LA26_2>=SEMPRED && LA26_2<=SYN_SEMPRED)||(LA26_2>=TREE_BEGIN && LA26_2<=BANG)||(LA26_2>=TOKEN_REF && LA26_2<=ACTION)||LA26_2==RULE_REF||LA26_2==71||LA26_2==87||LA26_2==89||LA26_2==92) ) {
 25.2052 +                        alt26=1;
 25.2053 +                    }
 25.2054 +                    else {
 25.2055 +                        NoViableAltException nvae =
 25.2056 +                            new NoViableAltException("", 26, 2, input);
 25.2057 +
 25.2058 +                        dbg.recognitionException(nvae);
 25.2059 +                        throw nvae;
 25.2060 +                    }
 25.2061 +                }
 25.2062 +                else {
 25.2063 +                    NoViableAltException nvae =
 25.2064 +                        new NoViableAltException("", 26, 1, input);
 25.2065 +
 25.2066 +                    dbg.recognitionException(nvae);
 25.2067 +                    throw nvae;
 25.2068 +                }
 25.2069 +            }
 25.2070 +            else {
 25.2071 +                NoViableAltException nvae =
 25.2072 +                    new NoViableAltException("", 26, 0, input);
 25.2073 +
 25.2074 +                dbg.recognitionException(nvae);
 25.2075 +                throw nvae;
 25.2076 +            }
 25.2077 +            } finally {dbg.exitDecision(26);}
 25.2078 +
 25.2079 +            switch (alt26) {
 25.2080 +                case 1 :
 25.2081 +                    dbg.enterAlt(1);
 25.2082 +
 25.2083 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:9: ^( ALT ( element )+ EOA )
 25.2084 +                    {
 25.2085 +                    dbg.location(122,9);
 25.2086 +                    dbg.location(122,11);
 25.2087 +                    match(input,ALT,FOLLOW_ALT_in_alternative558); 
 25.2088 +
 25.2089 +                    match(input, Token.DOWN, null); 
 25.2090 +                    dbg.location(122,15);
 25.2091 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:15: ( element )+
 25.2092 +                    int cnt25=0;
 25.2093 +                    try { dbg.enterSubRule(25);
 25.2094 +
 25.2095 +                    loop25:
 25.2096 +                    do {
 25.2097 +                        int alt25=2;
 25.2098 +                        try { dbg.enterDecision(25, decisionCanBacktrack[25]);
 25.2099 +
 25.2100 +                        int LA25_0 = input.LA(1);
 25.2101 +
 25.2102 +                        if ( ((LA25_0>=BLOCK && LA25_0<=SYNPRED)||LA25_0==CHAR_RANGE||(LA25_0>=SEMPRED && LA25_0<=SYN_SEMPRED)||(LA25_0>=TREE_BEGIN && LA25_0<=BANG)||(LA25_0>=TOKEN_REF && LA25_0<=ACTION)||LA25_0==RULE_REF||LA25_0==71||LA25_0==87||LA25_0==89||LA25_0==92) ) {
 25.2103 +                            alt25=1;
 25.2104 +                        }
 25.2105 +
 25.2106 +
 25.2107 +                        } finally {dbg.exitDecision(25);}
 25.2108 +
 25.2109 +                        switch (alt25) {
 25.2110 +                    	case 1 :
 25.2111 +                    	    dbg.enterAlt(1);
 25.2112 +
 25.2113 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:15: element
 25.2114 +                    	    {
 25.2115 +                    	    dbg.location(122,15);
 25.2116 +                    	    pushFollow(FOLLOW_element_in_alternative560);
 25.2117 +                    	    element();
 25.2118 +
 25.2119 +                    	    state._fsp--;
 25.2120 +
 25.2121 +
 25.2122 +                    	    }
 25.2123 +                    	    break;
 25.2124 +
 25.2125 +                    	default :
 25.2126 +                    	    if ( cnt25 >= 1 ) break loop25;
 25.2127 +                                EarlyExitException eee =
 25.2128 +                                    new EarlyExitException(25, input);
 25.2129 +                                dbg.recognitionException(eee);
 25.2130 +
 25.2131 +                                throw eee;
 25.2132 +                        }
 25.2133 +                        cnt25++;
 25.2134 +                    } while (true);
 25.2135 +                    } finally {dbg.exitSubRule(25);}
 25.2136 +
 25.2137 +                    dbg.location(122,24);
 25.2138 +                    match(input,EOA,FOLLOW_EOA_in_alternative563); 
 25.2139 +
 25.2140 +                    match(input, Token.UP, null); 
 25.2141 +
 25.2142 +                    }
 25.2143 +                    break;
 25.2144 +                case 2 :
 25.2145 +                    dbg.enterAlt(2);
 25.2146 +
 25.2147 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:123:9: ^( ALT EPSILON EOA )
 25.2148 +                    {
 25.2149 +                    dbg.location(123,9);
 25.2150 +                    dbg.location(123,11);
 25.2151 +                    match(input,ALT,FOLLOW_ALT_in_alternative575); 
 25.2152 +
 25.2153 +                    match(input, Token.DOWN, null); 
 25.2154 +                    dbg.location(123,15);
 25.2155 +                    match(input,EPSILON,FOLLOW_EPSILON_in_alternative577); 
 25.2156 +                    dbg.location(123,23);
 25.2157 +                    match(input,EOA,FOLLOW_EOA_in_alternative579); 
 25.2158 +
 25.2159 +                    match(input, Token.UP, null); 
 25.2160 +
 25.2161 +                    }
 25.2162 +                    break;
 25.2163 +
 25.2164 +            }
 25.2165 +        }
 25.2166 +        catch (RecognitionException re) {
 25.2167 +            reportError(re);
 25.2168 +            recover(input,re);
 25.2169 +        }
 25.2170 +        finally {
 25.2171 +        }
 25.2172 +        dbg.location(124, 5);
 25.2173 +
 25.2174 +        }
 25.2175 +        finally {
 25.2176 +            dbg.exitRule(getGrammarFileName(), "alternative");
 25.2177 +            decRuleLevel();
 25.2178 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2179 +        }
 25.2180 +
 25.2181 +        return ;
 25.2182 +    }
 25.2183 +    // $ANTLR end "alternative"
 25.2184 +
 25.2185 +
 25.2186 +    // $ANTLR start "exceptionGroup"
 25.2187 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:126:1: exceptionGroup : ( ( exceptionHandler )+ ( finallyClause )? | finallyClause );
 25.2188 +    public final void exceptionGroup() throws RecognitionException {
 25.2189 +        try { dbg.enterRule(getGrammarFileName(), "exceptionGroup");
 25.2190 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2191 +        incRuleLevel();
 25.2192 +        dbg.location(126, 1);
 25.2193 +
 25.2194 +        try {
 25.2195 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:2: ( ( exceptionHandler )+ ( finallyClause )? | finallyClause )
 25.2196 +            int alt29=2;
 25.2197 +            try { dbg.enterDecision(29, decisionCanBacktrack[29]);
 25.2198 +
 25.2199 +            int LA29_0 = input.LA(1);
 25.2200 +
 25.2201 +            if ( (LA29_0==85) ) {
 25.2202 +                alt29=1;
 25.2203 +            }
 25.2204 +            else if ( (LA29_0==86) ) {
 25.2205 +                alt29=2;
 25.2206 +            }
 25.2207 +            else {
 25.2208 +                NoViableAltException nvae =
 25.2209 +                    new NoViableAltException("", 29, 0, input);
 25.2210 +
 25.2211 +                dbg.recognitionException(nvae);
 25.2212 +                throw nvae;
 25.2213 +            }
 25.2214 +            } finally {dbg.exitDecision(29);}
 25.2215 +
 25.2216 +            switch (alt29) {
 25.2217 +                case 1 :
 25.2218 +                    dbg.enterAlt(1);
 25.2219 +
 25.2220 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: ( exceptionHandler )+ ( finallyClause )?
 25.2221 +                    {
 25.2222 +                    dbg.location(127,4);
 25.2223 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: ( exceptionHandler )+
 25.2224 +                    int cnt27=0;
 25.2225 +                    try { dbg.enterSubRule(27);
 25.2226 +
 25.2227 +                    loop27:
 25.2228 +                    do {
 25.2229 +                        int alt27=2;
 25.2230 +                        try { dbg.enterDecision(27, decisionCanBacktrack[27]);
 25.2231 +
 25.2232 +                        int LA27_0 = input.LA(1);
 25.2233 +
 25.2234 +                        if ( (LA27_0==85) ) {
 25.2235 +                            alt27=1;
 25.2236 +                        }
 25.2237 +
 25.2238 +
 25.2239 +                        } finally {dbg.exitDecision(27);}
 25.2240 +
 25.2241 +                        switch (alt27) {
 25.2242 +                    	case 1 :
 25.2243 +                    	    dbg.enterAlt(1);
 25.2244 +
 25.2245 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: exceptionHandler
 25.2246 +                    	    {
 25.2247 +                    	    dbg.location(127,4);
 25.2248 +                    	    pushFollow(FOLLOW_exceptionHandler_in_exceptionGroup594);
 25.2249 +                    	    exceptionHandler();
 25.2250 +
 25.2251 +                    	    state._fsp--;
 25.2252 +
 25.2253 +
 25.2254 +                    	    }
 25.2255 +                    	    break;
 25.2256 +
 25.2257 +                    	default :
 25.2258 +                    	    if ( cnt27 >= 1 ) break loop27;
 25.2259 +                                EarlyExitException eee =
 25.2260 +                                    new EarlyExitException(27, input);
 25.2261 +                                dbg.recognitionException(eee);
 25.2262 +
 25.2263 +                                throw eee;
 25.2264 +                        }
 25.2265 +                        cnt27++;
 25.2266 +                    } while (true);
 25.2267 +                    } finally {dbg.exitSubRule(27);}
 25.2268 +
 25.2269 +                    dbg.location(127,22);
 25.2270 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:22: ( finallyClause )?
 25.2271 +                    int alt28=2;
 25.2272 +                    try { dbg.enterSubRule(28);
 25.2273 +                    try { dbg.enterDecision(28, decisionCanBacktrack[28]);
 25.2274 +
 25.2275 +                    int LA28_0 = input.LA(1);
 25.2276 +
 25.2277 +                    if ( (LA28_0==86) ) {
 25.2278 +                        alt28=1;
 25.2279 +                    }
 25.2280 +                    } finally {dbg.exitDecision(28);}
 25.2281 +
 25.2282 +                    switch (alt28) {
 25.2283 +                        case 1 :
 25.2284 +                            dbg.enterAlt(1);
 25.2285 +
 25.2286 +                            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:22: finallyClause
 25.2287 +                            {
 25.2288 +                            dbg.location(127,22);
 25.2289 +                            pushFollow(FOLLOW_finallyClause_in_exceptionGroup597);
 25.2290 +                            finallyClause();
 25.2291 +
 25.2292 +                            state._fsp--;
 25.2293 +
 25.2294 +
 25.2295 +                            }
 25.2296 +                            break;
 25.2297 +
 25.2298 +                    }
 25.2299 +                    } finally {dbg.exitSubRule(28);}
 25.2300 +
 25.2301 +
 25.2302 +                    }
 25.2303 +                    break;
 25.2304 +                case 2 :
 25.2305 +                    dbg.enterAlt(2);
 25.2306 +
 25.2307 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:128:4: finallyClause
 25.2308 +                    {
 25.2309 +                    dbg.location(128,4);
 25.2310 +                    pushFollow(FOLLOW_finallyClause_in_exceptionGroup603);
 25.2311 +                    finallyClause();
 25.2312 +
 25.2313 +                    state._fsp--;
 25.2314 +
 25.2315 +
 25.2316 +                    }
 25.2317 +                    break;
 25.2318 +
 25.2319 +            }
 25.2320 +        }
 25.2321 +        catch (RecognitionException re) {
 25.2322 +            reportError(re);
 25.2323 +            recover(input,re);
 25.2324 +        }
 25.2325 +        finally {
 25.2326 +        }
 25.2327 +        dbg.location(129, 5);
 25.2328 +
 25.2329 +        }
 25.2330 +        finally {
 25.2331 +            dbg.exitRule(getGrammarFileName(), "exceptionGroup");
 25.2332 +            decRuleLevel();
 25.2333 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2334 +        }
 25.2335 +
 25.2336 +        return ;
 25.2337 +    }
 25.2338 +    // $ANTLR end "exceptionGroup"
 25.2339 +
 25.2340 +
 25.2341 +    // $ANTLR start "exceptionHandler"
 25.2342 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:131:1: exceptionHandler : ^( 'catch' ARG_ACTION ACTION ) ;
 25.2343 +    public final void exceptionHandler() throws RecognitionException {
 25.2344 +        try { dbg.enterRule(getGrammarFileName(), "exceptionHandler");
 25.2345 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2346 +        incRuleLevel();
 25.2347 +        dbg.location(131, 1);
 25.2348 +
 25.2349 +        try {
 25.2350 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:132:5: ( ^( 'catch' ARG_ACTION ACTION ) )
 25.2351 +            dbg.enterAlt(1);
 25.2352 +
 25.2353 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:132:10: ^( 'catch' ARG_ACTION ACTION )
 25.2354 +            {
 25.2355 +            dbg.location(132,10);
 25.2356 +            dbg.location(132,12);
 25.2357 +            match(input,85,FOLLOW_85_in_exceptionHandler624); 
 25.2358 +
 25.2359 +            match(input, Token.DOWN, null); 
 25.2360 +            dbg.location(132,20);
 25.2361 +            match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_exceptionHandler626); 
 25.2362 +            dbg.location(132,31);
 25.2363 +            match(input,ACTION,FOLLOW_ACTION_in_exceptionHandler628); 
 25.2364 +
 25.2365 +            match(input, Token.UP, null); 
 25.2366 +
 25.2367 +            }
 25.2368 +
 25.2369 +        }
 25.2370 +        catch (RecognitionException re) {
 25.2371 +            reportError(re);
 25.2372 +            recover(input,re);
 25.2373 +        }
 25.2374 +        finally {
 25.2375 +        }
 25.2376 +        dbg.location(133, 5);
 25.2377 +
 25.2378 +        }
 25.2379 +        finally {
 25.2380 +            dbg.exitRule(getGrammarFileName(), "exceptionHandler");
 25.2381 +            decRuleLevel();
 25.2382 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2383 +        }
 25.2384 +
 25.2385 +        return ;
 25.2386 +    }
 25.2387 +    // $ANTLR end "exceptionHandler"
 25.2388 +
 25.2389 +
 25.2390 +    // $ANTLR start "finallyClause"
 25.2391 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:135:1: finallyClause : ^( 'finally' ACTION ) ;
 25.2392 +    public final void finallyClause() throws RecognitionException {
 25.2393 +        try { dbg.enterRule(getGrammarFileName(), "finallyClause");
 25.2394 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2395 +        incRuleLevel();
 25.2396 +        dbg.location(135, 1);
 25.2397 +
 25.2398 +        try {
 25.2399 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:136:5: ( ^( 'finally' ACTION ) )
 25.2400 +            dbg.enterAlt(1);
 25.2401 +
 25.2402 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:136:10: ^( 'finally' ACTION )
 25.2403 +            {
 25.2404 +            dbg.location(136,10);
 25.2405 +            dbg.location(136,12);
 25.2406 +            match(input,86,FOLLOW_86_in_finallyClause650); 
 25.2407 +
 25.2408 +            match(input, Token.DOWN, null); 
 25.2409 +            dbg.location(136,22);
 25.2410 +            match(input,ACTION,FOLLOW_ACTION_in_finallyClause652); 
 25.2411 +
 25.2412 +            match(input, Token.UP, null); 
 25.2413 +
 25.2414 +            }
 25.2415 +
 25.2416 +        }
 25.2417 +        catch (RecognitionException re) {
 25.2418 +            reportError(re);
 25.2419 +            recover(input,re);
 25.2420 +        }
 25.2421 +        finally {
 25.2422 +        }
 25.2423 +        dbg.location(137, 5);
 25.2424 +
 25.2425 +        }
 25.2426 +        finally {
 25.2427 +            dbg.exitRule(getGrammarFileName(), "finallyClause");
 25.2428 +            decRuleLevel();
 25.2429 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2430 +        }
 25.2431 +
 25.2432 +        return ;
 25.2433 +    }
 25.2434 +    // $ANTLR end "finallyClause"
 25.2435 +
 25.2436 +
 25.2437 +    // $ANTLR start "element"
 25.2438 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:139:1: element : elementNoOptionSpec ;
 25.2439 +    public final void element() throws RecognitionException {
 25.2440 +        try { dbg.enterRule(getGrammarFileName(), "element");
 25.2441 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2442 +        incRuleLevel();
 25.2443 +        dbg.location(139, 1);
 25.2444 +
 25.2445 +        try {
 25.2446 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:140:2: ( elementNoOptionSpec )
 25.2447 +            dbg.enterAlt(1);
 25.2448 +
 25.2449 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:140:4: elementNoOptionSpec
 25.2450 +            {
 25.2451 +            dbg.location(140,4);
 25.2452 +            pushFollow(FOLLOW_elementNoOptionSpec_in_element667);
 25.2453 +            elementNoOptionSpec();
 25.2454 +
 25.2455 +            state._fsp--;
 25.2456 +
 25.2457 +
 25.2458 +            }
 25.2459 +
 25.2460 +        }
 25.2461 +        catch (RecognitionException re) {
 25.2462 +            reportError(re);
 25.2463 +            recover(input,re);
 25.2464 +        }
 25.2465 +        finally {
 25.2466 +        }
 25.2467 +        dbg.location(141, 2);
 25.2468 +
 25.2469 +        }
 25.2470 +        finally {
 25.2471 +            dbg.exitRule(getGrammarFileName(), "element");
 25.2472 +            decRuleLevel();
 25.2473 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2474 +        }
 25.2475 +
 25.2476 +        return ;
 25.2477 +    }
 25.2478 +    // $ANTLR end "element"
 25.2479 +
 25.2480 +
 25.2481 +    // $ANTLR start "elementNoOptionSpec"
 25.2482 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:143:1: elementNoOptionSpec : ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | treeSpec );
 25.2483 +    public final void elementNoOptionSpec() throws RecognitionException {
 25.2484 +        try { dbg.enterRule(getGrammarFileName(), "elementNoOptionSpec");
 25.2485 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2486 +        incRuleLevel();
 25.2487 +        dbg.location(143, 1);
 25.2488 +
 25.2489 +        try {
 25.2490 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:144:2: ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | treeSpec )
 25.2491 +            int alt30=8;
 25.2492 +            try { dbg.enterDecision(30, decisionCanBacktrack[30]);
 25.2493 +
 25.2494 +            try {
 25.2495 +                isCyclicDecision = true;
 25.2496 +                alt30 = dfa30.predict(input);
 25.2497 +            }
 25.2498 +            catch (NoViableAltException nvae) {
 25.2499 +                dbg.recognitionException(nvae);
 25.2500 +                throw nvae;
 25.2501 +            }
 25.2502 +            } finally {dbg.exitDecision(30);}
 25.2503 +
 25.2504 +            switch (alt30) {
 25.2505 +                case 1 :
 25.2506 +                    dbg.enterAlt(1);
 25.2507 +
 25.2508 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:144:4: ^( ( '=' | '+=' ) ID block )
 25.2509 +                    {
 25.2510 +                    dbg.location(144,4);
 25.2511 +                    dbg.location(144,6);
 25.2512 +                    if ( input.LA(1)==71||input.LA(1)==87 ) {
 25.2513 +                        input.consume();
 25.2514 +                        state.errorRecovery=false;
 25.2515 +                    }
 25.2516 +                    else {
 25.2517 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 25.2518 +                        dbg.recognitionException(mse);
 25.2519 +                        throw mse;
 25.2520 +                    }
 25.2521 +
 25.2522 +
 25.2523 +                    match(input, Token.DOWN, null); 
 25.2524 +                    dbg.location(144,17);
 25.2525 +                    match(input,ID,FOLLOW_ID_in_elementNoOptionSpec685); 
 25.2526 +                    dbg.location(144,20);
 25.2527 +                    pushFollow(FOLLOW_block_in_elementNoOptionSpec687);
 25.2528 +                    block();
 25.2529 +
 25.2530 +                    state._fsp--;
 25.2531 +
 25.2532 +
 25.2533 +                    match(input, Token.UP, null); 
 25.2534 +
 25.2535 +                    }
 25.2536 +                    break;
 25.2537 +                case 2 :
 25.2538 +                    dbg.enterAlt(2);
 25.2539 +
 25.2540 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:145:4: ^( ( '=' | '+=' ) ID atom )
 25.2541 +                    {
 25.2542 +                    dbg.location(145,4);
 25.2543 +                    dbg.location(145,6);
 25.2544 +                    if ( input.LA(1)==71||input.LA(1)==87 ) {
 25.2545 +                        input.consume();
 25.2546 +                        state.errorRecovery=false;
 25.2547 +                    }
 25.2548 +                    else {
 25.2549 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 25.2550 +                        dbg.recognitionException(mse);
 25.2551 +                        throw mse;
 25.2552 +                    }
 25.2553 +
 25.2554 +
 25.2555 +                    match(input, Token.DOWN, null); 
 25.2556 +                    dbg.location(145,17);
 25.2557 +                    match(input,ID,FOLLOW_ID_in_elementNoOptionSpec700); 
 25.2558 +                    dbg.location(145,20);
 25.2559 +                    pushFollow(FOLLOW_atom_in_elementNoOptionSpec702);
 25.2560 +                    atom();
 25.2561 +
 25.2562 +                    state._fsp--;
 25.2563 +
 25.2564 +
 25.2565 +                    match(input, Token.UP, null); 
 25.2566 +
 25.2567 +                    }
 25.2568 +                    break;
 25.2569 +                case 3 :
 25.2570 +                    dbg.enterAlt(3);
 25.2571 +
 25.2572 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:146:4: atom
 25.2573 +                    {
 25.2574 +                    dbg.location(146,4);
 25.2575 +                    pushFollow(FOLLOW_atom_in_elementNoOptionSpec708);
 25.2576 +                    atom();
 25.2577 +
 25.2578 +                    state._fsp--;
 25.2579 +
 25.2580 +
 25.2581 +                    }
 25.2582 +                    break;
 25.2583 +                case 4 :
 25.2584 +                    dbg.enterAlt(4);
 25.2585 +
 25.2586 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:147:4: ebnf
 25.2587 +                    {
 25.2588 +                    dbg.location(147,4);
 25.2589 +                    pushFollow(FOLLOW_ebnf_in_elementNoOptionSpec713);
 25.2590 +                    ebnf();
 25.2591 +
 25.2592 +                    state._fsp--;
 25.2593 +
 25.2594 +
 25.2595 +                    }
 25.2596 +                    break;
 25.2597 +                case 5 :
 25.2598 +                    dbg.enterAlt(5);
 25.2599 +
 25.2600 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:148:6: ACTION
 25.2601 +                    {
 25.2602 +                    dbg.location(148,6);
 25.2603 +                    match(input,ACTION,FOLLOW_ACTION_in_elementNoOptionSpec720); 
 25.2604 +
 25.2605 +                    }
 25.2606 +                    break;
 25.2607 +                case 6 :
 25.2608 +                    dbg.enterAlt(6);
 25.2609 +
 25.2610 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:149:6: SEMPRED
 25.2611 +                    {
 25.2612 +                    dbg.location(149,6);
 25.2613 +                    match(input,SEMPRED,FOLLOW_SEMPRED_in_elementNoOptionSpec727); 
 25.2614 +
 25.2615 +                    }
 25.2616 +                    break;
 25.2617 +                case 7 :
 25.2618 +                    dbg.enterAlt(7);
 25.2619 +
 25.2620 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:150:4: GATED_SEMPRED
 25.2621 +                    {
 25.2622 +                    dbg.location(150,4);
 25.2623 +                    match(input,GATED_SEMPRED,FOLLOW_GATED_SEMPRED_in_elementNoOptionSpec732); 
 25.2624 +
 25.2625 +                    }
 25.2626 +                    break;
 25.2627 +                case 8 :
 25.2628 +                    dbg.enterAlt(8);
 25.2629 +
 25.2630 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:151:6: treeSpec
 25.2631 +                    {
 25.2632 +                    dbg.location(151,6);
 25.2633 +                    pushFollow(FOLLOW_treeSpec_in_elementNoOptionSpec739);
 25.2634 +                    treeSpec();
 25.2635 +
 25.2636 +                    state._fsp--;
 25.2637 +
 25.2638 +
 25.2639 +                    }
 25.2640 +                    break;
 25.2641 +
 25.2642 +            }
 25.2643 +        }
 25.2644 +        catch (RecognitionException re) {
 25.2645 +            reportError(re);
 25.2646 +            recover(input,re);
 25.2647 +        }
 25.2648 +        finally {
 25.2649 +        }
 25.2650 +        dbg.location(152, 2);
 25.2651 +
 25.2652 +        }
 25.2653 +        finally {
 25.2654 +            dbg.exitRule(getGrammarFileName(), "elementNoOptionSpec");
 25.2655 +            decRuleLevel();
 25.2656 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2657 +        }
 25.2658 +
 25.2659 +        return ;
 25.2660 +    }
 25.2661 +    // $ANTLR end "elementNoOptionSpec"
 25.2662 +
 25.2663 +
 25.2664 +    // $ANTLR start "atom"
 25.2665 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:154:1: atom : ( ^( ( '^' | '!' ) atom ) | range | notSet | ^( RULE_REF ARG_ACTION ) | RULE_REF | terminal );
 25.2666 +    public final void atom() throws RecognitionException {
 25.2667 +        try { dbg.enterRule(getGrammarFileName(), "atom");
 25.2668 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2669 +        incRuleLevel();
 25.2670 +        dbg.location(154, 1);
 25.2671 +
 25.2672 +        try {
 25.2673 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:154:5: ( ^( ( '^' | '!' ) atom ) | range | notSet | ^( RULE_REF ARG_ACTION ) | RULE_REF | terminal )
 25.2674 +            int alt31=6;
 25.2675 +            try { dbg.enterDecision(31, decisionCanBacktrack[31]);
 25.2676 +
 25.2677 +            switch ( input.LA(1) ) {
 25.2678 +            case ROOT:
 25.2679 +            case BANG:
 25.2680 +                {
 25.2681 +                alt31=1;
 25.2682 +                }
 25.2683 +                break;
 25.2684 +            case CHAR_RANGE:
 25.2685 +                {
 25.2686 +                alt31=2;
 25.2687 +                }
 25.2688 +                break;
 25.2689 +            case 89:
 25.2690 +                {
 25.2691 +                alt31=3;
 25.2692 +                }
 25.2693 +                break;
 25.2694 +            case RULE_REF:
 25.2695 +                {
 25.2696 +                int LA31_4 = input.LA(2);
 25.2697 +
 25.2698 +                if ( (LA31_4==DOWN) ) {
 25.2699 +                    alt31=4;
 25.2700 +                }
 25.2701 +                else if ( (LA31_4==UP||(LA31_4>=BLOCK && LA31_4<=SYNPRED)||LA31_4==CHAR_RANGE||LA31_4==EOA||(LA31_4>=SEMPRED && LA31_4<=SYN_SEMPRED)||(LA31_4>=TREE_BEGIN && LA31_4<=BANG)||(LA31_4>=TOKEN_REF && LA31_4<=ACTION)||LA31_4==RULE_REF||LA31_4==71||LA31_4==87||LA31_4==89||LA31_4==92) ) {
 25.2702 +                    alt31=5;
 25.2703 +                }
 25.2704 +                else {
 25.2705 +                    NoViableAltException nvae =
 25.2706 +                        new NoViableAltException("", 31, 4, input);
 25.2707 +
 25.2708 +                    dbg.recognitionException(nvae);
 25.2709 +                    throw nvae;
 25.2710 +                }
 25.2711 +                }
 25.2712 +                break;
 25.2713 +            case TOKEN_REF:
 25.2714 +            case STRING_LITERAL:
 25.2715 +            case CHAR_LITERAL:
 25.2716 +            case 92:
 25.2717 +                {
 25.2718 +                alt31=6;
 25.2719 +                }
 25.2720 +                break;
 25.2721 +            default:
 25.2722 +                NoViableAltException nvae =
 25.2723 +                    new NoViableAltException("", 31, 0, input);
 25.2724 +
 25.2725 +                dbg.recognitionException(nvae);
 25.2726 +                throw nvae;
 25.2727 +            }
 25.2728 +
 25.2729 +            } finally {dbg.exitDecision(31);}
 25.2730 +
 25.2731 +            switch (alt31) {
 25.2732 +                case 1 :
 25.2733 +                    dbg.enterAlt(1);
 25.2734 +
 25.2735 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:154:9: ^( ( '^' | '!' ) atom )
 25.2736 +                    {
 25.2737 +                    dbg.location(154,9);
 25.2738 +                    dbg.location(154,11);
 25.2739 +                    if ( (input.LA(1)>=ROOT && input.LA(1)<=BANG) ) {
 25.2740 +                        input.consume();
 25.2741 +                        state.errorRecovery=false;
 25.2742 +                    }
 25.2743 +                    else {
 25.2744 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 25.2745 +                        dbg.recognitionException(mse);
 25.2746 +                        throw mse;
 25.2747 +                    }
 25.2748 +
 25.2749 +
 25.2750 +                    match(input, Token.DOWN, null); 
 25.2751 +                    dbg.location(154,21);
 25.2752 +                    pushFollow(FOLLOW_atom_in_atom757);
 25.2753 +                    atom();
 25.2754 +
 25.2755 +                    state._fsp--;
 25.2756 +
 25.2757 +
 25.2758 +                    match(input, Token.UP, null); 
 25.2759 +
 25.2760 +                    }
 25.2761 +                    break;
 25.2762 +                case 2 :
 25.2763 +                    dbg.enterAlt(2);
 25.2764 +
 25.2765 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:155:4: range
 25.2766 +                    {
 25.2767 +                    dbg.location(155,4);
 25.2768 +                    pushFollow(FOLLOW_range_in_atom763);
 25.2769 +                    range();
 25.2770 +
 25.2771 +                    state._fsp--;
 25.2772 +
 25.2773 +
 25.2774 +                    }
 25.2775 +                    break;
 25.2776 +                case 3 :
 25.2777 +                    dbg.enterAlt(3);
 25.2778 +
 25.2779 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:156:4: notSet
 25.2780 +                    {
 25.2781 +                    dbg.location(156,4);
 25.2782 +                    pushFollow(FOLLOW_notSet_in_atom768);
 25.2783 +                    notSet();
 25.2784 +
 25.2785 +                    state._fsp--;
 25.2786 +
 25.2787 +
 25.2788 +                    }
 25.2789 +                    break;
 25.2790 +                case 4 :
 25.2791 +                    dbg.enterAlt(4);
 25.2792 +
 25.2793 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:157:7: ^( RULE_REF ARG_ACTION )
 25.2794 +                    {
 25.2795 +                    dbg.location(157,7);
 25.2796 +                    dbg.location(157,9);
 25.2797 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom777); 
 25.2798 +
 25.2799 +                    match(input, Token.DOWN, null); 
 25.2800 +                    dbg.location(157,18);
 25.2801 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom779); 
 25.2802 +
 25.2803 +                    match(input, Token.UP, null); 
 25.2804 +
 25.2805 +                    }
 25.2806 +                    break;
 25.2807 +                case 5 :
 25.2808 +                    dbg.enterAlt(5);
 25.2809 +
 25.2810 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:158:7: RULE_REF
 25.2811 +                    {
 25.2812 +                    dbg.location(158,7);
 25.2813 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom788); 
 25.2814 +
 25.2815 +                    }
 25.2816 +                    break;
 25.2817 +                case 6 :
 25.2818 +                    dbg.enterAlt(6);
 25.2819 +
 25.2820 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:159:9: terminal
 25.2821 +                    {
 25.2822 +                    dbg.location(159,9);
 25.2823 +                    pushFollow(FOLLOW_terminal_in_atom798);
 25.2824 +                    terminal();
 25.2825 +
 25.2826 +                    state._fsp--;
 25.2827 +
 25.2828 +
 25.2829 +                    }
 25.2830 +                    break;
 25.2831 +
 25.2832 +            }
 25.2833 +        }
 25.2834 +        catch (RecognitionException re) {
 25.2835 +            reportError(re);
 25.2836 +            recover(input,re);
 25.2837 +        }
 25.2838 +        finally {
 25.2839 +        }
 25.2840 +        dbg.location(160, 5);
 25.2841 +
 25.2842 +        }
 25.2843 +        finally {
 25.2844 +            dbg.exitRule(getGrammarFileName(), "atom");
 25.2845 +            decRuleLevel();
 25.2846 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2847 +        }
 25.2848 +
 25.2849 +        return ;
 25.2850 +    }
 25.2851 +    // $ANTLR end "atom"
 25.2852 +
 25.2853 +
 25.2854 +    // $ANTLR start "notSet"
 25.2855 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:162:1: notSet : ( ^( '~' notTerminal ) | ^( '~' block ) );
 25.2856 +    public final void notSet() throws RecognitionException {
 25.2857 +        try { dbg.enterRule(getGrammarFileName(), "notSet");
 25.2858 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2859 +        incRuleLevel();
 25.2860 +        dbg.location(162, 1);
 25.2861 +
 25.2862 +        try {
 25.2863 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:163:2: ( ^( '~' notTerminal ) | ^( '~' block ) )
 25.2864 +            int alt32=2;
 25.2865 +            try { dbg.enterDecision(32, decisionCanBacktrack[32]);
 25.2866 +
 25.2867 +            int LA32_0 = input.LA(1);
 25.2868 +
 25.2869 +            if ( (LA32_0==89) ) {
 25.2870 +                int LA32_1 = input.LA(2);
 25.2871 +
 25.2872 +                if ( (LA32_1==DOWN) ) {
 25.2873 +                    int LA32_2 = input.LA(3);
 25.2874 +
 25.2875 +                    if ( ((LA32_2>=TOKEN_REF && LA32_2<=CHAR_LITERAL)) ) {
 25.2876 +                        alt32=1;
 25.2877 +                    }
 25.2878 +                    else if ( (LA32_2==BLOCK) ) {
 25.2879 +                        alt32=2;
 25.2880 +                    }
 25.2881 +                    else {
 25.2882 +                        NoViableAltException nvae =
 25.2883 +                            new NoViableAltException("", 32, 2, input);
 25.2884 +
 25.2885 +                        dbg.recognitionException(nvae);
 25.2886 +                        throw nvae;
 25.2887 +                    }
 25.2888 +                }
 25.2889 +                else {
 25.2890 +                    NoViableAltException nvae =
 25.2891 +                        new NoViableAltException("", 32, 1, input);
 25.2892 +
 25.2893 +                    dbg.recognitionException(nvae);
 25.2894 +                    throw nvae;
 25.2895 +                }
 25.2896 +            }
 25.2897 +            else {
 25.2898 +                NoViableAltException nvae =
 25.2899 +                    new NoViableAltException("", 32, 0, input);
 25.2900 +
 25.2901 +                dbg.recognitionException(nvae);
 25.2902 +                throw nvae;
 25.2903 +            }
 25.2904 +            } finally {dbg.exitDecision(32);}
 25.2905 +
 25.2906 +            switch (alt32) {
 25.2907 +                case 1 :
 25.2908 +                    dbg.enterAlt(1);
 25.2909 +
 25.2910 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:163:4: ^( '~' notTerminal )
 25.2911 +                    {
 25.2912 +                    dbg.location(163,4);
 25.2913 +                    dbg.location(163,6);
 25.2914 +                    match(input,89,FOLLOW_89_in_notSet813); 
 25.2915 +
 25.2916 +                    match(input, Token.DOWN, null); 
 25.2917 +                    dbg.location(163,10);
 25.2918 +                    pushFollow(FOLLOW_notTerminal_in_notSet815);
 25.2919 +                    notTerminal();
 25.2920 +
 25.2921 +                    state._fsp--;
 25.2922 +
 25.2923 +
 25.2924 +                    match(input, Token.UP, null); 
 25.2925 +
 25.2926 +                    }
 25.2927 +                    break;
 25.2928 +                case 2 :
 25.2929 +                    dbg.enterAlt(2);
 25.2930 +
 25.2931 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:164:4: ^( '~' block )
 25.2932 +                    {
 25.2933 +                    dbg.location(164,4);
 25.2934 +                    dbg.location(164,6);
 25.2935 +                    match(input,89,FOLLOW_89_in_notSet822); 
 25.2936 +
 25.2937 +                    match(input, Token.DOWN, null); 
 25.2938 +                    dbg.location(164,10);
 25.2939 +                    pushFollow(FOLLOW_block_in_notSet824);
 25.2940 +                    block();
 25.2941 +
 25.2942 +                    state._fsp--;
 25.2943 +
 25.2944 +
 25.2945 +                    match(input, Token.UP, null); 
 25.2946 +
 25.2947 +                    }
 25.2948 +                    break;
 25.2949 +
 25.2950 +            }
 25.2951 +        }
 25.2952 +        catch (RecognitionException re) {
 25.2953 +            reportError(re);
 25.2954 +            recover(input,re);
 25.2955 +        }
 25.2956 +        finally {
 25.2957 +        }
 25.2958 +        dbg.location(165, 2);
 25.2959 +
 25.2960 +        }
 25.2961 +        finally {
 25.2962 +            dbg.exitRule(getGrammarFileName(), "notSet");
 25.2963 +            decRuleLevel();
 25.2964 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.2965 +        }
 25.2966 +
 25.2967 +        return ;
 25.2968 +    }
 25.2969 +    // $ANTLR end "notSet"
 25.2970 +
 25.2971 +
 25.2972 +    // $ANTLR start "treeSpec"
 25.2973 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:167:1: treeSpec : ^( TREE_BEGIN ( element )+ ) ;
 25.2974 +    public final void treeSpec() throws RecognitionException {
 25.2975 +        try { dbg.enterRule(getGrammarFileName(), "treeSpec");
 25.2976 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.2977 +        incRuleLevel();
 25.2978 +        dbg.location(167, 1);
 25.2979 +
 25.2980 +        try {
 25.2981 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:2: ( ^( TREE_BEGIN ( element )+ ) )
 25.2982 +            dbg.enterAlt(1);
 25.2983 +
 25.2984 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:4: ^( TREE_BEGIN ( element )+ )
 25.2985 +            {
 25.2986 +            dbg.location(168,4);
 25.2987 +            dbg.location(168,6);
 25.2988 +            match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_treeSpec837); 
 25.2989 +
 25.2990 +            match(input, Token.DOWN, null); 
 25.2991 +            dbg.location(168,17);
 25.2992 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:17: ( element )+
 25.2993 +            int cnt33=0;
 25.2994 +            try { dbg.enterSubRule(33);
 25.2995 +
 25.2996 +            loop33:
 25.2997 +            do {
 25.2998 +                int alt33=2;
 25.2999 +                try { dbg.enterDecision(33, decisionCanBacktrack[33]);
 25.3000 +
 25.3001 +                int LA33_0 = input.LA(1);
 25.3002 +
 25.3003 +                if ( ((LA33_0>=BLOCK && LA33_0<=SYNPRED)||LA33_0==CHAR_RANGE||(LA33_0>=SEMPRED && LA33_0<=SYN_SEMPRED)||(LA33_0>=TREE_BEGIN && LA33_0<=BANG)||(LA33_0>=TOKEN_REF && LA33_0<=ACTION)||LA33_0==RULE_REF||LA33_0==71||LA33_0==87||LA33_0==89||LA33_0==92) ) {
 25.3004 +                    alt33=1;
 25.3005 +                }
 25.3006 +
 25.3007 +
 25.3008 +                } finally {dbg.exitDecision(33);}
 25.3009 +
 25.3010 +                switch (alt33) {
 25.3011 +            	case 1 :
 25.3012 +            	    dbg.enterAlt(1);
 25.3013 +
 25.3014 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:17: element
 25.3015 +            	    {
 25.3016 +            	    dbg.location(168,17);
 25.3017 +            	    pushFollow(FOLLOW_element_in_treeSpec839);
 25.3018 +            	    element();
 25.3019 +
 25.3020 +            	    state._fsp--;
 25.3021 +
 25.3022 +
 25.3023 +            	    }
 25.3024 +            	    break;
 25.3025 +
 25.3026 +            	default :
 25.3027 +            	    if ( cnt33 >= 1 ) break loop33;
 25.3028 +                        EarlyExitException eee =
 25.3029 +                            new EarlyExitException(33, input);
 25.3030 +                        dbg.recognitionException(eee);
 25.3031 +
 25.3032 +                        throw eee;
 25.3033 +                }
 25.3034 +                cnt33++;
 25.3035 +            } while (true);
 25.3036 +            } finally {dbg.exitSubRule(33);}
 25.3037 +
 25.3038 +
 25.3039 +            match(input, Token.UP, null); 
 25.3040 +
 25.3041 +            }
 25.3042 +
 25.3043 +        }
 25.3044 +        catch (RecognitionException re) {
 25.3045 +            reportError(re);
 25.3046 +            recover(input,re);
 25.3047 +        }
 25.3048 +        finally {
 25.3049 +        }
 25.3050 +        dbg.location(169, 2);
 25.3051 +
 25.3052 +        }
 25.3053 +        finally {
 25.3054 +            dbg.exitRule(getGrammarFileName(), "treeSpec");
 25.3055 +            decRuleLevel();
 25.3056 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3057 +        }
 25.3058 +
 25.3059 +        return ;
 25.3060 +    }
 25.3061 +    // $ANTLR end "treeSpec"
 25.3062 +
 25.3063 +
 25.3064 +    // $ANTLR start "ebnf"
 25.3065 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:171:1: ebnf : ( ^( SYNPRED block ) | SYN_SEMPRED | ^( ebnfSuffix block ) | block );
 25.3066 +    public final void ebnf() throws RecognitionException {
 25.3067 +        try { dbg.enterRule(getGrammarFileName(), "ebnf");
 25.3068 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3069 +        incRuleLevel();
 25.3070 +        dbg.location(171, 1);
 25.3071 +
 25.3072 +        try {
 25.3073 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:173:2: ( ^( SYNPRED block ) | SYN_SEMPRED | ^( ebnfSuffix block ) | block )
 25.3074 +            int alt34=4;
 25.3075 +            try { dbg.enterDecision(34, decisionCanBacktrack[34]);
 25.3076 +
 25.3077 +            switch ( input.LA(1) ) {
 25.3078 +            case SYNPRED:
 25.3079 +                {
 25.3080 +                alt34=1;
 25.3081 +                }
 25.3082 +                break;
 25.3083 +            case SYN_SEMPRED:
 25.3084 +                {
 25.3085 +                alt34=2;
 25.3086 +                }
 25.3087 +                break;
 25.3088 +            case OPTIONAL:
 25.3089 +            case CLOSURE:
 25.3090 +            case POSITIVE_CLOSURE:
 25.3091 +                {
 25.3092 +                alt34=3;
 25.3093 +                }
 25.3094 +                break;
 25.3095 +            case BLOCK:
 25.3096 +                {
 25.3097 +                alt34=4;
 25.3098 +                }
 25.3099 +                break;
 25.3100 +            default:
 25.3101 +                NoViableAltException nvae =
 25.3102 +                    new NoViableAltException("", 34, 0, input);
 25.3103 +
 25.3104 +                dbg.recognitionException(nvae);
 25.3105 +                throw nvae;
 25.3106 +            }
 25.3107 +
 25.3108 +            } finally {dbg.exitDecision(34);}
 25.3109 +
 25.3110 +            switch (alt34) {
 25.3111 +                case 1 :
 25.3112 +                    dbg.enterAlt(1);
 25.3113 +
 25.3114 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:173:4: ^( SYNPRED block )
 25.3115 +                    {
 25.3116 +                    dbg.location(173,4);
 25.3117 +                    dbg.location(173,6);
 25.3118 +                    match(input,SYNPRED,FOLLOW_SYNPRED_in_ebnf855); 
 25.3119 +
 25.3120 +                    match(input, Token.DOWN, null); 
 25.3121 +                    dbg.location(173,14);
 25.3122 +                    pushFollow(FOLLOW_block_in_ebnf857);
 25.3123 +                    block();
 25.3124 +
 25.3125 +                    state._fsp--;
 25.3126 +
 25.3127 +
 25.3128 +                    match(input, Token.UP, null); 
 25.3129 +
 25.3130 +                    }
 25.3131 +                    break;
 25.3132 +                case 2 :
 25.3133 +                    dbg.enterAlt(2);
 25.3134 +
 25.3135 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:174:4: SYN_SEMPRED
 25.3136 +                    {
 25.3137 +                    dbg.location(174,4);
 25.3138 +                    match(input,SYN_SEMPRED,FOLLOW_SYN_SEMPRED_in_ebnf863); 
 25.3139 +
 25.3140 +                    }
 25.3141 +                    break;
 25.3142 +                case 3 :
 25.3143 +                    dbg.enterAlt(3);
 25.3144 +
 25.3145 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:175:4: ^( ebnfSuffix block )
 25.3146 +                    {
 25.3147 +                    dbg.location(175,4);
 25.3148 +                    dbg.location(175,6);
 25.3149 +                    pushFollow(FOLLOW_ebnfSuffix_in_ebnf869);
 25.3150 +                    ebnfSuffix();
 25.3151 +
 25.3152 +                    state._fsp--;
 25.3153 +
 25.3154 +
 25.3155 +                    match(input, Token.DOWN, null); 
 25.3156 +                    dbg.location(175,17);
 25.3157 +                    pushFollow(FOLLOW_block_in_ebnf871);
 25.3158 +                    block();
 25.3159 +
 25.3160 +                    state._fsp--;
 25.3161 +
 25.3162 +
 25.3163 +                    match(input, Token.UP, null); 
 25.3164 +
 25.3165 +                    }
 25.3166 +                    break;
 25.3167 +                case 4 :
 25.3168 +                    dbg.enterAlt(4);
 25.3169 +
 25.3170 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:176:4: block
 25.3171 +                    {
 25.3172 +                    dbg.location(176,4);
 25.3173 +                    pushFollow(FOLLOW_block_in_ebnf877);
 25.3174 +                    block();
 25.3175 +
 25.3176 +                    state._fsp--;
 25.3177 +
 25.3178 +
 25.3179 +                    }
 25.3180 +                    break;
 25.3181 +
 25.3182 +            }
 25.3183 +        }
 25.3184 +        catch (RecognitionException re) {
 25.3185 +            reportError(re);
 25.3186 +            recover(input,re);
 25.3187 +        }
 25.3188 +        finally {
 25.3189 +        }
 25.3190 +        dbg.location(177, 2);
 25.3191 +
 25.3192 +        }
 25.3193 +        finally {
 25.3194 +            dbg.exitRule(getGrammarFileName(), "ebnf");
 25.3195 +            decRuleLevel();
 25.3196 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3197 +        }
 25.3198 +
 25.3199 +        return ;
 25.3200 +    }
 25.3201 +    // $ANTLR end "ebnf"
 25.3202 +
 25.3203 +
 25.3204 +    // $ANTLR start "range"
 25.3205 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:179:1: range : ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL ) ;
 25.3206 +    public final void range() throws RecognitionException {
 25.3207 +        try { dbg.enterRule(getGrammarFileName(), "range");
 25.3208 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3209 +        incRuleLevel();
 25.3210 +        dbg.location(179, 1);
 25.3211 +
 25.3212 +        try {
 25.3213 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:180:2: ( ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL ) )
 25.3214 +            dbg.enterAlt(1);
 25.3215 +
 25.3216 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:180:4: ^( CHAR_RANGE CHAR_LITERAL CHAR_LITERAL )
 25.3217 +            {
 25.3218 +            dbg.location(180,4);
 25.3219 +            dbg.location(180,6);
 25.3220 +            match(input,CHAR_RANGE,FOLLOW_CHAR_RANGE_in_range889); 
 25.3221 +
 25.3222 +            match(input, Token.DOWN, null); 
 25.3223 +            dbg.location(180,17);
 25.3224 +            match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_range891); 
 25.3225 +            dbg.location(180,30);
 25.3226 +            match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_range893); 
 25.3227 +
 25.3228 +            match(input, Token.UP, null); 
 25.3229 +
 25.3230 +            }
 25.3231 +
 25.3232 +        }
 25.3233 +        catch (RecognitionException re) {
 25.3234 +            reportError(re);
 25.3235 +            recover(input,re);
 25.3236 +        }
 25.3237 +        finally {
 25.3238 +        }
 25.3239 +        dbg.location(181, 2);
 25.3240 +
 25.3241 +        }
 25.3242 +        finally {
 25.3243 +            dbg.exitRule(getGrammarFileName(), "range");
 25.3244 +            decRuleLevel();
 25.3245 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3246 +        }
 25.3247 +
 25.3248 +        return ;
 25.3249 +    }
 25.3250 +    // $ANTLR end "range"
 25.3251 +
 25.3252 +
 25.3253 +    // $ANTLR start "terminal"
 25.3254 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:183:1: terminal : ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL | ^( TOKEN_REF ARG_ACTION ) | '.' );
 25.3255 +    public final void terminal() throws RecognitionException {
 25.3256 +        try { dbg.enterRule(getGrammarFileName(), "terminal");
 25.3257 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3258 +        incRuleLevel();
 25.3259 +        dbg.location(183, 1);
 25.3260 +
 25.3261 +        try {
 25.3262 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:184:5: ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL | ^( TOKEN_REF ARG_ACTION ) | '.' )
 25.3263 +            int alt35=5;
 25.3264 +            try { dbg.enterDecision(35, decisionCanBacktrack[35]);
 25.3265 +
 25.3266 +            switch ( input.LA(1) ) {
 25.3267 +            case CHAR_LITERAL:
 25.3268 +                {
 25.3269 +                alt35=1;
 25.3270 +                }
 25.3271 +                break;
 25.3272 +            case TOKEN_REF:
 25.3273 +                {
 25.3274 +                int LA35_2 = input.LA(2);
 25.3275 +
 25.3276 +                if ( (LA35_2==DOWN) ) {
 25.3277 +                    alt35=4;
 25.3278 +                }
 25.3279 +                else if ( (LA35_2==UP||(LA35_2>=BLOCK && LA35_2<=SYNPRED)||LA35_2==CHAR_RANGE||LA35_2==EOA||(LA35_2>=SEMPRED && LA35_2<=SYN_SEMPRED)||(LA35_2>=TREE_BEGIN && LA35_2<=BANG)||(LA35_2>=TOKEN_REF && LA35_2<=ACTION)||LA35_2==RULE_REF||LA35_2==71||LA35_2==87||LA35_2==89||LA35_2==92) ) {
 25.3280 +                    alt35=2;
 25.3281 +                }
 25.3282 +                else {
 25.3283 +                    NoViableAltException nvae =
 25.3284 +                        new NoViableAltException("", 35, 2, input);
 25.3285 +
 25.3286 +                    dbg.recognitionException(nvae);
 25.3287 +                    throw nvae;
 25.3288 +                }
 25.3289 +                }
 25.3290 +                break;
 25.3291 +            case STRING_LITERAL:
 25.3292 +                {
 25.3293 +                alt35=3;
 25.3294 +                }
 25.3295 +                break;
 25.3296 +            case 92:
 25.3297 +                {
 25.3298 +                alt35=5;
 25.3299 +                }
 25.3300 +                break;
 25.3301 +            default:
 25.3302 +                NoViableAltException nvae =
 25.3303 +                    new NoViableAltException("", 35, 0, input);
 25.3304 +
 25.3305 +                dbg.recognitionException(nvae);
 25.3306 +                throw nvae;
 25.3307 +            }
 25.3308 +
 25.3309 +            } finally {dbg.exitDecision(35);}
 25.3310 +
 25.3311 +            switch (alt35) {
 25.3312 +                case 1 :
 25.3313 +                    dbg.enterAlt(1);
 25.3314 +
 25.3315 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:184:9: CHAR_LITERAL
 25.3316 +                    {
 25.3317 +                    dbg.location(184,9);
 25.3318 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_terminal910); 
 25.3319 +
 25.3320 +                    }
 25.3321 +                    break;
 25.3322 +                case 2 :
 25.3323 +                    dbg.enterAlt(2);
 25.3324 +
 25.3325 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:185:7: TOKEN_REF
 25.3326 +                    {
 25.3327 +                    dbg.location(185,7);
 25.3328 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal918); 
 25.3329 +
 25.3330 +                    }
 25.3331 +                    break;
 25.3332 +                case 3 :
 25.3333 +                    dbg.enterAlt(3);
 25.3334 +
 25.3335 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:186:7: STRING_LITERAL
 25.3336 +                    {
 25.3337 +                    dbg.location(186,7);
 25.3338 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal926); 
 25.3339 +
 25.3340 +                    }
 25.3341 +                    break;
 25.3342 +                case 4 :
 25.3343 +                    dbg.enterAlt(4);
 25.3344 +
 25.3345 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:187:7: ^( TOKEN_REF ARG_ACTION )
 25.3346 +                    {
 25.3347 +                    dbg.location(187,7);
 25.3348 +                    dbg.location(187,9);
 25.3349 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal935); 
 25.3350 +
 25.3351 +                    match(input, Token.DOWN, null); 
 25.3352 +                    dbg.location(187,19);
 25.3353 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal937); 
 25.3354 +
 25.3355 +                    match(input, Token.UP, null); 
 25.3356 +
 25.3357 +                    }
 25.3358 +                    break;
 25.3359 +                case 5 :
 25.3360 +                    dbg.enterAlt(5);
 25.3361 +
 25.3362 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:188:7: '.'
 25.3363 +                    {
 25.3364 +                    dbg.location(188,7);
 25.3365 +                    match(input,92,FOLLOW_92_in_terminal946); 
 25.3366 +
 25.3367 +                    }
 25.3368 +                    break;
 25.3369 +
 25.3370 +            }
 25.3371 +        }
 25.3372 +        catch (RecognitionException re) {
 25.3373 +            reportError(re);
 25.3374 +            recover(input,re);
 25.3375 +        }
 25.3376 +        finally {
 25.3377 +        }
 25.3378 +        dbg.location(189, 2);
 25.3379 +
 25.3380 +        }
 25.3381 +        finally {
 25.3382 +            dbg.exitRule(getGrammarFileName(), "terminal");
 25.3383 +            decRuleLevel();
 25.3384 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3385 +        }
 25.3386 +
 25.3387 +        return ;
 25.3388 +    }
 25.3389 +    // $ANTLR end "terminal"
 25.3390 +
 25.3391 +
 25.3392 +    // $ANTLR start "notTerminal"
 25.3393 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:191:1: notTerminal : ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL );
 25.3394 +    public final void notTerminal() throws RecognitionException {
 25.3395 +        try { dbg.enterRule(getGrammarFileName(), "notTerminal");
 25.3396 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3397 +        incRuleLevel();
 25.3398 +        dbg.location(191, 1);
 25.3399 +
 25.3400 +        try {
 25.3401 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:192:2: ( CHAR_LITERAL | TOKEN_REF | STRING_LITERAL )
 25.3402 +            dbg.enterAlt(1);
 25.3403 +
 25.3404 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 25.3405 +            {
 25.3406 +            dbg.location(192,2);
 25.3407 +            if ( (input.LA(1)>=TOKEN_REF && input.LA(1)<=CHAR_LITERAL) ) {
 25.3408 +                input.consume();
 25.3409 +                state.errorRecovery=false;
 25.3410 +            }
 25.3411 +            else {
 25.3412 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 25.3413 +                dbg.recognitionException(mse);
 25.3414 +                throw mse;
 25.3415 +            }
 25.3416 +
 25.3417 +
 25.3418 +            }
 25.3419 +
 25.3420 +        }
 25.3421 +        catch (RecognitionException re) {
 25.3422 +            reportError(re);
 25.3423 +            recover(input,re);
 25.3424 +        }
 25.3425 +        finally {
 25.3426 +        }
 25.3427 +        dbg.location(195, 2);
 25.3428 +
 25.3429 +        }
 25.3430 +        finally {
 25.3431 +            dbg.exitRule(getGrammarFileName(), "notTerminal");
 25.3432 +            decRuleLevel();
 25.3433 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3434 +        }
 25.3435 +
 25.3436 +        return ;
 25.3437 +    }
 25.3438 +    // $ANTLR end "notTerminal"
 25.3439 +
 25.3440 +
 25.3441 +    // $ANTLR start "ebnfSuffix"
 25.3442 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:197:1: ebnfSuffix : ( OPTIONAL | CLOSURE | POSITIVE_CLOSURE );
 25.3443 +    public final void ebnfSuffix() throws RecognitionException {
 25.3444 +        try { dbg.enterRule(getGrammarFileName(), "ebnfSuffix");
 25.3445 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3446 +        incRuleLevel();
 25.3447 +        dbg.location(197, 1);
 25.3448 +
 25.3449 +        try {
 25.3450 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:198:2: ( OPTIONAL | CLOSURE | POSITIVE_CLOSURE )
 25.3451 +            dbg.enterAlt(1);
 25.3452 +
 25.3453 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 25.3454 +            {
 25.3455 +            dbg.location(198,2);
 25.3456 +            if ( (input.LA(1)>=OPTIONAL && input.LA(1)<=POSITIVE_CLOSURE) ) {
 25.3457 +                input.consume();
 25.3458 +                state.errorRecovery=false;
 25.3459 +            }
 25.3460 +            else {
 25.3461 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 25.3462 +                dbg.recognitionException(mse);
 25.3463 +                throw mse;
 25.3464 +            }
 25.3465 +
 25.3466 +
 25.3467 +            }
 25.3468 +
 25.3469 +        }
 25.3470 +        catch (RecognitionException re) {
 25.3471 +            reportError(re);
 25.3472 +            recover(input,re);
 25.3473 +        }
 25.3474 +        finally {
 25.3475 +        }
 25.3476 +        dbg.location(201, 2);
 25.3477 +
 25.3478 +        }
 25.3479 +        finally {
 25.3480 +            dbg.exitRule(getGrammarFileName(), "ebnfSuffix");
 25.3481 +            decRuleLevel();
 25.3482 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3483 +        }
 25.3484 +
 25.3485 +        return ;
 25.3486 +    }
 25.3487 +    // $ANTLR end "ebnfSuffix"
 25.3488 +
 25.3489 +
 25.3490 +    // $ANTLR start "rewrite"
 25.3491 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:205:1: rewrite : ( ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative ) | );
 25.3492 +    public final void rewrite() throws RecognitionException {
 25.3493 +        try { dbg.enterRule(getGrammarFileName(), "rewrite");
 25.3494 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3495 +        incRuleLevel();
 25.3496 +        dbg.location(205, 1);
 25.3497 +
 25.3498 +        try {
 25.3499 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:2: ( ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative ) | )
 25.3500 +            int alt37=2;
 25.3501 +            try { dbg.enterDecision(37, decisionCanBacktrack[37]);
 25.3502 +
 25.3503 +            int LA37_0 = input.LA(1);
 25.3504 +
 25.3505 +            if ( (LA37_0==REWRITE) ) {
 25.3506 +                alt37=1;
 25.3507 +            }
 25.3508 +            else if ( (LA37_0==ALT||LA37_0==EOB) ) {
 25.3509 +                alt37=2;
 25.3510 +            }
 25.3511 +            else {
 25.3512 +                NoViableAltException nvae =
 25.3513 +                    new NoViableAltException("", 37, 0, input);
 25.3514 +
 25.3515 +                dbg.recognitionException(nvae);
 25.3516 +                throw nvae;
 25.3517 +            }
 25.3518 +            } finally {dbg.exitDecision(37);}
 25.3519 +
 25.3520 +            switch (alt37) {
 25.3521 +                case 1 :
 25.3522 +                    dbg.enterAlt(1);
 25.3523 +
 25.3524 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:4: ( ^( '->' SEMPRED rewrite_alternative ) )* ^( '->' rewrite_alternative )
 25.3525 +                    {
 25.3526 +                    dbg.location(206,4);
 25.3527 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:4: ( ^( '->' SEMPRED rewrite_alternative ) )*
 25.3528 +                    try { dbg.enterSubRule(36);
 25.3529 +
 25.3530 +                    loop36:
 25.3531 +                    do {
 25.3532 +                        int alt36=2;
 25.3533 +                        try { dbg.enterDecision(36, decisionCanBacktrack[36]);
 25.3534 +
 25.3535 +                        int LA36_0 = input.LA(1);
 25.3536 +
 25.3537 +                        if ( (LA36_0==REWRITE) ) {
 25.3538 +                            int LA36_1 = input.LA(2);
 25.3539 +
 25.3540 +                            if ( (LA36_1==DOWN) ) {
 25.3541 +                                int LA36_2 = input.LA(3);
 25.3542 +
 25.3543 +                                if ( (LA36_2==SEMPRED) ) {
 25.3544 +                                    alt36=1;
 25.3545 +                                }
 25.3546 +
 25.3547 +
 25.3548 +                            }
 25.3549 +
 25.3550 +
 25.3551 +                        }
 25.3552 +
 25.3553 +
 25.3554 +                        } finally {dbg.exitDecision(36);}
 25.3555 +
 25.3556 +                        switch (alt36) {
 25.3557 +                    	case 1 :
 25.3558 +                    	    dbg.enterAlt(1);
 25.3559 +
 25.3560 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:5: ^( '->' SEMPRED rewrite_alternative )
 25.3561 +                    	    {
 25.3562 +                    	    dbg.location(206,5);
 25.3563 +                    	    dbg.location(206,7);
 25.3564 +                    	    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1012); 
 25.3565 +
 25.3566 +                    	    match(input, Token.DOWN, null); 
 25.3567 +                    	    dbg.location(206,12);
 25.3568 +                    	    match(input,SEMPRED,FOLLOW_SEMPRED_in_rewrite1014); 
 25.3569 +                    	    dbg.location(206,20);
 25.3570 +                    	    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1016);
 25.3571 +                    	    rewrite_alternative();
 25.3572 +
 25.3573 +                    	    state._fsp--;
 25.3574 +
 25.3575 +
 25.3576 +                    	    match(input, Token.UP, null); 
 25.3577 +
 25.3578 +                    	    }
 25.3579 +                    	    break;
 25.3580 +
 25.3581 +                    	default :
 25.3582 +                    	    break loop36;
 25.3583 +                        }
 25.3584 +                    } while (true);
 25.3585 +                    } finally {dbg.exitSubRule(36);}
 25.3586 +
 25.3587 +                    dbg.location(206,43);
 25.3588 +                    dbg.location(206,45);
 25.3589 +                    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1022); 
 25.3590 +
 25.3591 +                    match(input, Token.DOWN, null); 
 25.3592 +                    dbg.location(206,50);
 25.3593 +                    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1024);
 25.3594 +                    rewrite_alternative();
 25.3595 +
 25.3596 +                    state._fsp--;
 25.3597 +
 25.3598 +
 25.3599 +                    match(input, Token.UP, null); 
 25.3600 +
 25.3601 +                    }
 25.3602 +                    break;
 25.3603 +                case 2 :
 25.3604 +                    dbg.enterAlt(2);
 25.3605 +
 25.3606 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:208:2: 
 25.3607 +                    {
 25.3608 +                    }
 25.3609 +                    break;
 25.3610 +
 25.3611 +            }
 25.3612 +        }
 25.3613 +        catch (RecognitionException re) {
 25.3614 +            reportError(re);
 25.3615 +            recover(input,re);
 25.3616 +        }
 25.3617 +        finally {
 25.3618 +        }
 25.3619 +        dbg.location(208, 2);
 25.3620 +
 25.3621 +        }
 25.3622 +        finally {
 25.3623 +            dbg.exitRule(getGrammarFileName(), "rewrite");
 25.3624 +            decRuleLevel();
 25.3625 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3626 +        }
 25.3627 +
 25.3628 +        return ;
 25.3629 +    }
 25.3630 +    // $ANTLR end "rewrite"
 25.3631 +
 25.3632 +
 25.3633 +    // $ANTLR start "rewrite_alternative"
 25.3634 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:210:1: rewrite_alternative : ( rewrite_template | rewrite_tree_alternative | ^( ALT EPSILON EOA ) );
 25.3635 +    public final void rewrite_alternative() throws RecognitionException {
 25.3636 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_alternative");
 25.3637 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3638 +        incRuleLevel();
 25.3639 +        dbg.location(210, 1);
 25.3640 +
 25.3641 +        try {
 25.3642 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:211:2: ( rewrite_template | rewrite_tree_alternative | ^( ALT EPSILON EOA ) )
 25.3643 +            int alt38=3;
 25.3644 +            try { dbg.enterDecision(38, decisionCanBacktrack[38]);
 25.3645 +
 25.3646 +            int LA38_0 = input.LA(1);
 25.3647 +
 25.3648 +            if ( (LA38_0==TEMPLATE||LA38_0==ACTION) ) {
 25.3649 +                alt38=1;
 25.3650 +            }
 25.3651 +            else if ( (LA38_0==ALT) ) {
 25.3652 +                int LA38_2 = input.LA(2);
 25.3653 +
 25.3654 +                if ( (LA38_2==DOWN) ) {
 25.3655 +                    int LA38_3 = input.LA(3);
 25.3656 +
 25.3657 +                    if ( (LA38_3==EPSILON) ) {
 25.3658 +                        alt38=3;
 25.3659 +                    }
 25.3660 +                    else if ( ((LA38_3>=BLOCK && LA38_3<=POSITIVE_CLOSURE)||LA38_3==LABEL||LA38_3==TREE_BEGIN||(LA38_3>=TOKEN_REF && LA38_3<=ACTION)||LA38_3==RULE_REF) ) {
 25.3661 +                        alt38=2;
 25.3662 +                    }
 25.3663 +                    else {
 25.3664 +                        NoViableAltException nvae =
 25.3665 +                            new NoViableAltException("", 38, 3, input);
 25.3666 +
 25.3667 +                        dbg.recognitionException(nvae);
 25.3668 +                        throw nvae;
 25.3669 +                    }
 25.3670 +                }
 25.3671 +                else {
 25.3672 +                    NoViableAltException nvae =
 25.3673 +                        new NoViableAltException("", 38, 2, input);
 25.3674 +
 25.3675 +                    dbg.recognitionException(nvae);
 25.3676 +                    throw nvae;
 25.3677 +                }
 25.3678 +            }
 25.3679 +            else {
 25.3680 +                NoViableAltException nvae =
 25.3681 +                    new NoViableAltException("", 38, 0, input);
 25.3682 +
 25.3683 +                dbg.recognitionException(nvae);
 25.3684 +                throw nvae;
 25.3685 +            }
 25.3686 +            } finally {dbg.exitDecision(38);}
 25.3687 +
 25.3688 +            switch (alt38) {
 25.3689 +                case 1 :
 25.3690 +                    dbg.enterAlt(1);
 25.3691 +
 25.3692 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:211:4: rewrite_template
 25.3693 +                    {
 25.3694 +                    dbg.location(211,4);
 25.3695 +                    pushFollow(FOLLOW_rewrite_template_in_rewrite_alternative1039);
 25.3696 +                    rewrite_template();
 25.3697 +
 25.3698 +                    state._fsp--;
 25.3699 +
 25.3700 +
 25.3701 +                    }
 25.3702 +                    break;
 25.3703 +                case 2 :
 25.3704 +                    dbg.enterAlt(2);
 25.3705 +
 25.3706 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:212:4: rewrite_tree_alternative
 25.3707 +                    {
 25.3708 +                    dbg.location(212,4);
 25.3709 +                    pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_alternative1044);
 25.3710 +                    rewrite_tree_alternative();
 25.3711 +
 25.3712 +                    state._fsp--;
 25.3713 +
 25.3714 +
 25.3715 +                    }
 25.3716 +                    break;
 25.3717 +                case 3 :
 25.3718 +                    dbg.enterAlt(3);
 25.3719 +
 25.3720 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:213:9: ^( ALT EPSILON EOA )
 25.3721 +                    {
 25.3722 +                    dbg.location(213,9);
 25.3723 +                    dbg.location(213,11);
 25.3724 +                    match(input,ALT,FOLLOW_ALT_in_rewrite_alternative1055); 
 25.3725 +
 25.3726 +                    match(input, Token.DOWN, null); 
 25.3727 +                    dbg.location(213,15);
 25.3728 +                    match(input,EPSILON,FOLLOW_EPSILON_in_rewrite_alternative1057); 
 25.3729 +                    dbg.location(213,23);
 25.3730 +                    match(input,EOA,FOLLOW_EOA_in_rewrite_alternative1059); 
 25.3731 +
 25.3732 +                    match(input, Token.UP, null); 
 25.3733 +
 25.3734 +                    }
 25.3735 +                    break;
 25.3736 +
 25.3737 +            }
 25.3738 +        }
 25.3739 +        catch (RecognitionException re) {
 25.3740 +            reportError(re);
 25.3741 +            recover(input,re);
 25.3742 +        }
 25.3743 +        finally {
 25.3744 +        }
 25.3745 +        dbg.location(214, 2);
 25.3746 +
 25.3747 +        }
 25.3748 +        finally {
 25.3749 +            dbg.exitRule(getGrammarFileName(), "rewrite_alternative");
 25.3750 +            decRuleLevel();
 25.3751 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3752 +        }
 25.3753 +
 25.3754 +        return ;
 25.3755 +    }
 25.3756 +    // $ANTLR end "rewrite_alternative"
 25.3757 +
 25.3758 +
 25.3759 +    // $ANTLR start "rewrite_tree_block"
 25.3760 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:216:1: rewrite_tree_block : ^( BLOCK rewrite_tree_alternative EOB ) ;
 25.3761 +    public final void rewrite_tree_block() throws RecognitionException {
 25.3762 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_block");
 25.3763 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3764 +        incRuleLevel();
 25.3765 +        dbg.location(216, 1);
 25.3766 +
 25.3767 +        try {
 25.3768 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:217:5: ( ^( BLOCK rewrite_tree_alternative EOB ) )
 25.3769 +            dbg.enterAlt(1);
 25.3770 +
 25.3771 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:217:9: ^( BLOCK rewrite_tree_alternative EOB )
 25.3772 +            {
 25.3773 +            dbg.location(217,9);
 25.3774 +            dbg.location(217,11);
 25.3775 +            match(input,BLOCK,FOLLOW_BLOCK_in_rewrite_tree_block1078); 
 25.3776 +
 25.3777 +            match(input, Token.DOWN, null); 
 25.3778 +            dbg.location(217,17);
 25.3779 +            pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_tree_block1080);
 25.3780 +            rewrite_tree_alternative();
 25.3781 +
 25.3782 +            state._fsp--;
 25.3783 +
 25.3784 +            dbg.location(217,42);
 25.3785 +            match(input,EOB,FOLLOW_EOB_in_rewrite_tree_block1082); 
 25.3786 +
 25.3787 +            match(input, Token.UP, null); 
 25.3788 +
 25.3789 +            }
 25.3790 +
 25.3791 +        }
 25.3792 +        catch (RecognitionException re) {
 25.3793 +            reportError(re);
 25.3794 +            recover(input,re);
 25.3795 +        }
 25.3796 +        finally {
 25.3797 +        }
 25.3798 +        dbg.location(218, 5);
 25.3799 +
 25.3800 +        }
 25.3801 +        finally {
 25.3802 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_block");
 25.3803 +            decRuleLevel();
 25.3804 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3805 +        }
 25.3806 +
 25.3807 +        return ;
 25.3808 +    }
 25.3809 +    // $ANTLR end "rewrite_tree_block"
 25.3810 +
 25.3811 +
 25.3812 +    // $ANTLR start "rewrite_tree_alternative"
 25.3813 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:220:1: rewrite_tree_alternative : ^( ALT ( rewrite_tree_element )+ EOA ) ;
 25.3814 +    public final void rewrite_tree_alternative() throws RecognitionException {
 25.3815 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_alternative");
 25.3816 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3817 +        incRuleLevel();
 25.3818 +        dbg.location(220, 1);
 25.3819 +
 25.3820 +        try {
 25.3821 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:5: ( ^( ALT ( rewrite_tree_element )+ EOA ) )
 25.3822 +            dbg.enterAlt(1);
 25.3823 +
 25.3824 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:7: ^( ALT ( rewrite_tree_element )+ EOA )
 25.3825 +            {
 25.3826 +            dbg.location(221,7);
 25.3827 +            dbg.location(221,9);
 25.3828 +            match(input,ALT,FOLLOW_ALT_in_rewrite_tree_alternative1101); 
 25.3829 +
 25.3830 +            match(input, Token.DOWN, null); 
 25.3831 +            dbg.location(221,13);
 25.3832 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:13: ( rewrite_tree_element )+
 25.3833 +            int cnt39=0;
 25.3834 +            try { dbg.enterSubRule(39);
 25.3835 +
 25.3836 +            loop39:
 25.3837 +            do {
 25.3838 +                int alt39=2;
 25.3839 +                try { dbg.enterDecision(39, decisionCanBacktrack[39]);
 25.3840 +
 25.3841 +                int LA39_0 = input.LA(1);
 25.3842 +
 25.3843 +                if ( ((LA39_0>=BLOCK && LA39_0<=POSITIVE_CLOSURE)||LA39_0==LABEL||LA39_0==TREE_BEGIN||(LA39_0>=TOKEN_REF && LA39_0<=ACTION)||LA39_0==RULE_REF) ) {
 25.3844 +                    alt39=1;
 25.3845 +                }
 25.3846 +
 25.3847 +
 25.3848 +                } finally {dbg.exitDecision(39);}
 25.3849 +
 25.3850 +                switch (alt39) {
 25.3851 +            	case 1 :
 25.3852 +            	    dbg.enterAlt(1);
 25.3853 +
 25.3854 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:13: rewrite_tree_element
 25.3855 +            	    {
 25.3856 +            	    dbg.location(221,13);
 25.3857 +            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree_alternative1103);
 25.3858 +            	    rewrite_tree_element();
 25.3859 +
 25.3860 +            	    state._fsp--;
 25.3861 +
 25.3862 +
 25.3863 +            	    }
 25.3864 +            	    break;
 25.3865 +
 25.3866 +            	default :
 25.3867 +            	    if ( cnt39 >= 1 ) break loop39;
 25.3868 +                        EarlyExitException eee =
 25.3869 +                            new EarlyExitException(39, input);
 25.3870 +                        dbg.recognitionException(eee);
 25.3871 +
 25.3872 +                        throw eee;
 25.3873 +                }
 25.3874 +                cnt39++;
 25.3875 +            } while (true);
 25.3876 +            } finally {dbg.exitSubRule(39);}
 25.3877 +
 25.3878 +            dbg.location(221,35);
 25.3879 +            match(input,EOA,FOLLOW_EOA_in_rewrite_tree_alternative1106); 
 25.3880 +
 25.3881 +            match(input, Token.UP, null); 
 25.3882 +
 25.3883 +            }
 25.3884 +
 25.3885 +        }
 25.3886 +        catch (RecognitionException re) {
 25.3887 +            reportError(re);
 25.3888 +            recover(input,re);
 25.3889 +        }
 25.3890 +        finally {
 25.3891 +        }
 25.3892 +        dbg.location(222, 5);
 25.3893 +
 25.3894 +        }
 25.3895 +        finally {
 25.3896 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_alternative");
 25.3897 +            decRuleLevel();
 25.3898 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.3899 +        }
 25.3900 +
 25.3901 +        return ;
 25.3902 +    }
 25.3903 +    // $ANTLR end "rewrite_tree_alternative"
 25.3904 +
 25.3905 +
 25.3906 +    // $ANTLR start "rewrite_tree_element"
 25.3907 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:224:1: rewrite_tree_element : ( rewrite_tree_atom | rewrite_tree | rewrite_tree_block | rewrite_tree_ebnf );
 25.3908 +    public final void rewrite_tree_element() throws RecognitionException {
 25.3909 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_element");
 25.3910 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.3911 +        incRuleLevel();
 25.3912 +        dbg.location(224, 1);
 25.3913 +
 25.3914 +        try {
 25.3915 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:225:2: ( rewrite_tree_atom | rewrite_tree | rewrite_tree_block | rewrite_tree_ebnf )
 25.3916 +            int alt40=4;
 25.3917 +            try { dbg.enterDecision(40, decisionCanBacktrack[40]);
 25.3918 +
 25.3919 +            switch ( input.LA(1) ) {
 25.3920 +            case LABEL:
 25.3921 +            case TOKEN_REF:
 25.3922 +            case STRING_LITERAL:
 25.3923 +            case CHAR_LITERAL:
 25.3924 +            case ACTION:
 25.3925 +            case RULE_REF:
 25.3926 +                {
 25.3927 +                alt40=1;
 25.3928 +                }
 25.3929 +                break;
 25.3930 +            case TREE_BEGIN:
 25.3931 +                {
 25.3932 +                alt40=2;
 25.3933 +                }
 25.3934 +                break;
 25.3935 +            case BLOCK:
 25.3936 +                {
 25.3937 +                alt40=3;
 25.3938 +                }
 25.3939 +                break;
 25.3940 +            case OPTIONAL:
 25.3941 +            case CLOSURE:
 25.3942 +            case POSITIVE_CLOSURE:
 25.3943 +                {
 25.3944 +                alt40=4;
 25.3945 +                }
 25.3946 +                break;
 25.3947 +            default:
 25.3948 +                NoViableAltException nvae =
 25.3949 +                    new NoViableAltException("", 40, 0, input);
 25.3950 +
 25.3951 +                dbg.recognitionException(nvae);
 25.3952 +                throw nvae;
 25.3953 +            }
 25.3954 +
 25.3955 +            } finally {dbg.exitDecision(40);}
 25.3956 +
 25.3957 +            switch (alt40) {
 25.3958 +                case 1 :
 25.3959 +                    dbg.enterAlt(1);
 25.3960 +
 25.3961 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:225:4: rewrite_tree_atom
 25.3962 +                    {
 25.3963 +                    dbg.location(225,4);
 25.3964 +                    pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree_element1121);
 25.3965 +                    rewrite_tree_atom();
 25.3966 +
 25.3967 +                    state._fsp--;
 25.3968 +
 25.3969 +
 25.3970 +                    }
 25.3971 +                    break;
 25.3972 +                case 2 :
 25.3973 +                    dbg.enterAlt(2);
 25.3974 +
 25.3975 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:226:4: rewrite_tree
 25.3976 +                    {
 25.3977 +                    dbg.location(226,4);
 25.3978 +                    pushFollow(FOLLOW_rewrite_tree_in_rewrite_tree_element1126);
 25.3979 +                    rewrite_tree();
 25.3980 +
 25.3981 +                    state._fsp--;
 25.3982 +
 25.3983 +
 25.3984 +                    }
 25.3985 +                    break;
 25.3986 +                case 3 :
 25.3987 +                    dbg.enterAlt(3);
 25.3988 +
 25.3989 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:227:6: rewrite_tree_block
 25.3990 +                    {
 25.3991 +                    dbg.location(227,6);
 25.3992 +                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_element1133);
 25.3993 +                    rewrite_tree_block();
 25.3994 +
 25.3995 +                    state._fsp--;
 25.3996 +
 25.3997 +
 25.3998 +                    }
 25.3999 +                    break;
 25.4000 +                case 4 :
 25.4001 +                    dbg.enterAlt(4);
 25.4002 +
 25.4003 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:228:6: rewrite_tree_ebnf
 25.4004 +                    {
 25.4005 +                    dbg.location(228,6);
 25.4006 +                    pushFollow(FOLLOW_rewrite_tree_ebnf_in_rewrite_tree_element1140);
 25.4007 +                    rewrite_tree_ebnf();
 25.4008 +
 25.4009 +                    state._fsp--;
 25.4010 +
 25.4011 +
 25.4012 +                    }
 25.4013 +                    break;
 25.4014 +
 25.4015 +            }
 25.4016 +        }
 25.4017 +        catch (RecognitionException re) {
 25.4018 +            reportError(re);
 25.4019 +            recover(input,re);
 25.4020 +        }
 25.4021 +        finally {
 25.4022 +        }
 25.4023 +        dbg.location(229, 2);
 25.4024 +
 25.4025 +        }
 25.4026 +        finally {
 25.4027 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_element");
 25.4028 +            decRuleLevel();
 25.4029 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4030 +        }
 25.4031 +
 25.4032 +        return ;
 25.4033 +    }
 25.4034 +    // $ANTLR end "rewrite_tree_element"
 25.4035 +
 25.4036 +
 25.4037 +    // $ANTLR start "rewrite_tree_atom"
 25.4038 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:231:1: rewrite_tree_atom : ( CHAR_LITERAL | TOKEN_REF | ^( TOKEN_REF ARG_ACTION ) | RULE_REF | STRING_LITERAL | LABEL | ACTION );
 25.4039 +    public final void rewrite_tree_atom() throws RecognitionException {
 25.4040 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_atom");
 25.4041 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4042 +        incRuleLevel();
 25.4043 +        dbg.location(231, 1);
 25.4044 +
 25.4045 +        try {
 25.4046 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:232:5: ( CHAR_LITERAL | TOKEN_REF | ^( TOKEN_REF ARG_ACTION ) | RULE_REF | STRING_LITERAL | LABEL | ACTION )
 25.4047 +            int alt41=7;
 25.4048 +            try { dbg.enterDecision(41, decisionCanBacktrack[41]);
 25.4049 +
 25.4050 +            switch ( input.LA(1) ) {
 25.4051 +            case CHAR_LITERAL:
 25.4052 +                {
 25.4053 +                alt41=1;
 25.4054 +                }
 25.4055 +                break;
 25.4056 +            case TOKEN_REF:
 25.4057 +                {
 25.4058 +                int LA41_2 = input.LA(2);
 25.4059 +
 25.4060 +                if ( (LA41_2==DOWN) ) {
 25.4061 +                    alt41=3;
 25.4062 +                }
 25.4063 +                else if ( (LA41_2==UP||(LA41_2>=BLOCK && LA41_2<=POSITIVE_CLOSURE)||LA41_2==EOA||LA41_2==LABEL||LA41_2==TREE_BEGIN||(LA41_2>=TOKEN_REF && LA41_2<=ACTION)||LA41_2==RULE_REF) ) {
 25.4064 +                    alt41=2;
 25.4065 +                }
 25.4066 +                else {
 25.4067 +                    NoViableAltException nvae =
 25.4068 +                        new NoViableAltException("", 41, 2, input);
 25.4069 +
 25.4070 +                    dbg.recognitionException(nvae);
 25.4071 +                    throw nvae;
 25.4072 +                }
 25.4073 +                }
 25.4074 +                break;
 25.4075 +            case RULE_REF:
 25.4076 +                {
 25.4077 +                alt41=4;
 25.4078 +                }
 25.4079 +                break;
 25.4080 +            case STRING_LITERAL:
 25.4081 +                {
 25.4082 +                alt41=5;
 25.4083 +                }
 25.4084 +                break;
 25.4085 +            case LABEL:
 25.4086 +                {
 25.4087 +                alt41=6;
 25.4088 +                }
 25.4089 +                break;
 25.4090 +            case ACTION:
 25.4091 +                {
 25.4092 +                alt41=7;
 25.4093 +                }
 25.4094 +                break;
 25.4095 +            default:
 25.4096 +                NoViableAltException nvae =
 25.4097 +                    new NoViableAltException("", 41, 0, input);
 25.4098 +
 25.4099 +                dbg.recognitionException(nvae);
 25.4100 +                throw nvae;
 25.4101 +            }
 25.4102 +
 25.4103 +            } finally {dbg.exitDecision(41);}
 25.4104 +
 25.4105 +            switch (alt41) {
 25.4106 +                case 1 :
 25.4107 +                    dbg.enterAlt(1);
 25.4108 +
 25.4109 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:232:9: CHAR_LITERAL
 25.4110 +                    {
 25.4111 +                    dbg.location(232,9);
 25.4112 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_rewrite_tree_atom1156); 
 25.4113 +
 25.4114 +                    }
 25.4115 +                    break;
 25.4116 +                case 2 :
 25.4117 +                    dbg.enterAlt(2);
 25.4118 +
 25.4119 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:233:6: TOKEN_REF
 25.4120 +                    {
 25.4121 +                    dbg.location(233,6);
 25.4122 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1163); 
 25.4123 +
 25.4124 +                    }
 25.4125 +                    break;
 25.4126 +                case 3 :
 25.4127 +                    dbg.enterAlt(3);
 25.4128 +
 25.4129 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:234:6: ^( TOKEN_REF ARG_ACTION )
 25.4130 +                    {
 25.4131 +                    dbg.location(234,6);
 25.4132 +                    dbg.location(234,8);
 25.4133 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1171); 
 25.4134 +
 25.4135 +                    match(input, Token.DOWN, null); 
 25.4136 +                    dbg.location(234,18);
 25.4137 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewrite_tree_atom1173); 
 25.4138 +
 25.4139 +                    match(input, Token.UP, null); 
 25.4140 +
 25.4141 +                    }
 25.4142 +                    break;
 25.4143 +                case 4 :
 25.4144 +                    dbg.enterAlt(4);
 25.4145 +
 25.4146 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:235:9: RULE_REF
 25.4147 +                    {
 25.4148 +                    dbg.location(235,9);
 25.4149 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_rewrite_tree_atom1185); 
 25.4150 +
 25.4151 +                    }
 25.4152 +                    break;
 25.4153 +                case 5 :
 25.4154 +                    dbg.enterAlt(5);
 25.4155 +
 25.4156 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:236:6: STRING_LITERAL
 25.4157 +                    {
 25.4158 +                    dbg.location(236,6);
 25.4159 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewrite_tree_atom1192); 
 25.4160 +
 25.4161 +                    }
 25.4162 +                    break;
 25.4163 +                case 6 :
 25.4164 +                    dbg.enterAlt(6);
 25.4165 +
 25.4166 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:237:6: LABEL
 25.4167 +                    {
 25.4168 +                    dbg.location(237,6);
 25.4169 +                    match(input,LABEL,FOLLOW_LABEL_in_rewrite_tree_atom1199); 
 25.4170 +
 25.4171 +                    }
 25.4172 +                    break;
 25.4173 +                case 7 :
 25.4174 +                    dbg.enterAlt(7);
 25.4175 +
 25.4176 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:238:4: ACTION
 25.4177 +                    {
 25.4178 +                    dbg.location(238,4);
 25.4179 +                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_tree_atom1204); 
 25.4180 +
 25.4181 +                    }
 25.4182 +                    break;
 25.4183 +
 25.4184 +            }
 25.4185 +        }
 25.4186 +        catch (RecognitionException re) {
 25.4187 +            reportError(re);
 25.4188 +            recover(input,re);
 25.4189 +        }
 25.4190 +        finally {
 25.4191 +        }
 25.4192 +        dbg.location(239, 2);
 25.4193 +
 25.4194 +        }
 25.4195 +        finally {
 25.4196 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_atom");
 25.4197 +            decRuleLevel();
 25.4198 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4199 +        }
 25.4200 +
 25.4201 +        return ;
 25.4202 +    }
 25.4203 +    // $ANTLR end "rewrite_tree_atom"
 25.4204 +
 25.4205 +
 25.4206 +    // $ANTLR start "rewrite_tree_ebnf"
 25.4207 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:241:1: rewrite_tree_ebnf : ^( ebnfSuffix rewrite_tree_block ) ;
 25.4208 +    public final void rewrite_tree_ebnf() throws RecognitionException {
 25.4209 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_ebnf");
 25.4210 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4211 +        incRuleLevel();
 25.4212 +        dbg.location(241, 1);
 25.4213 +
 25.4214 +        try {
 25.4215 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:242:2: ( ^( ebnfSuffix rewrite_tree_block ) )
 25.4216 +            dbg.enterAlt(1);
 25.4217 +
 25.4218 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:242:4: ^( ebnfSuffix rewrite_tree_block )
 25.4219 +            {
 25.4220 +            dbg.location(242,4);
 25.4221 +            dbg.location(242,6);
 25.4222 +            pushFollow(FOLLOW_ebnfSuffix_in_rewrite_tree_ebnf1216);
 25.4223 +            ebnfSuffix();
 25.4224 +
 25.4225 +            state._fsp--;
 25.4226 +
 25.4227 +
 25.4228 +            match(input, Token.DOWN, null); 
 25.4229 +            dbg.location(242,17);
 25.4230 +            pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1218);
 25.4231 +            rewrite_tree_block();
 25.4232 +
 25.4233 +            state._fsp--;
 25.4234 +
 25.4235 +
 25.4236 +            match(input, Token.UP, null); 
 25.4237 +
 25.4238 +            }
 25.4239 +
 25.4240 +        }
 25.4241 +        catch (RecognitionException re) {
 25.4242 +            reportError(re);
 25.4243 +            recover(input,re);
 25.4244 +        }
 25.4245 +        finally {
 25.4246 +        }
 25.4247 +        dbg.location(243, 2);
 25.4248 +
 25.4249 +        }
 25.4250 +        finally {
 25.4251 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_ebnf");
 25.4252 +            decRuleLevel();
 25.4253 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4254 +        }
 25.4255 +
 25.4256 +        return ;
 25.4257 +    }
 25.4258 +    // $ANTLR end "rewrite_tree_ebnf"
 25.4259 +
 25.4260 +
 25.4261 +    // $ANTLR start "rewrite_tree"
 25.4262 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:245:1: rewrite_tree : ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* ) ;
 25.4263 +    public final void rewrite_tree() throws RecognitionException {
 25.4264 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree");
 25.4265 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4266 +        incRuleLevel();
 25.4267 +        dbg.location(245, 1);
 25.4268 +
 25.4269 +        try {
 25.4270 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:2: ( ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* ) )
 25.4271 +            dbg.enterAlt(1);
 25.4272 +
 25.4273 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:4: ^( TREE_BEGIN rewrite_tree_atom ( rewrite_tree_element )* )
 25.4274 +            {
 25.4275 +            dbg.location(246,4);
 25.4276 +            dbg.location(246,6);
 25.4277 +            match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewrite_tree1232); 
 25.4278 +
 25.4279 +            match(input, Token.DOWN, null); 
 25.4280 +            dbg.location(246,17);
 25.4281 +            pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree1234);
 25.4282 +            rewrite_tree_atom();
 25.4283 +
 25.4284 +            state._fsp--;
 25.4285 +
 25.4286 +            dbg.location(246,35);
 25.4287 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:35: ( rewrite_tree_element )*
 25.4288 +            try { dbg.enterSubRule(42);
 25.4289 +
 25.4290 +            loop42:
 25.4291 +            do {
 25.4292 +                int alt42=2;
 25.4293 +                try { dbg.enterDecision(42, decisionCanBacktrack[42]);
 25.4294 +
 25.4295 +                int LA42_0 = input.LA(1);
 25.4296 +
 25.4297 +                if ( ((LA42_0>=BLOCK && LA42_0<=POSITIVE_CLOSURE)||LA42_0==LABEL||LA42_0==TREE_BEGIN||(LA42_0>=TOKEN_REF && LA42_0<=ACTION)||LA42_0==RULE_REF) ) {
 25.4298 +                    alt42=1;
 25.4299 +                }
 25.4300 +
 25.4301 +
 25.4302 +                } finally {dbg.exitDecision(42);}
 25.4303 +
 25.4304 +                switch (alt42) {
 25.4305 +            	case 1 :
 25.4306 +            	    dbg.enterAlt(1);
 25.4307 +
 25.4308 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:35: rewrite_tree_element
 25.4309 +            	    {
 25.4310 +            	    dbg.location(246,35);
 25.4311 +            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree1236);
 25.4312 +            	    rewrite_tree_element();
 25.4313 +
 25.4314 +            	    state._fsp--;
 25.4315 +
 25.4316 +
 25.4317 +            	    }
 25.4318 +            	    break;
 25.4319 +
 25.4320 +            	default :
 25.4321 +            	    break loop42;
 25.4322 +                }
 25.4323 +            } while (true);
 25.4324 +            } finally {dbg.exitSubRule(42);}
 25.4325 +
 25.4326 +
 25.4327 +            match(input, Token.UP, null); 
 25.4328 +
 25.4329 +            }
 25.4330 +
 25.4331 +        }
 25.4332 +        catch (RecognitionException re) {
 25.4333 +            reportError(re);
 25.4334 +            recover(input,re);
 25.4335 +        }
 25.4336 +        finally {
 25.4337 +        }
 25.4338 +        dbg.location(247, 2);
 25.4339 +
 25.4340 +        }
 25.4341 +        finally {
 25.4342 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree");
 25.4343 +            decRuleLevel();
 25.4344 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4345 +        }
 25.4346 +
 25.4347 +        return ;
 25.4348 +    }
 25.4349 +    // $ANTLR end "rewrite_tree"
 25.4350 +
 25.4351 +
 25.4352 +    // $ANTLR start "rewrite_template"
 25.4353 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:249:1: rewrite_template : ( ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) ) | rewrite_template_ref | rewrite_indirect_template_head | ACTION );
 25.4354 +    public final void rewrite_template() throws RecognitionException {
 25.4355 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template");
 25.4356 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4357 +        incRuleLevel();
 25.4358 +        dbg.location(249, 1);
 25.4359 +
 25.4360 +        try {
 25.4361 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:250:2: ( ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) ) | rewrite_template_ref | rewrite_indirect_template_head | ACTION )
 25.4362 +            int alt43=4;
 25.4363 +            try { dbg.enterDecision(43, decisionCanBacktrack[43]);
 25.4364 +
 25.4365 +            try {
 25.4366 +                isCyclicDecision = true;
 25.4367 +                alt43 = dfa43.predict(input);
 25.4368 +            }
 25.4369 +            catch (NoViableAltException nvae) {
 25.4370 +                dbg.recognitionException(nvae);
 25.4371 +                throw nvae;
 25.4372 +            }
 25.4373 +            } finally {dbg.exitDecision(43);}
 25.4374 +
 25.4375 +            switch (alt43) {
 25.4376 +                case 1 :
 25.4377 +                    dbg.enterAlt(1);
 25.4378 +
 25.4379 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:250:6: ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) )
 25.4380 +                    {
 25.4381 +                    dbg.location(250,6);
 25.4382 +                    dbg.location(250,9);
 25.4383 +                    match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template1254); 
 25.4384 +
 25.4385 +                    match(input, Token.DOWN, null); 
 25.4386 +                    dbg.location(250,18);
 25.4387 +                    match(input,ID,FOLLOW_ID_in_rewrite_template1256); 
 25.4388 +                    dbg.location(250,21);
 25.4389 +                    pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template1258);
 25.4390 +                    rewrite_template_args();
 25.4391 +
 25.4392 +                    state._fsp--;
 25.4393 +
 25.4394 +                    dbg.location(251,6);
 25.4395 +                    if ( (input.LA(1)>=DOUBLE_QUOTE_STRING_LITERAL && input.LA(1)<=DOUBLE_ANGLE_STRING_LITERAL) ) {
 25.4396 +                        input.consume();
 25.4397 +                        state.errorRecovery=false;
 25.4398 +                    }
 25.4399 +                    else {
 25.4400 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 25.4401 +                        dbg.recognitionException(mse);
 25.4402 +                        throw mse;
 25.4403 +                    }
 25.4404 +
 25.4405 +
 25.4406 +                    match(input, Token.UP, null); 
 25.4407 +
 25.4408 +                    }
 25.4409 +                    break;
 25.4410 +                case 2 :
 25.4411 +                    dbg.enterAlt(2);
 25.4412 +
 25.4413 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:253:4: rewrite_template_ref
 25.4414 +                    {
 25.4415 +                    dbg.location(253,4);
 25.4416 +                    pushFollow(FOLLOW_rewrite_template_ref_in_rewrite_template1281);
 25.4417 +                    rewrite_template_ref();
 25.4418 +
 25.4419 +                    state._fsp--;
 25.4420 +
 25.4421 +
 25.4422 +                    }
 25.4423 +                    break;
 25.4424 +                case 3 :
 25.4425 +                    dbg.enterAlt(3);
 25.4426 +
 25.4427 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:254:4: rewrite_indirect_template_head
 25.4428 +                    {
 25.4429 +                    dbg.location(254,4);
 25.4430 +                    pushFollow(FOLLOW_rewrite_indirect_template_head_in_rewrite_template1286);
 25.4431 +                    rewrite_indirect_template_head();
 25.4432 +
 25.4433 +                    state._fsp--;
 25.4434 +
 25.4435 +
 25.4436 +                    }
 25.4437 +                    break;
 25.4438 +                case 4 :
 25.4439 +                    dbg.enterAlt(4);
 25.4440 +
 25.4441 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:255:4: ACTION
 25.4442 +                    {
 25.4443 +                    dbg.location(255,4);
 25.4444 +                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_template1291); 
 25.4445 +
 25.4446 +                    }
 25.4447 +                    break;
 25.4448 +
 25.4449 +            }
 25.4450 +        }
 25.4451 +        catch (RecognitionException re) {
 25.4452 +            reportError(re);
 25.4453 +            recover(input,re);
 25.4454 +        }
 25.4455 +        finally {
 25.4456 +        }
 25.4457 +        dbg.location(256, 2);
 25.4458 +
 25.4459 +        }
 25.4460 +        finally {
 25.4461 +            dbg.exitRule(getGrammarFileName(), "rewrite_template");
 25.4462 +            decRuleLevel();
 25.4463 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4464 +        }
 25.4465 +
 25.4466 +        return ;
 25.4467 +    }
 25.4468 +    // $ANTLR end "rewrite_template"
 25.4469 +
 25.4470 +
 25.4471 +    // $ANTLR start "rewrite_template_ref"
 25.4472 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:258:1: rewrite_template_ref : ^( TEMPLATE ID rewrite_template_args ) ;
 25.4473 +    public final void rewrite_template_ref() throws RecognitionException {
 25.4474 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_ref");
 25.4475 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4476 +        incRuleLevel();
 25.4477 +        dbg.location(258, 1);
 25.4478 +
 25.4479 +        try {
 25.4480 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:260:2: ( ^( TEMPLATE ID rewrite_template_args ) )
 25.4481 +            dbg.enterAlt(1);
 25.4482 +
 25.4483 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:260:4: ^( TEMPLATE ID rewrite_template_args )
 25.4484 +            {
 25.4485 +            dbg.location(260,4);
 25.4486 +            dbg.location(260,6);
 25.4487 +            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template_ref1305); 
 25.4488 +
 25.4489 +            match(input, Token.DOWN, null); 
 25.4490 +            dbg.location(260,15);
 25.4491 +            match(input,ID,FOLLOW_ID_in_rewrite_template_ref1307); 
 25.4492 +            dbg.location(260,18);
 25.4493 +            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template_ref1309);
 25.4494 +            rewrite_template_args();
 25.4495 +
 25.4496 +            state._fsp--;
 25.4497 +
 25.4498 +
 25.4499 +            match(input, Token.UP, null); 
 25.4500 +
 25.4501 +            }
 25.4502 +
 25.4503 +        }
 25.4504 +        catch (RecognitionException re) {
 25.4505 +            reportError(re);
 25.4506 +            recover(input,re);
 25.4507 +        }
 25.4508 +        finally {
 25.4509 +        }
 25.4510 +        dbg.location(261, 2);
 25.4511 +
 25.4512 +        }
 25.4513 +        finally {
 25.4514 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_ref");
 25.4515 +            decRuleLevel();
 25.4516 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4517 +        }
 25.4518 +
 25.4519 +        return ;
 25.4520 +    }
 25.4521 +    // $ANTLR end "rewrite_template_ref"
 25.4522 +
 25.4523 +
 25.4524 +    // $ANTLR start "rewrite_indirect_template_head"
 25.4525 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:263:1: rewrite_indirect_template_head : ^( TEMPLATE ACTION rewrite_template_args ) ;
 25.4526 +    public final void rewrite_indirect_template_head() throws RecognitionException {
 25.4527 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_indirect_template_head");
 25.4528 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4529 +        incRuleLevel();
 25.4530 +        dbg.location(263, 1);
 25.4531 +
 25.4532 +        try {
 25.4533 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:265:2: ( ^( TEMPLATE ACTION rewrite_template_args ) )
 25.4534 +            dbg.enterAlt(1);
 25.4535 +
 25.4536 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:265:4: ^( TEMPLATE ACTION rewrite_template_args )
 25.4537 +            {
 25.4538 +            dbg.location(265,4);
 25.4539 +            dbg.location(265,6);
 25.4540 +            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_indirect_template_head1324); 
 25.4541 +
 25.4542 +            match(input, Token.DOWN, null); 
 25.4543 +            dbg.location(265,15);
 25.4544 +            match(input,ACTION,FOLLOW_ACTION_in_rewrite_indirect_template_head1326); 
 25.4545 +            dbg.location(265,22);
 25.4546 +            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_indirect_template_head1328);
 25.4547 +            rewrite_template_args();
 25.4548 +
 25.4549 +            state._fsp--;
 25.4550 +
 25.4551 +
 25.4552 +            match(input, Token.UP, null); 
 25.4553 +
 25.4554 +            }
 25.4555 +
 25.4556 +        }
 25.4557 +        catch (RecognitionException re) {
 25.4558 +            reportError(re);
 25.4559 +            recover(input,re);
 25.4560 +        }
 25.4561 +        finally {
 25.4562 +        }
 25.4563 +        dbg.location(266, 2);
 25.4564 +
 25.4565 +        }
 25.4566 +        finally {
 25.4567 +            dbg.exitRule(getGrammarFileName(), "rewrite_indirect_template_head");
 25.4568 +            decRuleLevel();
 25.4569 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4570 +        }
 25.4571 +
 25.4572 +        return ;
 25.4573 +    }
 25.4574 +    // $ANTLR end "rewrite_indirect_template_head"
 25.4575 +
 25.4576 +
 25.4577 +    // $ANTLR start "rewrite_template_args"
 25.4578 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:268:1: rewrite_template_args : ( ^( ARGLIST ( rewrite_template_arg )+ ) | ARGLIST );
 25.4579 +    public final void rewrite_template_args() throws RecognitionException {
 25.4580 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_args");
 25.4581 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4582 +        incRuleLevel();
 25.4583 +        dbg.location(268, 1);
 25.4584 +
 25.4585 +        try {
 25.4586 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:2: ( ^( ARGLIST ( rewrite_template_arg )+ ) | ARGLIST )
 25.4587 +            int alt45=2;
 25.4588 +            try { dbg.enterDecision(45, decisionCanBacktrack[45]);
 25.4589 +
 25.4590 +            int LA45_0 = input.LA(1);
 25.4591 +
 25.4592 +            if ( (LA45_0==ARGLIST) ) {
 25.4593 +                int LA45_1 = input.LA(2);
 25.4594 +
 25.4595 +                if ( (LA45_1==DOWN) ) {
 25.4596 +                    alt45=1;
 25.4597 +                }
 25.4598 +                else if ( (LA45_1==UP||(LA45_1>=DOUBLE_QUOTE_STRING_LITERAL && LA45_1<=DOUBLE_ANGLE_STRING_LITERAL)) ) {
 25.4599 +                    alt45=2;
 25.4600 +                }
 25.4601 +                else {
 25.4602 +                    NoViableAltException nvae =
 25.4603 +                        new NoViableAltException("", 45, 1, input);
 25.4604 +
 25.4605 +                    dbg.recognitionException(nvae);
 25.4606 +                    throw nvae;
 25.4607 +                }
 25.4608 +            }
 25.4609 +            else {
 25.4610 +                NoViableAltException nvae =
 25.4611 +                    new NoViableAltException("", 45, 0, input);
 25.4612 +
 25.4613 +                dbg.recognitionException(nvae);
 25.4614 +                throw nvae;
 25.4615 +            }
 25.4616 +            } finally {dbg.exitDecision(45);}
 25.4617 +
 25.4618 +            switch (alt45) {
 25.4619 +                case 1 :
 25.4620 +                    dbg.enterAlt(1);
 25.4621 +
 25.4622 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:4: ^( ARGLIST ( rewrite_template_arg )+ )
 25.4623 +                    {
 25.4624 +                    dbg.location(269,4);
 25.4625 +                    dbg.location(269,6);
 25.4626 +                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1341); 
 25.4627 +
 25.4628 +                    match(input, Token.DOWN, null); 
 25.4629 +                    dbg.location(269,14);
 25.4630 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:14: ( rewrite_template_arg )+
 25.4631 +                    int cnt44=0;
 25.4632 +                    try { dbg.enterSubRule(44);
 25.4633 +
 25.4634 +                    loop44:
 25.4635 +                    do {
 25.4636 +                        int alt44=2;
 25.4637 +                        try { dbg.enterDecision(44, decisionCanBacktrack[44]);
 25.4638 +
 25.4639 +                        int LA44_0 = input.LA(1);
 25.4640 +
 25.4641 +                        if ( (LA44_0==ARG) ) {
 25.4642 +                            alt44=1;
 25.4643 +                        }
 25.4644 +
 25.4645 +
 25.4646 +                        } finally {dbg.exitDecision(44);}
 25.4647 +
 25.4648 +                        switch (alt44) {
 25.4649 +                    	case 1 :
 25.4650 +                    	    dbg.enterAlt(1);
 25.4651 +
 25.4652 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:14: rewrite_template_arg
 25.4653 +                    	    {
 25.4654 +                    	    dbg.location(269,14);
 25.4655 +                    	    pushFollow(FOLLOW_rewrite_template_arg_in_rewrite_template_args1343);
 25.4656 +                    	    rewrite_template_arg();
 25.4657 +
 25.4658 +                    	    state._fsp--;
 25.4659 +
 25.4660 +
 25.4661 +                    	    }
 25.4662 +                    	    break;
 25.4663 +
 25.4664 +                    	default :
 25.4665 +                    	    if ( cnt44 >= 1 ) break loop44;
 25.4666 +                                EarlyExitException eee =
 25.4667 +                                    new EarlyExitException(44, input);
 25.4668 +                                dbg.recognitionException(eee);
 25.4669 +
 25.4670 +                                throw eee;
 25.4671 +                        }
 25.4672 +                        cnt44++;
 25.4673 +                    } while (true);
 25.4674 +                    } finally {dbg.exitSubRule(44);}
 25.4675 +
 25.4676 +
 25.4677 +                    match(input, Token.UP, null); 
 25.4678 +
 25.4679 +                    }
 25.4680 +                    break;
 25.4681 +                case 2 :
 25.4682 +                    dbg.enterAlt(2);
 25.4683 +
 25.4684 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:270:4: ARGLIST
 25.4685 +                    {
 25.4686 +                    dbg.location(270,4);
 25.4687 +                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1350); 
 25.4688 +
 25.4689 +                    }
 25.4690 +                    break;
 25.4691 +
 25.4692 +            }
 25.4693 +        }
 25.4694 +        catch (RecognitionException re) {
 25.4695 +            reportError(re);
 25.4696 +            recover(input,re);
 25.4697 +        }
 25.4698 +        finally {
 25.4699 +        }
 25.4700 +        dbg.location(271, 2);
 25.4701 +
 25.4702 +        }
 25.4703 +        finally {
 25.4704 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_args");
 25.4705 +            decRuleLevel();
 25.4706 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4707 +        }
 25.4708 +
 25.4709 +        return ;
 25.4710 +    }
 25.4711 +    // $ANTLR end "rewrite_template_args"
 25.4712 +
 25.4713 +
 25.4714 +    // $ANTLR start "rewrite_template_arg"
 25.4715 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:273:1: rewrite_template_arg : ^( ARG ID ACTION ) ;
 25.4716 +    public final void rewrite_template_arg() throws RecognitionException {
 25.4717 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_arg");
 25.4718 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 25.4719 +        incRuleLevel();
 25.4720 +        dbg.location(273, 1);
 25.4721 +
 25.4722 +        try {
 25.4723 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:274:2: ( ^( ARG ID ACTION ) )
 25.4724 +            dbg.enterAlt(1);
 25.4725 +
 25.4726 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:274:6: ^( ARG ID ACTION )
 25.4727 +            {
 25.4728 +            dbg.location(274,6);
 25.4729 +            dbg.location(274,8);
 25.4730 +            match(input,ARG,FOLLOW_ARG_in_rewrite_template_arg1364); 
 25.4731 +
 25.4732 +            match(input, Token.DOWN, null); 
 25.4733 +            dbg.location(274,12);
 25.4734 +            match(input,ID,FOLLOW_ID_in_rewrite_template_arg1366); 
 25.4735 +            dbg.location(274,15);
 25.4736 +            match(input,ACTION,FOLLOW_ACTION_in_rewrite_template_arg1368); 
 25.4737 +
 25.4738 +            match(input, Token.UP, null); 
 25.4739 +
 25.4740 +            }
 25.4741 +
 25.4742 +        }
 25.4743 +        catch (RecognitionException re) {
 25.4744 +            reportError(re);
 25.4745 +            recover(input,re);
 25.4746 +        }
 25.4747 +        finally {
 25.4748 +        }
 25.4749 +        dbg.location(275, 2);
 25.4750 +
 25.4751 +        }
 25.4752 +        finally {
 25.4753 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_arg");
 25.4754 +            decRuleLevel();
 25.4755 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 25.4756 +        }
 25.4757 +
 25.4758 +        return ;
 25.4759 +    }
 25.4760 +    // $ANTLR end "rewrite_template_arg"
 25.4761 +
 25.4762 +    // Delegated rules
 25.4763 +
 25.4764 +
 25.4765 +    protected DFA30 dfa30 = new DFA30(this);
 25.4766 +    protected DFA43 dfa43 = new DFA43(this);
 25.4767 +    static final String DFA30_eotS =
 25.4768 +        "\14\uffff";
 25.4769 +    static final String DFA30_eofS =
 25.4770 +        "\14\uffff";
 25.4771 +    static final String DFA30_minS =
 25.4772 +        "\1\10\1\2\6\uffff\1\24\1\10\2\uffff";
 25.4773 +    static final String DFA30_maxS =
 25.4774 +        "\1\134\1\2\6\uffff\1\24\1\134\2\uffff";
 25.4775 +    static final String DFA30_acceptS =
 25.4776 +        "\2\uffff\1\3\1\4\1\5\1\6\1\7\1\10\2\uffff\1\1\1\2";
 25.4777 +    static final String DFA30_specialS =
 25.4778 +        "\14\uffff}>";
 25.4779 +    static final String[] DFA30_transitionS = {
 25.4780 +            "\5\3\1\uffff\1\2\21\uffff\1\5\1\6\1\3\2\uffff\1\7\2\2\2\uffff"+
 25.4781 +            "\3\2\1\4\3\uffff\1\2\25\uffff\1\1\17\uffff\1\1\1\uffff\1\2\2"+
 25.4782 +            "\uffff\1\2",
 25.4783 +            "\1\10",
 25.4784 +            "",
 25.4785 +            "",
 25.4786 +            "",
 25.4787 +            "",
 25.4788 +            "",
 25.4789 +            "",
 25.4790 +            "\1\11",
 25.4791 +            "\1\12\5\uffff\1\13\27\uffff\2\13\2\uffff\3\13\4\uffff\1\13"+
 25.4792 +            "\47\uffff\1\13\2\uffff\1\13",
 25.4793 +            "",
 25.4794 +            ""
 25.4795 +    };
 25.4796 +
 25.4797 +    static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
 25.4798 +    static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
 25.4799 +    static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
 25.4800 +    static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
 25.4801 +    static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
 25.4802 +    static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
 25.4803 +    static final short[][] DFA30_transition;
 25.4804 +
 25.4805 +    static {
 25.4806 +        int numStates = DFA30_transitionS.length;
 25.4807 +        DFA30_transition = new short[numStates][];
 25.4808 +        for (int i=0; i<numStates; i++) {
 25.4809 +            DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
 25.4810 +        }
 25.4811 +    }
 25.4812 +
 25.4813 +    class DFA30 extends DFA {
 25.4814 +
 25.4815 +        public DFA30(BaseRecognizer recognizer) {
 25.4816 +            this.recognizer = recognizer;
 25.4817 +            this.decisionNumber = 30;
 25.4818 +            this.eot = DFA30_eot;
 25.4819 +            this.eof = DFA30_eof;
 25.4820 +            this.min = DFA30_min;
 25.4821 +            this.max = DFA30_max;
 25.4822 +            this.accept = DFA30_accept;
 25.4823 +            this.special = DFA30_special;
 25.4824 +            this.transition = DFA30_transition;
 25.4825 +        }
 25.4826 +        public String getDescription() {
 25.4827 +            return "143:1: elementNoOptionSpec : ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | treeSpec );";
 25.4828 +        }
 25.4829 +        public void error(NoViableAltException nvae) {
 25.4830 +            dbg.recognitionException(nvae);
 25.4831 +        }
 25.4832 +    }
 25.4833 +    static final String DFA43_eotS =
 25.4834 +        "\20\uffff";
 25.4835 +    static final String DFA43_eofS =
 25.4836 +        "\20\uffff";
 25.4837 +    static final String DFA43_minS =
 25.4838 +        "\1\36\1\2\1\uffff\1\24\1\26\1\uffff\1\2\1\25\2\uffff\1\2\1\24\1"+
 25.4839 +        "\55\3\3";
 25.4840 +    static final String DFA43_maxS =
 25.4841 +        "\1\55\1\2\1\uffff\1\55\1\26\1\uffff\1\63\1\25\2\uffff\1\2\1\24\1"+
 25.4842 +        "\55\1\3\1\25\1\63";
 25.4843 +    static final String DFA43_acceptS =
 25.4844 +        "\2\uffff\1\4\2\uffff\1\3\2\uffff\1\1\1\2\6\uffff";
 25.4845 +    static final String DFA43_specialS =
 25.4846 +        "\20\uffff}>";
 25.4847 +    static final String[] DFA43_transitionS = {
 25.4848 +            "\1\1\16\uffff\1\2",
 25.4849 +            "\1\3",
 25.4850 +            "",
 25.4851 +            "\1\4\30\uffff\1\5",
 25.4852 +            "\1\6",
 25.4853 +            "",
 25.4854 +            "\1\7\1\11\56\uffff\2\10",
 25.4855 +            "\1\12",
 25.4856 +            "",
 25.4857 +            "",
 25.4858 +            "\1\13",
 25.4859 +            "\1\14",
 25.4860 +            "\1\15",
 25.4861 +            "\1\16",
 25.4862 +            "\1\17\21\uffff\1\12",
 25.4863 +            "\1\11\56\uffff\2\10"
 25.4864 +    };
 25.4865 +
 25.4866 +    static final short[] DFA43_eot = DFA.unpackEncodedString(DFA43_eotS);
 25.4867 +    static final short[] DFA43_eof = DFA.unpackEncodedString(DFA43_eofS);
 25.4868 +    static final char[] DFA43_min = DFA.unpackEncodedStringToUnsignedChars(DFA43_minS);
 25.4869 +    static final char[] DFA43_max = DFA.unpackEncodedStringToUnsignedChars(DFA43_maxS);
 25.4870 +    static final short[] DFA43_accept = DFA.unpackEncodedString(DFA43_acceptS);
 25.4871 +    static final short[] DFA43_special = DFA.unpackEncodedString(DFA43_specialS);
 25.4872 +    static final short[][] DFA43_transition;
 25.4873 +
 25.4874 +    static {
 25.4875 +        int numStates = DFA43_transitionS.length;
 25.4876 +        DFA43_transition = new short[numStates][];
 25.4877 +        for (int i=0; i<numStates; i++) {
 25.4878 +            DFA43_transition[i] = DFA.unpackEncodedString(DFA43_transitionS[i]);
 25.4879 +        }
 25.4880 +    }
 25.4881 +
 25.4882 +    class DFA43 extends DFA {
 25.4883 +
 25.4884 +        public DFA43(BaseRecognizer recognizer) {
 25.4885 +            this.recognizer = recognizer;
 25.4886 +            this.decisionNumber = 43;
 25.4887 +            this.eot = DFA43_eot;
 25.4888 +            this.eof = DFA43_eof;
 25.4889 +            this.min = DFA43_min;
 25.4890 +            this.max = DFA43_max;
 25.4891 +            this.accept = DFA43_accept;
 25.4892 +            this.special = DFA43_special;
 25.4893 +            this.transition = DFA43_transition;
 25.4894 +        }
 25.4895 +        public String getDescription() {
 25.4896 +            return "249:1: rewrite_template : ( ^( TEMPLATE ID rewrite_template_args ( DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL ) ) | rewrite_template_ref | rewrite_indirect_template_head | ACTION );";
 25.4897 +        }
 25.4898 +        public void error(NoViableAltException nvae) {
 25.4899 +            dbg.recognitionException(nvae);
 25.4900 +        }
 25.4901 +    }
 25.4902 + 
 25.4903 +
 25.4904 +    public static final BitSet FOLLOW_grammarType_in_grammarDef52 = new BitSet(new long[]{0x0000000000000004L});
 25.4905 +    public static final BitSet FOLLOW_ID_in_grammarDef54 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4906 +    public static final BitSet FOLLOW_DOC_COMMENT_in_grammarDef56 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4907 +    public static final BitSet FOLLOW_optionsSpec_in_grammarDef59 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4908 +    public static final BitSet FOLLOW_tokensSpec_in_grammarDef62 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4909 +    public static final BitSet FOLLOW_attrScope_in_grammarDef65 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4910 +    public static final BitSet FOLLOW_action_in_grammarDef68 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 25.4911 +    public static final BitSet FOLLOW_rule_in_grammarDef71 = new BitSet(new long[]{0x0000420080000098L,0x0000000000000100L});
 25.4912 +    public static final BitSet FOLLOW_set_in_grammarType0 = new BitSet(new long[]{0x0000000000000002L});
 25.4913 +    public static final BitSet FOLLOW_TOKENS_in_tokensSpec127 = new BitSet(new long[]{0x0000000000000004L});
 25.4914 +    public static final BitSet FOLLOW_tokenSpec_in_tokensSpec129 = new BitSet(new long[]{0x0000040000000008L,0x0000000000000080L});
 25.4915 +    public static final BitSet FOLLOW_71_in_tokenSpec143 = new BitSet(new long[]{0x0000000000000004L});
 25.4916 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec145 = new BitSet(new long[]{0x0000080000000000L});
 25.4917 +    public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec147 = new BitSet(new long[]{0x0000000000000008L});
 25.4918 +    public static final BitSet FOLLOW_71_in_tokenSpec154 = new BitSet(new long[]{0x0000000000000004L});
 25.4919 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec156 = new BitSet(new long[]{0x0000100000000000L});
 25.4920 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_tokenSpec158 = new BitSet(new long[]{0x0000000000000008L});
 25.4921 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec164 = new BitSet(new long[]{0x0000000000000002L});
 25.4922 +    public static final BitSet FOLLOW_SCOPE_in_attrScope176 = new BitSet(new long[]{0x0000000000000004L});
 25.4923 +    public static final BitSet FOLLOW_ID_in_attrScope178 = new BitSet(new long[]{0x0000200000000000L});
 25.4924 +    public static final BitSet FOLLOW_ACTION_in_attrScope180 = new BitSet(new long[]{0x0000000000000008L});
 25.4925 +    public static final BitSet FOLLOW_72_in_action193 = new BitSet(new long[]{0x0000000000000004L});
 25.4926 +    public static final BitSet FOLLOW_ID_in_action195 = new BitSet(new long[]{0x0000000000100000L});
 25.4927 +    public static final BitSet FOLLOW_ID_in_action197 = new BitSet(new long[]{0x0000200000000000L});
 25.4928 +    public static final BitSet FOLLOW_ACTION_in_action199 = new BitSet(new long[]{0x0000000000000008L});
 25.4929 +    public static final BitSet FOLLOW_72_in_action206 = new BitSet(new long[]{0x0000000000000004L});
 25.4930 +    public static final BitSet FOLLOW_ID_in_action208 = new BitSet(new long[]{0x0000200000000000L});
 25.4931 +    public static final BitSet FOLLOW_ACTION_in_action210 = new BitSet(new long[]{0x0000000000000008L});
 25.4932 +    public static final BitSet FOLLOW_OPTIONS_in_optionsSpec223 = new BitSet(new long[]{0x0000000000000004L});
 25.4933 +    public static final BitSet FOLLOW_option_in_optionsSpec225 = new BitSet(new long[]{0x0000000000000008L,0x0000000000000080L});
 25.4934 +    public static final BitSet FOLLOW_71_in_option244 = new BitSet(new long[]{0x0000000000000004L});
 25.4935 +    public static final BitSet FOLLOW_ID_in_option246 = new BitSet(new long[]{0x0000980000100000L});
 25.4936 +    public static final BitSet FOLLOW_optionValue_in_option248 = new BitSet(new long[]{0x0000000000000008L});
 25.4937 +    public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L});
 25.4938 +    public static final BitSet FOLLOW_RULE_in_rule314 = new BitSet(new long[]{0x0000000000000004L});
 25.4939 +    public static final BitSet FOLLOW_ID_in_rule316 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 25.4940 +    public static final BitSet FOLLOW_modifier_in_rule318 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 25.4941 +    public static final BitSet FOLLOW_ARG_in_rule323 = new BitSet(new long[]{0x0000000000000004L});
 25.4942 +    public static final BitSet FOLLOW_ARG_ACTION_in_rule325 = new BitSet(new long[]{0x0000000000000008L});
 25.4943 +    public static final BitSet FOLLOW_RET_in_rule332 = new BitSet(new long[]{0x0000000000000004L});
 25.4944 +    public static final BitSet FOLLOW_ARG_ACTION_in_rule334 = new BitSet(new long[]{0x0000000000000008L});
 25.4945 +    public static final BitSet FOLLOW_optionsSpec_in_rule347 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 25.4946 +    public static final BitSet FOLLOW_ruleScopeSpec_in_rule350 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 25.4947 +    public static final BitSet FOLLOW_ruleAction_in_rule353 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 25.4948 +    public static final BitSet FOLLOW_altList_in_rule364 = new BitSet(new long[]{0x0000000000020000L,0x0000000000600000L});
 25.4949 +    public static final BitSet FOLLOW_exceptionGroup_in_rule374 = new BitSet(new long[]{0x0000000000020000L});
 25.4950 +    public static final BitSet FOLLOW_EOR_in_rule377 = new BitSet(new long[]{0x0000000000000008L});
 25.4951 +    public static final BitSet FOLLOW_set_in_modifier0 = new BitSet(new long[]{0x0000000000000002L});
 25.4952 +    public static final BitSet FOLLOW_72_in_ruleAction416 = new BitSet(new long[]{0x0000000000000004L});
 25.4953 +    public static final BitSet FOLLOW_ID_in_ruleAction418 = new BitSet(new long[]{0x0000200000000000L});
 25.4954 +    public static final BitSet FOLLOW_ACTION_in_ruleAction420 = new BitSet(new long[]{0x0000000000000008L});
 25.4955 +    public static final BitSet FOLLOW_80_in_throwsSpec433 = new BitSet(new long[]{0x0000000000000004L});
 25.4956 +    public static final BitSet FOLLOW_ID_in_throwsSpec435 = new BitSet(new long[]{0x0000000000100008L});
 25.4957 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec449 = new BitSet(new long[]{0x0000000000000004L});
 25.4958 +    public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec451 = new BitSet(new long[]{0x0000000000000008L});
 25.4959 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec458 = new BitSet(new long[]{0x0000000000000004L});
 25.4960 +    public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec460 = new BitSet(new long[]{0x0000000000100000L});
 25.4961 +    public static final BitSet FOLLOW_ID_in_ruleScopeSpec462 = new BitSet(new long[]{0x0000000000100008L});
 25.4962 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec470 = new BitSet(new long[]{0x0000000000000004L});
 25.4963 +    public static final BitSet FOLLOW_ID_in_ruleScopeSpec472 = new BitSet(new long[]{0x0000000000100008L});
 25.4964 +    public static final BitSet FOLLOW_BLOCK_in_block492 = new BitSet(new long[]{0x0000000000000004L});
 25.4965 +    public static final BitSet FOLLOW_optionsSpec_in_block494 = new BitSet(new long[]{0x0000000000010000L});
 25.4966 +    public static final BitSet FOLLOW_alternative_in_block498 = new BitSet(new long[]{0x0000010000050000L});
 25.4967 +    public static final BitSet FOLLOW_rewrite_in_block500 = new BitSet(new long[]{0x0000000000050000L});
 25.4968 +    public static final BitSet FOLLOW_EOB_in_block504 = new BitSet(new long[]{0x0000000000000008L});
 25.4969 +    public static final BitSet FOLLOW_BLOCK_in_altList527 = new BitSet(new long[]{0x0000000000000004L});
 25.4970 +    public static final BitSet FOLLOW_alternative_in_altList530 = new BitSet(new long[]{0x0000010000050000L});
 25.4971 +    public static final BitSet FOLLOW_rewrite_in_altList532 = new BitSet(new long[]{0x0000000000050000L});
 25.4972 +    public static final BitSet FOLLOW_EOB_in_altList536 = new BitSet(new long[]{0x0000000000000008L});
 25.4973 +    public static final BitSet FOLLOW_ALT_in_alternative558 = new BitSet(new long[]{0x0000000000000004L});
 25.4974 +    public static final BitSet FOLLOW_element_in_alternative560 = new BitSet(new long[]{0x00023CE700085F00L,0x0000000012800080L});
 25.4975 +    public static final BitSet FOLLOW_EOA_in_alternative563 = new BitSet(new long[]{0x0000000000000008L});
 25.4976 +    public static final BitSet FOLLOW_ALT_in_alternative575 = new BitSet(new long[]{0x0000000000000004L});
 25.4977 +    public static final BitSet FOLLOW_EPSILON_in_alternative577 = new BitSet(new long[]{0x0000000000080000L});
 25.4978 +    public static final BitSet FOLLOW_EOA_in_alternative579 = new BitSet(new long[]{0x0000000000000008L});
 25.4979 +    public static final BitSet FOLLOW_exceptionHandler_in_exceptionGroup594 = new BitSet(new long[]{0x0000000000000002L,0x0000000000600000L});
 25.4980 +    public static final BitSet FOLLOW_finallyClause_in_exceptionGroup597 = new BitSet(new long[]{0x0000000000000002L});
 25.4981 +    public static final BitSet FOLLOW_finallyClause_in_exceptionGroup603 = new BitSet(new long[]{0x0000000000000002L});
 25.4982 +    public static final BitSet FOLLOW_85_in_exceptionHandler624 = new BitSet(new long[]{0x0000000000000004L});
 25.4983 +    public static final BitSet FOLLOW_ARG_ACTION_in_exceptionHandler626 = new BitSet(new long[]{0x0000200000000000L});
 25.4984 +    public static final BitSet FOLLOW_ACTION_in_exceptionHandler628 = new BitSet(new long[]{0x0000000000000008L});
 25.4985 +    public static final BitSet FOLLOW_86_in_finallyClause650 = new BitSet(new long[]{0x0000000000000004L});
 25.4986 +    public static final BitSet FOLLOW_ACTION_in_finallyClause652 = new BitSet(new long[]{0x0000000000000008L});
 25.4987 +    public static final BitSet FOLLOW_elementNoOptionSpec_in_element667 = new BitSet(new long[]{0x0000000000000002L});
 25.4988 +    public static final BitSet FOLLOW_set_in_elementNoOptionSpec679 = new BitSet(new long[]{0x0000000000000004L});
 25.4989 +    public static final BitSet FOLLOW_ID_in_elementNoOptionSpec685 = new BitSet(new long[]{0x0000000400001F00L});
 25.4990 +    public static final BitSet FOLLOW_block_in_elementNoOptionSpec687 = new BitSet(new long[]{0x0000000000000008L});
 25.4991 +    public static final BitSet FOLLOW_set_in_elementNoOptionSpec694 = new BitSet(new long[]{0x0000000000000004L});
 25.4992 +    public static final BitSet FOLLOW_ID_in_elementNoOptionSpec700 = new BitSet(new long[]{0x00021CC000004000L,0x0000000012000000L});
 25.4993 +    public static final BitSet FOLLOW_atom_in_elementNoOptionSpec702 = new BitSet(new long[]{0x0000000000000008L});
 25.4994 +    public static final BitSet FOLLOW_atom_in_elementNoOptionSpec708 = new BitSet(new long[]{0x0000000000000002L});
 25.4995 +    public static final BitSet FOLLOW_ebnf_in_elementNoOptionSpec713 = new BitSet(new long[]{0x0000000000000002L});
 25.4996 +    public static final BitSet FOLLOW_ACTION_in_elementNoOptionSpec720 = new BitSet(new long[]{0x0000000000000002L});
 25.4997 +    public static final BitSet FOLLOW_SEMPRED_in_elementNoOptionSpec727 = new BitSet(new long[]{0x0000000000000002L});
 25.4998 +    public static final BitSet FOLLOW_GATED_SEMPRED_in_elementNoOptionSpec732 = new BitSet(new long[]{0x0000000000000002L});
 25.4999 +    public static final BitSet FOLLOW_treeSpec_in_elementNoOptionSpec739 = new BitSet(new long[]{0x0000000000000002L});
 25.5000 +    public static final BitSet FOLLOW_set_in_atom751 = new BitSet(new long[]{0x0000000000000004L});
 25.5001 +    public static final BitSet FOLLOW_atom_in_atom757 = new BitSet(new long[]{0x0000000000000008L});
 25.5002 +    public static final BitSet FOLLOW_range_in_atom763 = new BitSet(new long[]{0x0000000000000002L});
 25.5003 +    public static final BitSet FOLLOW_notSet_in_atom768 = new BitSet(new long[]{0x0000000000000002L});
 25.5004 +    public static final BitSet FOLLOW_RULE_REF_in_atom777 = new BitSet(new long[]{0x0000000000000004L});
 25.5005 +    public static final BitSet FOLLOW_ARG_ACTION_in_atom779 = new BitSet(new long[]{0x0000000000000008L});
 25.5006 +    public static final BitSet FOLLOW_RULE_REF_in_atom788 = new BitSet(new long[]{0x0000000000000002L});
 25.5007 +    public static final BitSet FOLLOW_terminal_in_atom798 = new BitSet(new long[]{0x0000000000000002L});
 25.5008 +    public static final BitSet FOLLOW_89_in_notSet813 = new BitSet(new long[]{0x0000000000000004L});
 25.5009 +    public static final BitSet FOLLOW_notTerminal_in_notSet815 = new BitSet(new long[]{0x0000000000000008L});
 25.5010 +    public static final BitSet FOLLOW_89_in_notSet822 = new BitSet(new long[]{0x0000000000000004L});
 25.5011 +    public static final BitSet FOLLOW_block_in_notSet824 = new BitSet(new long[]{0x0000000000000008L});
 25.5012 +    public static final BitSet FOLLOW_TREE_BEGIN_in_treeSpec837 = new BitSet(new long[]{0x0000000000000004L});
 25.5013 +    public static final BitSet FOLLOW_element_in_treeSpec839 = new BitSet(new long[]{0x00023CE700085F08L,0x0000000012800080L});
 25.5014 +    public static final BitSet FOLLOW_SYNPRED_in_ebnf855 = new BitSet(new long[]{0x0000000000000004L});
 25.5015 +    public static final BitSet FOLLOW_block_in_ebnf857 = new BitSet(new long[]{0x0000000000000008L});
 25.5016 +    public static final BitSet FOLLOW_SYN_SEMPRED_in_ebnf863 = new BitSet(new long[]{0x0000000000000002L});
 25.5017 +    public static final BitSet FOLLOW_ebnfSuffix_in_ebnf869 = new BitSet(new long[]{0x0000000000000004L});
 25.5018 +    public static final BitSet FOLLOW_block_in_ebnf871 = new BitSet(new long[]{0x0000000000000008L});
 25.5019 +    public static final BitSet FOLLOW_block_in_ebnf877 = new BitSet(new long[]{0x0000000000000002L});
 25.5020 +    public static final BitSet FOLLOW_CHAR_RANGE_in_range889 = new BitSet(new long[]{0x0000000000000004L});
 25.5021 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_range891 = new BitSet(new long[]{0x0000100000000000L});
 25.5022 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_range893 = new BitSet(new long[]{0x0000000000000008L});
 25.5023 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_terminal910 = new BitSet(new long[]{0x0000000000000002L});
 25.5024 +    public static final BitSet FOLLOW_TOKEN_REF_in_terminal918 = new BitSet(new long[]{0x0000000000000002L});
 25.5025 +    public static final BitSet FOLLOW_STRING_LITERAL_in_terminal926 = new BitSet(new long[]{0x0000000000000002L});
 25.5026 +    public static final BitSet FOLLOW_TOKEN_REF_in_terminal935 = new BitSet(new long[]{0x0000000000000004L});
 25.5027 +    public static final BitSet FOLLOW_ARG_ACTION_in_terminal937 = new BitSet(new long[]{0x0000000000000008L});
 25.5028 +    public static final BitSet FOLLOW_92_in_terminal946 = new BitSet(new long[]{0x0000000000000002L});
 25.5029 +    public static final BitSet FOLLOW_set_in_notTerminal0 = new BitSet(new long[]{0x0000000000000002L});
 25.5030 +    public static final BitSet FOLLOW_set_in_ebnfSuffix0 = new BitSet(new long[]{0x0000000000000002L});
 25.5031 +    public static final BitSet FOLLOW_REWRITE_in_rewrite1012 = new BitSet(new long[]{0x0000000000000004L});
 25.5032 +    public static final BitSet FOLLOW_SEMPRED_in_rewrite1014 = new BitSet(new long[]{0x0000200040010000L});
 25.5033 +    public static final BitSet FOLLOW_rewrite_alternative_in_rewrite1016 = new BitSet(new long[]{0x0000000000000008L});
 25.5034 +    public static final BitSet FOLLOW_REWRITE_in_rewrite1022 = new BitSet(new long[]{0x0000000000000004L});
 25.5035 +    public static final BitSet FOLLOW_rewrite_alternative_in_rewrite1024 = new BitSet(new long[]{0x0000000000000008L});
 25.5036 +    public static final BitSet FOLLOW_rewrite_template_in_rewrite_alternative1039 = new BitSet(new long[]{0x0000000000000002L});
 25.5037 +    public static final BitSet FOLLOW_rewrite_tree_alternative_in_rewrite_alternative1044 = new BitSet(new long[]{0x0000000000000002L});
 25.5038 +    public static final BitSet FOLLOW_ALT_in_rewrite_alternative1055 = new BitSet(new long[]{0x0000000000000004L});
 25.5039 +    public static final BitSet FOLLOW_EPSILON_in_rewrite_alternative1057 = new BitSet(new long[]{0x0000000000080000L});
 25.5040 +    public static final BitSet FOLLOW_EOA_in_rewrite_alternative1059 = new BitSet(new long[]{0x0000000000000008L});
 25.5041 +    public static final BitSet FOLLOW_BLOCK_in_rewrite_tree_block1078 = new BitSet(new long[]{0x0000000000000004L});
 25.5042 +    public static final BitSet FOLLOW_rewrite_tree_alternative_in_rewrite_tree_block1080 = new BitSet(new long[]{0x0000000000040000L});
 25.5043 +    public static final BitSet FOLLOW_EOB_in_rewrite_tree_block1082 = new BitSet(new long[]{0x0000000000000008L});
 25.5044 +    public static final BitSet FOLLOW_ALT_in_rewrite_tree_alternative1101 = new BitSet(new long[]{0x0000000000000004L});
 25.5045 +    public static final BitSet FOLLOW_rewrite_tree_element_in_rewrite_tree_alternative1103 = new BitSet(new long[]{0x00023C2020080F00L});
 25.5046 +    public static final BitSet FOLLOW_EOA_in_rewrite_tree_alternative1106 = new BitSet(new long[]{0x0000000000000008L});
 25.5047 +    public static final BitSet FOLLOW_rewrite_tree_atom_in_rewrite_tree_element1121 = new BitSet(new long[]{0x0000000000000002L});
 25.5048 +    public static final BitSet FOLLOW_rewrite_tree_in_rewrite_tree_element1126 = new BitSet(new long[]{0x0000000000000002L});
 25.5049 +    public static final BitSet FOLLOW_rewrite_tree_block_in_rewrite_tree_element1133 = new BitSet(new long[]{0x0000000000000002L});
 25.5050 +    public static final BitSet FOLLOW_rewrite_tree_ebnf_in_rewrite_tree_element1140 = new BitSet(new long[]{0x0000000000000002L});
 25.5051 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_rewrite_tree_atom1156 = new BitSet(new long[]{0x0000000000000002L});
 25.5052 +    public static final BitSet FOLLOW_TOKEN_REF_in_rewrite_tree_atom1163 = new BitSet(new long[]{0x0000000000000002L});
 25.5053 +    public static final BitSet FOLLOW_TOKEN_REF_in_rewrite_tree_atom1171 = new BitSet(new long[]{0x0000000000000004L});
 25.5054 +    public static final BitSet FOLLOW_ARG_ACTION_in_rewrite_tree_atom1173 = new BitSet(new long[]{0x0000000000000008L});
 25.5055 +    public static final BitSet FOLLOW_RULE_REF_in_rewrite_tree_atom1185 = new BitSet(new long[]{0x0000000000000002L});
 25.5056 +    public static final BitSet FOLLOW_STRING_LITERAL_in_rewrite_tree_atom1192 = new BitSet(new long[]{0x0000000000000002L});
 25.5057 +    public static final BitSet FOLLOW_LABEL_in_rewrite_tree_atom1199 = new BitSet(new long[]{0x0000000000000002L});
 25.5058 +    public static final BitSet FOLLOW_ACTION_in_rewrite_tree_atom1204 = new BitSet(new long[]{0x0000000000000002L});
 25.5059 +    public static final BitSet FOLLOW_ebnfSuffix_in_rewrite_tree_ebnf1216 = new BitSet(new long[]{0x0000000000000004L});
 25.5060 +    public static final BitSet FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1218 = new BitSet(new long[]{0x0000000000000008L});
 25.5061 +    public static final BitSet FOLLOW_TREE_BEGIN_in_rewrite_tree1232 = new BitSet(new long[]{0x0000000000000004L});
 25.5062 +    public static final BitSet FOLLOW_rewrite_tree_atom_in_rewrite_tree1234 = new BitSet(new long[]{0x00023C2020080F08L});
 25.5063 +    public static final BitSet FOLLOW_rewrite_tree_element_in_rewrite_tree1236 = new BitSet(new long[]{0x00023C2020080F08L});
 25.5064 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_template1254 = new BitSet(new long[]{0x0000000000000004L});
 25.5065 +    public static final BitSet FOLLOW_ID_in_rewrite_template1256 = new BitSet(new long[]{0x0000000000400000L});
 25.5066 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_template1258 = new BitSet(new long[]{0x000C000000000000L});
 25.5067 +    public static final BitSet FOLLOW_set_in_rewrite_template1265 = new BitSet(new long[]{0x0000000000000008L});
 25.5068 +    public static final BitSet FOLLOW_rewrite_template_ref_in_rewrite_template1281 = new BitSet(new long[]{0x0000000000000002L});
 25.5069 +    public static final BitSet FOLLOW_rewrite_indirect_template_head_in_rewrite_template1286 = new BitSet(new long[]{0x0000000000000002L});
 25.5070 +    public static final BitSet FOLLOW_ACTION_in_rewrite_template1291 = new BitSet(new long[]{0x0000000000000002L});
 25.5071 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_template_ref1305 = new BitSet(new long[]{0x0000000000000004L});
 25.5072 +    public static final BitSet FOLLOW_ID_in_rewrite_template_ref1307 = new BitSet(new long[]{0x0000000000400000L});
 25.5073 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_template_ref1309 = new BitSet(new long[]{0x0000000000000008L});
 25.5074 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_indirect_template_head1324 = new BitSet(new long[]{0x0000000000000004L});
 25.5075 +    public static final BitSet FOLLOW_ACTION_in_rewrite_indirect_template_head1326 = new BitSet(new long[]{0x0000000000400000L});
 25.5076 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_indirect_template_head1328 = new BitSet(new long[]{0x0000000000000008L});
 25.5077 +    public static final BitSet FOLLOW_ARGLIST_in_rewrite_template_args1341 = new BitSet(new long[]{0x0000000000000004L});
 25.5078 +    public static final BitSet FOLLOW_rewrite_template_arg_in_rewrite_template_args1343 = new BitSet(new long[]{0x0000000000200008L});
 25.5079 +    public static final BitSet FOLLOW_ARGLIST_in_rewrite_template_args1350 = new BitSet(new long[]{0x0000000000000002L});
 25.5080 +    public static final BitSet FOLLOW_ARG_in_rewrite_template_arg1364 = new BitSet(new long[]{0x0000000000000004L});
 25.5081 +    public static final BitSet FOLLOW_ID_in_rewrite_template_arg1366 = new BitSet(new long[]{0x0000200000000000L});
 25.5082 +    public static final BitSet FOLLOW_ACTION_in_rewrite_template_arg1368 = new BitSet(new long[]{0x0000000000000008L});
 25.5083 +
 25.5084 +}
 25.5085 \ No newline at end of file
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.tokens	Mon Jan 14 15:49:16 2013 +0100
    26.3 @@ -0,0 +1,126 @@
    26.4 +T__65=65
    26.5 +T__66=66
    26.6 +T__67=67
    26.7 +T__68=68
    26.8 +T__69=69
    26.9 +T__70=70
   26.10 +T__71=71
   26.11 +T__72=72
   26.12 +T__73=73
   26.13 +T__74=74
   26.14 +T__75=75
   26.15 +T__76=76
   26.16 +T__77=77
   26.17 +T__78=78
   26.18 +T__79=79
   26.19 +T__80=80
   26.20 +T__81=81
   26.21 +T__82=82
   26.22 +T__83=83
   26.23 +T__84=84
   26.24 +T__85=85
   26.25 +T__86=86
   26.26 +T__87=87
   26.27 +T__88=88
   26.28 +T__89=89
   26.29 +T__90=90
   26.30 +T__91=91
   26.31 +T__92=92
   26.32 +T__93=93
   26.33 +DOC_COMMENT=4
   26.34 +PARSER=5
   26.35 +LEXER=6
   26.36 +RULE=7
   26.37 +BLOCK=8
   26.38 +OPTIONAL=9
   26.39 +CLOSURE=10
   26.40 +POSITIVE_CLOSURE=11
   26.41 +SYNPRED=12
   26.42 +RANGE=13
   26.43 +CHAR_RANGE=14
   26.44 +EPSILON=15
   26.45 +ALT=16
   26.46 +EOR=17
   26.47 +EOB=18
   26.48 +EOA=19
   26.49 +ID=20
   26.50 +ARG=21
   26.51 +ARGLIST=22
   26.52 +RET=23
   26.53 +LEXER_GRAMMAR=24
   26.54 +PARSER_GRAMMAR=25
   26.55 +TREE_GRAMMAR=26
   26.56 +COMBINED_GRAMMAR=27
   26.57 +INITACTION=28
   26.58 +LABEL=29
   26.59 +TEMPLATE=30
   26.60 +SCOPE=31
   26.61 +SEMPRED=32
   26.62 +GATED_SEMPRED=33
   26.63 +SYN_SEMPRED=34
   26.64 +BACKTRACK_SEMPRED=35
   26.65 +FRAGMENT=36
   26.66 +TREE_BEGIN=37
   26.67 +ROOT=38
   26.68 +BANG=39
   26.69 +REWRITE=40
   26.70 +TOKENS=41
   26.71 +TOKEN_REF=42
   26.72 +STRING_LITERAL=43
   26.73 +CHAR_LITERAL=44
   26.74 +ACTION=45
   26.75 +OPTIONS=46
   26.76 +INT=47
   26.77 +ARG_ACTION=48
   26.78 +RULE_REF=49
   26.79 +DOUBLE_QUOTE_STRING_LITERAL=50
   26.80 +DOUBLE_ANGLE_STRING_LITERAL=51
   26.81 +SRC=52
   26.82 +SL_COMMENT=53
   26.83 +ML_COMMENT=54
   26.84 +LITERAL_CHAR=55
   26.85 +ESC=56
   26.86 +XDIGIT=57
   26.87 +NESTED_ARG_ACTION=58
   26.88 +ACTION_STRING_LITERAL=59
   26.89 +ACTION_CHAR_LITERAL=60
   26.90 +NESTED_ACTION=61
   26.91 +ACTION_ESC=62
   26.92 +WS_LOOP=63
   26.93 +WS=64
   26.94 +'scope'=31
   26.95 +'fragment'=36
   26.96 +'^('=37
   26.97 +'^'=38
   26.98 +'!'=39
   26.99 +'..'=13
  26.100 +'->'=40
  26.101 +'lexer'=65
  26.102 +'parser'=66
  26.103 +'tree'=67
  26.104 +'grammar'=68
  26.105 +';'=69
  26.106 +'}'=70
  26.107 +'='=71
  26.108 +'@'=72
  26.109 +'::'=73
  26.110 +'*'=74
  26.111 +'protected'=75
  26.112 +'public'=76
  26.113 +'private'=77
  26.114 +'returns'=78
  26.115 +':'=79
  26.116 +'throws'=80
  26.117 +','=81
  26.118 +'('=82
  26.119 +'|'=83
  26.120 +')'=84
  26.121 +'catch'=85
  26.122 +'finally'=86
  26.123 +'+='=87
  26.124 +'=>'=88
  26.125 +'~'=89
  26.126 +'?'=90
  26.127 +'+'=91
  26.128 +'.'=92
  26.129 +'$'=93
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/o.n.antlr.editor/test/unit/src/org/netbeans/modules/antlr/editor/NbAntlrParserTest.java	Mon Jan 14 15:49:16 2013 +0100
    27.3 @@ -0,0 +1,77 @@
    27.4 +/*
    27.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    27.6 + *
    27.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    27.8 + *
    27.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   27.10 + * Other names may be trademarks of their respective owners.
   27.11 + *
   27.12 + * The contents of this file are subject to the terms of either the GNU
   27.13 + * General Public License Version 2 only ("GPL") or the Common
   27.14 + * Development and Distribution License("CDDL") (collectively, the
   27.15 + * "License"). You may not use this file except in compliance with the
   27.16 + * License. You can obtain a copy of the License at
   27.17 + * http://www.netbeans.org/cddl-gplv2.html
   27.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   27.19 + * specific language governing permissions and limitations under the
   27.20 + * License.  When distributing the software, include this License Header
   27.21 + * Notice in each file and include the License file at
   27.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   27.23 + * particular file as subject to the "Classpath" exception as provided
   27.24 + * by Oracle in the GPL Version 2 section of the License file that
   27.25 + * accompanied this code. If applicable, add the following below the
   27.26 + * License Header, with the fields enclosed by brackets [] replaced by
   27.27 + * your own identifying information:
   27.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   27.29 + *
   27.30 + * If you wish your version of this file to be governed by only the CDDL
   27.31 + * or only the GPL Version 2, indicate your decision by adding
   27.32 + * "[Contributor] elects to include this software in this distribution
   27.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   27.34 + * single choice of license, a recipient has the option to distribute
   27.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   27.36 + * to extend the choice of license to its licensees as provided above.
   27.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   27.38 + * Version 2 license, then the option applies only if the new code is
   27.39 + * made subject to such option by the copyright holder.
   27.40 + *
   27.41 + * Contributor(s):
   27.42 + *
   27.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
   27.44 + */
   27.45 +package org.netbeans.modules.antlr.editor;
   27.46 +
   27.47 +import org.netbeans.modules.parsing.api.Snapshot;
   27.48 +import org.netbeans.modules.parsing.api.Source;
   27.49 +import org.netbeans.modules.parsing.spi.ParseException;
   27.50 +import org.openide.filesystems.FileObject;
   27.51 +
   27.52 +/**
   27.53 + *
   27.54 + * @author marekfukala
   27.55 + */
   27.56 +public class NbAntlrParserTest extends AntlrTestBase {
   27.57 +
   27.58 +    public NbAntlrParserTest(String testName) {
   27.59 +        super(testName);
   27.60 +    }
   27.61 +
   27.62 +    public void testParserBasic() throws ParseException {
   27.63 +        FileObject testFile = getTestFile("testfiles/ANTLRv3.g");
   27.64 +
   27.65 +        Source s = Source.create(testFile);
   27.66 +        Snapshot snap = s.createSnapshot();
   27.67 +        NbAntlrParser parser = new NbAntlrParser();
   27.68 +        parser.parse(snap, null, null);
   27.69 +        
   27.70 +        NbAntlrParserResult result = (NbAntlrParserResult)parser.getResult(null);
   27.71 +        assertNotNull(result);
   27.72 +        
   27.73 +        Node parseTree = result.getParseTree();
   27.74 +        assertNotNull(parseTree);
   27.75 +        
   27.76 +        NodeUtil.dumpTree(parseTree);
   27.77 +       
   27.78 +    }
   27.79 +    
   27.80 +}