Automated merge with http://hg.netbeans.org/main/contrib
authorMarek Fukala <mfukala@netbeans.org>
Mon, 14 Jan 2013 15:49:47 +0100
changeset 17925a70237790a41
parent 17922 16184ed8f1e0
parent 17924 d8da262b50db
child 17926 dcfed3efd484
child 17927 60b0c86bafce
Automated merge with http://hg.netbeans.org/main/contrib
     1.1 --- a/o.n.antlr.editor/build.xml	Mon Jan 14 10:29:48 2013 +0100
     1.2 +++ b/o.n.antlr.editor/build.xml	Mon Jan 14 15:49:47 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 10:29:48 2013 +0100
     2.2 +++ b/o.n.antlr.editor/nbproject/project.xml	Mon Jan 14 15:49:47 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 10:29:48 2013 +0100
     3.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3.g	Mon Jan 14 15:49:47 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:47 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:47 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 10:29:48 2013 +0100
     6.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrCslLanguage.java	Mon Jan 14 15:49:47 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:47 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 10:29:48 2013 +0100
     8.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenId.java	Mon Jan 14 15:49:47 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
    8.12 @@ -98,25 +98,25 @@
    8.13      BANG(ANTLRv3Lexer.BANG, OTHERS),
    8.14      REWRITE(ANTLRv3Lexer.REWRITE, OTHERS),
    8.15      TOKENS(ANTLRv3Lexer.TOKENS, OTHERS),
    8.16 -    TOKEN_REF(ANTLRv3Lexer.TOKEN_REF, OTHERS),
    8.17 -    STRING_LITERAL(ANTLRv3Lexer.STRING_LITERAL, OTHERS),
    8.18 -    CHAR_LITERAL(ANTLRv3Lexer.CHAR_LITERAL, OTHERS),
    8.19 +    TOKEN_REF(ANTLRv3Lexer.TOKEN_REF, AntlrTokenIdCategory.TOKENS), 
    8.20 +    STRING_LITERAL(ANTLRv3Lexer.STRING_LITERAL, STRINGS),
    8.21 +    CHAR_LITERAL(ANTLRv3Lexer.CHAR_LITERAL, STRINGS),
    8.22      ACTION(ANTLRv3Lexer.ACTION, OTHERS),
    8.23      OPTIONS(ANTLRv3Lexer.OPTIONS, OTHERS),
    8.24      INT(ANTLRv3Lexer.INT, OTHERS),
    8.25      ARG_ACTION(ANTLRv3Lexer.ARG_ACTION, OTHERS),
    8.26 -    RULE_REF(ANTLRv3Lexer.RULE_REF, OTHERS),
    8.27 -    DOUBLE_QUOTE_STRING_LITERAL(ANTLRv3Lexer.DOUBLE_QUOTE_STRING_LITERAL, OTHERS),
    8.28 -    DOUBLE_ANGLE_STRING_LITERAL(ANTLRv3Lexer.DOUBLE_ANGLE_STRING_LITERAL, OTHERS),
    8.29 +    RULE_REF(ANTLRv3Lexer.RULE_REF, RULES),
    8.30 +    DOUBLE_QUOTE_STRING_LITERAL(ANTLRv3Lexer.DOUBLE_QUOTE_STRING_LITERAL, STRINGS),
    8.31 +    DOUBLE_ANGLE_STRING_LITERAL(ANTLRv3Lexer.DOUBLE_ANGLE_STRING_LITERAL, STRINGS),
    8.32      SRC(ANTLRv3Lexer.SRC, OTHERS),
    8.33 -    SL_COMMENT(ANTLRv3Lexer.SL_COMMENT, OTHERS),
    8.34 -    ML_COMMENT(ANTLRv3Lexer.ML_COMMENT, OTHERS),
    8.35 -    LITERAL_CHAR(ANTLRv3Lexer.LITERAL_CHAR, OTHERS),
    8.36 +    SL_COMMENT(ANTLRv3Lexer.SL_COMMENT, COMMENTS),
    8.37 +    ML_COMMENT(ANTLRv3Lexer.ML_COMMENT, COMMENTS),
    8.38 +    LITERAL_CHAR(ANTLRv3Lexer.LITERAL_CHAR, STRINGS),
    8.39      ESC(ANTLRv3Lexer.ESC, OTHERS),
    8.40      XDIGIT(ANTLRv3Lexer.XDIGIT, OTHERS),
    8.41      NESTED_ARG_ACTION(ANTLRv3Lexer.NESTED_ARG_ACTION, OTHERS),
    8.42 -    ACTION_STRING_LITERAL(ANTLRv3Lexer.ACTION_STRING_LITERAL, OTHERS),
    8.43 -    ACTION_CHAR_LITERAL(ANTLRv3Lexer.ACTION_CHAR_LITERAL, OTHERS),
    8.44 +    ACTION_STRING_LITERAL(ANTLRv3Lexer.ACTION_STRING_LITERAL, STRINGS),
    8.45 +    ACTION_CHAR_LITERAL(ANTLRv3Lexer.ACTION_CHAR_LITERAL, STRINGS),
    8.46      NESTED_ACTION(ANTLRv3Lexer.NESTED_ACTION, OTHERS),
    8.47      ACTION_ESC(ANTLRv3Lexer.ACTION_ESC, OTHERS),
    8.48      WS_LOOP(ANTLRv3Lexer.WS_LOOP, OTHERS),
     9.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenIdCategory.java	Mon Jan 14 10:29:48 2013 +0100
     9.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/AntlrTokenIdCategory.java	Mon Jan 14 15:49:47 2013 +0100
     9.3 @@ -47,7 +47,14 @@
     9.4   */
     9.5  public enum AntlrTokenIdCategory {
     9.6      
     9.7 -    KEYWORDS, ERRORS, OTHERS, NUMBERS, WHITESPACES, BRACES, IDENTIFIERS, STRINGS, 
     9.8 -    SEPARATORS, OPERATORS, COMMENTS;
     9.9 +    TOKENS,
    9.10 +    RULES,
    9.11 +    
    9.12 +    STRINGS,
    9.13 +    KEYWORDS, 
    9.14 +    OPERATORS,
    9.15 +    COMMENTS,
    9.16 +    
    9.17 +    ERRORS, OTHERS, NUMBERS, WHITESPACES, BRACES, IDENTIFIERS ;
    9.18      
    9.19  }
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/CommonTokenUtil.java	Mon Jan 14 15:49:47 2013 +0100
    10.3 @@ -0,0 +1,72 @@
    10.4 +/*
    10.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    10.6 + *
    10.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    10.8 + *
    10.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   10.10 + * Other names may be trademarks of their respective owners.
   10.11 + *
   10.12 + * The contents of this file are subject to the terms of either the GNU
   10.13 + * General Public License Version 2 only ("GPL") or the Common
   10.14 + * Development and Distribution License("CDDL") (collectively, the
   10.15 + * "License"). You may not use this file except in compliance with the
   10.16 + * License. You can obtain a copy of the License at
   10.17 + * http://www.netbeans.org/cddl-gplv2.html
   10.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   10.19 + * specific language governing permissions and limitations under the
   10.20 + * License.  When distributing the software, include this License Header
   10.21 + * Notice in each file and include the License file at
   10.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   10.23 + * particular file as subject to the "Classpath" exception as provided
   10.24 + * by Oracle in the GPL Version 2 section of the License file that
   10.25 + * accompanied this code. If applicable, add the following below the
   10.26 + * License Header, with the fields enclosed by brackets [] replaced by
   10.27 + * your own identifying information:
   10.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   10.29 + *
   10.30 + * If you wish your version of this file to be governed by only the CDDL
   10.31 + * or only the GPL Version 2, indicate your decision by adding
   10.32 + * "[Contributor] elects to include this software in this distribution
   10.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   10.34 + * single choice of license, a recipient has the option to distribute
   10.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   10.36 + * to extend the choice of license to its licensees as provided above.
   10.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   10.38 + * Version 2 license, then the option applies only if the new code is
   10.39 + * made subject to such option by the copyright holder.
   10.40 + *
   10.41 + * Contributor(s):
   10.42 + *
   10.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   10.44 + */
   10.45 +package org.netbeans.modules.antlr.editor;
   10.46 +
   10.47 +import org.antlr.runtime.CommonToken;
   10.48 +
   10.49 +/**
   10.50 + *
   10.51 + * @author marekfukala
   10.52 + */
   10.53 +public class CommonTokenUtil {
   10.54 +
   10.55 +    /**
   10.56 +     * Returns a pointer to the start and end of the token image in the
   10.57 +     * underlaying stream. The token.getStopIndex() points to the last character
   10.58 +     * of the token which is a bit confusing.
   10.59 +     *
   10.60 +     * Use this method to get CommonToken's boundaries instead of using the
   10.61 +     * getStart/StopIndex methods.
   10.62 +     *
   10.63 +     * @return two members array - arr[0] is the start offset, arr[1] is the end
   10.64 +     * offset
   10.65 +     */
   10.66 +    public static int[] getCommonTokenOffsetRange(CommonToken token) {
   10.67 +        if (token.getType() == CommonToken.EOF) {
   10.68 +            //"eof token" points at the end offset of the source, with zero length
   10.69 +            return new int[]{token.getStartIndex(), token.getStopIndex()};
   10.70 +        } else {
   10.71 +            return new int[]{token.getStartIndex(), token.getStopIndex() + 1};
   10.72 +        }
   10.73 +
   10.74 +    }
   10.75 +}
    11.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ExtANTLRv3Lexer.java	Mon Jan 14 10:29:48 2013 +0100
    11.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ExtANTLRv3Lexer.java	Mon Jan 14 15:49:47 2013 +0100
    11.3 @@ -41,11 +41,8 @@
    11.4   */
    11.5  package org.netbeans.modules.antlr.editor;
    11.6  
    11.7 -import java.util.ArrayList;
    11.8 -import java.util.List;
    11.9  import org.antlr.runtime.*;
   11.10 -import org.openide.util.NbBundle;
   11.11 -import org.netbeans.antlr.editor.gen.*;
   11.12 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   11.13  
   11.14  /**
   11.15   * Note: Funny aspect of the ANTLR lexer is that it doesn't create any kind of
    12.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrLexer.java	Mon Jan 14 10:29:48 2013 +0100
    12.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/NbAntlrLexer.java	Mon Jan 14 15:49:47 2013 +0100
    12.3 @@ -44,10 +44,10 @@
    12.4  package org.netbeans.modules.antlr.editor;
    12.5  
    12.6  import org.netbeans.api.lexer.Token;
    12.7 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
    12.8  import org.netbeans.spi.lexer.Lexer;
    12.9  import org.netbeans.spi.lexer.LexerRestartInfo;
   12.10  import org.netbeans.spi.lexer.TokenFactory;
   12.11 -import org.netbeans.antlr.editor.gen.ANTLRv3Lexer;
   12.12  
   12.13  /**
   12.14   * antlr lexer
    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/NbAntlrParser.java	Mon Jan 14 15:49:47 2013 +0100
    13.3 @@ -0,0 +1,164 @@
    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.io.PrintWriter;
   13.48 +import java.util.Collection;
   13.49 +import javax.swing.event.ChangeListener;
   13.50 +import org.antlr.runtime.ANTLRStringStream;
   13.51 +import org.antlr.runtime.CharStream;
   13.52 +import org.antlr.runtime.CommonTokenStream;
   13.53 +import org.antlr.runtime.RecognitionException;
   13.54 +import org.antlr.runtime.debug.ParseTreeBuilder;
   13.55 +import org.antlr.runtime.tree.CommonTree;
   13.56 +import org.antlr.runtime.tree.CommonTreeNodeStream;
   13.57 +import org.antlr.runtime.tree.Tree;
   13.58 +import org.netbeans.api.editor.mimelookup.MimeRegistration;
   13.59 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   13.60 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Parser;
   13.61 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Tree;
   13.62 +import org.netbeans.modules.csl.spi.ParserResult;
   13.63 +import org.netbeans.modules.parsing.api.Snapshot;
   13.64 +import org.netbeans.modules.parsing.api.Task;
   13.65 +import org.netbeans.modules.parsing.spi.ParseException;
   13.66 +import org.netbeans.modules.parsing.spi.Parser;
   13.67 +import org.netbeans.modules.parsing.spi.ParserFactory;
   13.68 +import org.netbeans.modules.parsing.spi.SourceModificationEvent;
   13.69 +
   13.70 +/**
   13.71 + *
   13.72 + * @author mfukala@netbeans.org
   13.73 + */
   13.74 +public class NbAntlrParser extends Parser {
   13.75 +
   13.76 +    private NbAntlrParserResult result;
   13.77 +
   13.78 +    public static NbAntlrParserResult parse(Snapshot snapshot) throws ParseException {
   13.79 +        if (snapshot == null) {
   13.80 +            return null;
   13.81 +        }
   13.82 +        CharSequence input = snapshot.getText();
   13.83 +
   13.84 +        try {
   13.85 +            ANTLRv3Lexer lex = new ANTLRv3Lexer(new ANTLRStringStream(input.toString()) {
   13.86 +                @Override
   13.87 +                public int LA(int i) {
   13.88 +                    if (i == 0) {
   13.89 +                        return 0; // undefined
   13.90 +                    }
   13.91 +                    if (i < 0) {
   13.92 +                        i++; // e.g., translate LA(-1) to use offset 0
   13.93 +                    }
   13.94 +
   13.95 +                    if ((p + i - 1) >= n) {
   13.96 +
   13.97 +                        return CharStream.EOF;
   13.98 +                    }
   13.99 +                    return Character.toUpperCase(data[p + i - 1]);
  13.100 +                }
  13.101 +            });
  13.102 +
  13.103 +            CommonTokenStream tokens = new CommonTokenStream(lex);
  13.104 +            NbParseTreeBuilder builder = new NbParseTreeBuilder(snapshot.getText());
  13.105 +            ANTLRv3Parser g = new ANTLRv3Parser(tokens, builder);
  13.106 +            g.grammarDef(); //parse
  13.107 +            
  13.108 +            return new NbAntlrParserResult(snapshot, builder.getTree());
  13.109 +        } catch (RecognitionException ex) {
  13.110 +            throw new ParseException(String.format("Error parsing %s snapshot.", snapshot), ex); //NOI18N
  13.111 +        }
  13.112 +    }
  13.113 +//
  13.114 +//    public static void dumpTree(Tree node) {
  13.115 +//        PrintWriter pw = new PrintWriter(System.out);
  13.116 +//        dumpTree(node, pw);
  13.117 +//        pw.flush();
  13.118 +//    }
  13.119 +//
  13.120 +//    public static void dumpTree(Tree node, PrintWriter pw) {
  13.121 +//        dump(node, 0, pw);
  13.122 +//
  13.123 +//    }
  13.124 +//
  13.125 +//    private static int x = 0;
  13.126 +//    
  13.127 +//    private static void dump(Tree tree, int level, PrintWriter pw) {
  13.128 +//        for (int i = 0; i < level; i++) {
  13.129 +//            pw.print("    ");
  13.130 +//        }
  13.131 +//        pw.print(x++ + tree.toString());
  13.132 +//        pw.println();
  13.133 +//        for (int i = 0; i < tree.getChildCount(); i++) {
  13.134 +//            Tree child = tree.getChild(i);
  13.135 +//            dump(child, level + 1, pw);
  13.136 +//        }
  13.137 +//    }
  13.138 +
  13.139 +    @Override
  13.140 +    public void parse(Snapshot snapshot, Task task, SourceModificationEvent event) throws ParseException {
  13.141 +        result = parse(snapshot);
  13.142 +    }
  13.143 +
  13.144 +    @Override
  13.145 +    public ParserResult getResult(Task task) throws ParseException {
  13.146 +        return result;
  13.147 +    }
  13.148 +
  13.149 +    @Override
  13.150 +    public void addChangeListener(ChangeListener changeListener) {
  13.151 +        //no-op
  13.152 +    }
  13.153 +
  13.154 +    @Override
  13.155 +    public void removeChangeListener(ChangeListener changeListener) {
  13.156 +        //no-op
  13.157 +    }
  13.158 +
  13.159 +    @MimeRegistration(mimeType = "text/antlr", service = ParserFactory.class)
  13.160 +    public static class Factory extends ParserFactory {
  13.161 +
  13.162 +        @Override
  13.163 +        public Parser createParser(Collection<Snapshot> snapshots) {
  13.164 +            return new NbAntlrParser();
  13.165 +        }
  13.166 +    }
  13.167 +}
    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/NbAntlrParserResult.java	Mon Jan 14 15:49:47 2013 +0100
    14.3 @@ -0,0 +1,117 @@
    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.Collections;
   14.48 +import java.util.List;
   14.49 +import java.util.Map;
   14.50 +import org.antlr.runtime.tree.CommonTree;
   14.51 +import org.netbeans.modules.csl.api.Error;
   14.52 +import org.netbeans.modules.csl.spi.ParserResult;
   14.53 +import org.netbeans.modules.parsing.api.Snapshot;
   14.54 +
   14.55 +/**
   14.56 + *
   14.57 + * @author marekfukala
   14.58 + */
   14.59 +public class NbAntlrParserResult extends ParserResult {
   14.60 +
   14.61 +    public static boolean IN_UNIT_TESTS = false;
   14.62 +    
   14.63 +    private Node parseTree;
   14.64 +    
   14.65 +    public NbAntlrParserResult(Snapshot snapshot, Node parseTree /*, List<ProblemDescription> diagnostics*/) {
   14.66 +        super(snapshot);
   14.67 +        assert parseTree != null;
   14.68 +        this.parseTree = parseTree;
   14.69 +//        this.diagnostics = diagnostics;
   14.70 +    }
   14.71 +
   14.72 +    @Override
   14.73 +    protected void invalidate() {
   14.74 +        //as CSL features uses the parser result out of the parsing task,
   14.75 +        //the invalidation needs to be disabled until fixed.
   14.76 +        
   14.77 +//        if(IN_UNIT_TESTS) {
   14.78 +//            return ; //some simplification - do not invalidate the result in unit tests
   14.79 +//        }
   14.80 +//        parseTree = null;
   14.81 +//        diagnostics = null;
   14.82 +    }
   14.83 +
   14.84 +    public Node getParseTree() {
   14.85 +        if(parseTree == null) {
   14.86 +            throw new IllegalStateException("Already invalidated parser result, you are likely trying to use it outside of the parsing task runnable!"); //NOI18N
   14.87 +        }
   14.88 +        return parseTree;
   14.89 +    }
   14.90 +    
   14.91 +//    /**
   14.92 +//     * Gets lexer / parser diagnostics w/o additional issues 
   14.93 +//     * possibly added by {@link ExtendedDiagnosticsProvider}.
   14.94 +//     */
   14.95 +//    public List<ProblemDescription> getParserDiagnostics() {
   14.96 +//        return diagnostics;
   14.97 +//    }
   14.98 +
   14.99 +    @Override
  14.100 +    public List<? extends Error> getDiagnostics() {
  14.101 +//        return ErrorsProviderQuery.getExtendedDiagnostics(this);
  14.102 +        return Collections.emptyList();
  14.103 +    }
  14.104 +    
  14.105 +//    public <T> T getProperty(Class<T> type) {
  14.106 +//        if(properties == null) {
  14.107 +//            return null;
  14.108 +//        } else {
  14.109 +//            return (T)properties.get(type);
  14.110 +//        }
  14.111 +//    }
  14.112 +//    
  14.113 +//    public <T> void setProperty(Class<T> type, T value) {
  14.114 +//        if(properties == null) {
  14.115 +//            properties = new HashMap();
  14.116 +//        }
  14.117 +//        properties.put(type, value);
  14.118 +//    }
  14.119 +    
  14.120 +}
    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/NbParseTreeBuilder.java	Mon Jan 14 15:49:47 2013 +0100
    15.3 @@ -0,0 +1,447 @@
    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.Collection;
   15.48 +import java.util.List;
   15.49 +import java.util.Map;
   15.50 +import org.antlr.runtime.CommonToken;
   15.51 +import org.antlr.runtime.RecognitionException;
   15.52 +import org.antlr.runtime.Token;
   15.53 +import org.antlr.runtime.debug.BlankDebugEventListener;
   15.54 +
   15.55 +import java.util.Stack;
   15.56 +import java.util.ArrayList;
   15.57 +import java.util.Arrays;
   15.58 +import java.util.HashMap;
   15.59 +import java.util.LinkedHashSet;
   15.60 +import org.antlr.runtime.NoViableAltException;
   15.61 +import org.netbeans.modules.antlr.editor.gen.ANTLRv3Lexer;
   15.62 +import org.openide.util.NbBundle;
   15.63 +
   15.64 +/**
   15.65 + * A patched version of ANLR's ParseTreeBuilder 
   15.66 + * 
   15.67 + * @author mfukala@netbeans.org
   15.68 + */
   15.69 +public class NbParseTreeBuilder extends BlankDebugEventListener {
   15.70 +
   15.71 +    List<CommonToken> hiddenTokens = new ArrayList<CommonToken>();
   15.72 +    private int backtracking = 0;
   15.73 +    private CommonToken lastConsumedToken;
   15.74 +    private CharSequence source;
   15.75 +    static boolean debug_tokens = false; //testing 
   15.76 +    private boolean resync;
   15.77 +    private CommonToken unexpectedToken;
   15.78 +    Stack<RuleNode> callStack = new Stack<RuleNode>();
   15.79 +        
   15.80 +    public NbParseTreeBuilder(CharSequence source) {
   15.81 +        this.source = source;
   15.82 +        callStack.push(new RootNode(source));
   15.83 +    }
   15.84 +
   15.85 +    public AbstractParseTreeNode getTree() {
   15.86 +        return callStack.elementAt(0);
   15.87 +    }
   15.88 +
   15.89 +    /** Backtracking or cyclic DFA, don't want to add nodes to tree */
   15.90 +    @Override
   15.91 +    public void enterDecision(int d, boolean couldBacktrack) {
   15.92 +        backtracking++;
   15.93 +    }
   15.94 +
   15.95 +    @Override
   15.96 +    public void exitDecision(int i) {
   15.97 +        backtracking--;
   15.98 +    }
   15.99 +
  15.100 +    private boolean isIgnoredRule(String ruleName) {
  15.101 +//        return Arrays.binarySearch(IGNORED_RULES, ruleName) >= 0;
  15.102 +        return false;
  15.103 +    }
  15.104 +
  15.105 +    @Override
  15.106 +    public void enterRule(String filename, String ruleName) {
  15.107 +        if (backtracking > 0) {
  15.108 +            return;
  15.109 +        }
  15.110 +        System.out.println("entering " + ruleName);
  15.111 +        
  15.112 +        if (isIgnoredRule(ruleName)) {
  15.113 +            return;
  15.114 +        }
  15.115 +
  15.116 +        AbstractParseTreeNode parentRuleNode = callStack.peek();
  15.117 +        RuleNode ruleNode = new RuleNode(NodeType.valueOf(ruleName), source);
  15.118 +        addNodeChild(parentRuleNode, ruleNode);
  15.119 +        callStack.push(ruleNode);
  15.120 +    }
  15.121 +
  15.122 +    @Override
  15.123 +    public void exitRule(String filename, String ruleName) {
  15.124 +        if (backtracking > 0) {
  15.125 +            return;
  15.126 +        }
  15.127 +        System.out.println("exiting " + ruleName);
  15.128 +        
  15.129 +        if (isIgnoredRule(ruleName)) {
  15.130 +            return;
  15.131 +        }
  15.132 +
  15.133 +        RuleNode ruleNode = callStack.pop();
  15.134 +        if (ruleNode.getChildCount() > 0) {
  15.135 +            //set the rule end offset
  15.136 +            if (lastConsumedToken != null) {
  15.137 +                ruleNode.setLastToken(lastConsumedToken);
  15.138 +            }
  15.139 +        }
  15.140 +        
  15.141 +        
  15.142 +    }
  15.143 +
  15.144 +    @Override
  15.145 +    public void beginResync() {
  15.146 +        super.beginResync();
  15.147 +        resync = true;
  15.148 +    }
  15.149 +
  15.150 +    @Override
  15.151 +    public void endResync() {
  15.152 +        super.endResync();
  15.153 +        resync = false;
  15.154 +    }
  15.155 +    
  15.156 +    @Override
  15.157 +    public void consumeToken(Token token) {
  15.158 +        if (backtracking > 0 || resync) {
  15.159 +            return;
  15.160 +        }
  15.161 +
  15.162 +        if (debug_tokens) {
  15.163 +            CommonToken ct = (CommonToken) token;
  15.164 +            int[] ctr = CommonTokenUtil.getCommonTokenOffsetRange(ct);
  15.165 +            System.out.println(token + "(" + ctr[0] + "-" + ctr[1] + ")");
  15.166 +        }
  15.167 +
  15.168 +        //ignore the closing EOF token, we do not want it
  15.169 +        //it the parse tree
  15.170 +        if (token.getType() == ANTLRv3Lexer.EOF) {
  15.171 +            return;
  15.172 +        }
  15.173 +
  15.174 +        //also ignore error tokens - they are added as children of ErrorNode-s in the recognitionException(...) method
  15.175 +        if (token.getType() == Token.INVALID_TOKEN_TYPE) {
  15.176 +            return;
  15.177 +        }
  15.178 +
  15.179 +        lastConsumedToken = (CommonToken) token;
  15.180 +
  15.181 +        RuleNode ruleNode = callStack.peek();
  15.182 +        TokenNode elementNode = new TokenNode(source, (CommonToken) token);
  15.183 +        elementNode.hiddenTokens = this.hiddenTokens;
  15.184 +        hiddenTokens.clear();
  15.185 +        ruleNode.addChild(elementNode);
  15.186 +
  15.187 +        updateFirstTokens(ruleNode, lastConsumedToken);
  15.188 +    }
  15.189 +
  15.190 +    //set first token for all RuleNode-s in the stack without the first token set
  15.191 +    private void updateFirstTokens(RuleNode ruleNode, CommonToken token) {
  15.192 +        while (true) {
  15.193 +
  15.194 +            if (ruleNode.from() != -1) {
  15.195 +                break;
  15.196 +            }
  15.197 +            ruleNode.setFirstToken(token);
  15.198 +            ruleNode = (RuleNode) ruleNode.getParent();
  15.199 +            if (ruleNode == null) {
  15.200 +                break;
  15.201 +            }
  15.202 +        }
  15.203 +    }
  15.204 +
  15.205 +    @Override
  15.206 +    public void consumeHiddenToken(Token token) {
  15.207 +        if (backtracking > 0 || resync) {
  15.208 +            return;
  15.209 +        }
  15.210 +
  15.211 +        if (debug_tokens) {
  15.212 +            CommonToken ct = (CommonToken) token;
  15.213 +            int[] ctr = CommonTokenUtil.getCommonTokenOffsetRange(ct);
  15.214 +            System.out.println(token + "(" + ctr[0] + "-" + ctr[1] + ")");
  15.215 +        }
  15.216 +
  15.217 +        hiddenTokens.add((CommonToken) token);
  15.218 +    }
  15.219 +
  15.220 +//    @Override
  15.221 +//    public void recognitionException(RecognitionException e) {
  15.222 +//        if (backtracking > 0) {
  15.223 +//            return;
  15.224 +//        }
  15.225 +//        
  15.226 +//        RuleNode ruleNode = callStack.peek();
  15.227 +//
  15.228 +//        String message;
  15.229 +//        int from, to;
  15.230 +//
  15.231 +//        assert e.token != null;
  15.232 +//
  15.233 +//        //invalid token found int the stream
  15.234 +//        unexpectedToken = (CommonToken) e.token;
  15.235 +//        int unexpectedTokenCode = e.getUnexpectedType();
  15.236 +//        CssTokenId unexpectedTokenId = CssTokenId.forTokenTypeCode(unexpectedTokenCode);
  15.237 +//
  15.238 +//        assert unexpectedTokenId != null : "No CssTokenId for " + unexpectedToken;
  15.239 +//
  15.240 +//        //special handling for EOF token - it has lenght == 1 !
  15.241 +//        if(unexpectedTokenId == CssTokenId.EOF) {
  15.242 +//            from = to = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[0]; 
  15.243 +//        } else {
  15.244 +//            //normal tokens
  15.245 +//            from = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[0]; 
  15.246 +//            to = CommonTokenUtil.getCommonTokenOffsetRange(unexpectedToken)[1];
  15.247 +//        }
  15.248 +//      
  15.249 +//        if (unexpectedTokenId == CssTokenId.EOF) {
  15.250 +//            message = NbBundle.getMessage(NbParseTreeBuilder.class, "MSG_Error_Premature_EOF");
  15.251 +//        } else {
  15.252 +//            message = NbBundle.getMessage(NbParseTreeBuilder.class, "MSG_Error_Unexpected_Token", unexpectedTokenId.name());
  15.253 +//        }
  15.254 +//        
  15.255 +//        //create a ParsingProblem
  15.256 +//        ProblemDescription problemDescription = new ProblemDescription(
  15.257 +//                from,
  15.258 +//                to,
  15.259 +//                message,
  15.260 +//                ProblemDescription.Keys.PARSING.name(),
  15.261 +//                ProblemDescription.Type.ERROR);
  15.262 +//
  15.263 +//        problems.add(problemDescription);
  15.264 +//        
  15.265 +//        //create an error node and add it to the parse tree
  15.266 +//        ErrorNode errorNode = new ErrorNode(from, to, problemDescription, source);
  15.267 +//
  15.268 +//        //add the unexpected token as a child of the error node
  15.269 +//        TokenNode tokenNode = new TokenNode(source, unexpectedToken);
  15.270 +//        addNodeChild(errorNode, tokenNode);
  15.271 +//        
  15.272 +//        if(e instanceof NoViableAltException) {
  15.273 +//            //error during predicate - the unexpected token may or may not be
  15.274 +//            //reported later as an error. To handle this,
  15.275 +//            //store the error node and the ruleNode where the error node should be added
  15.276 +//            noViableAltNodes.put(unexpectedToken, new Pair<Node>(ruleNode, errorNode));
  15.277 +//            errorNodes.push(errorNode);
  15.278 +//        } else {
  15.279 +//            //possibly remove the unexpectedToken from the noViableAltNodes map
  15.280 +//            
  15.281 +//            //NOTICE:
  15.282 +//            //Uncomment the following line if you want the parse tree not to produce
  15.283 +//            //multiple error nodes for the same token. If the line is active, there 
  15.284 +//            //wont be error nodes for semantic predicates if the unexpected token
  15.285 +//            //is matched by another error rule later.
  15.286 +////            noViableAltNodes.remove(unexpectedToken);
  15.287 +//            
  15.288 +//            addNodeChild(ruleNode, errorNode);
  15.289 +//            errorNodes.push(errorNode);
  15.290 +//
  15.291 +//            //create and artificial error token so the rules on stack can properly set their ranges
  15.292 +//            lastConsumedToken = new CommonToken(Token.INVALID_TOKEN_TYPE);
  15.293 +//            lastConsumedToken.setStartIndex(from);
  15.294 +//            lastConsumedToken.setStopIndex(to - 1); // ... ( -1 => last *char* index )
  15.295 +//        }
  15.296 +//
  15.297 +//
  15.298 +//    }
  15.299 +
  15.300 +//    @Override
  15.301 +//    public void terminate() {
  15.302 +//        super.terminate();
  15.303 +//
  15.304 +//        //process unreported errors from NoViableAltException
  15.305 +//        for(Pair<Node> pair : noViableAltNodes.values()) {
  15.306 +//            RuleNode ruleNode = (RuleNode)pair.n1;
  15.307 +//            ErrorNode errorNode = (ErrorNode)pair.n2;
  15.308 +//            
  15.309 +//            ruleNode.addChild(errorNode);
  15.310 +//            errorNode.setParent(ruleNode);
  15.311 +//        }
  15.312 +//        
  15.313 +//        //Finally after the parsing is done fix the error nodes and their predecessors.
  15.314 +//        //This fixes the problem with rules where RecognitionException happened
  15.315 +//        //but the errorneous or missing token has been matched in somewhere further
  15.316 +//        for (ErrorNode en : errorNodes) {
  15.317 +//            synchronizeAncestorsBoundaries(en);
  15.318 +//        }
  15.319 +//        
  15.320 +//        //clean parse tree from empty rule nodes 
  15.321 +//        //empty rule node == rule node without a single _token node_ child
  15.322 +//        for(RuleNode node : leafRuleNodes) {
  15.323 +//            removeLeafRuleNodes(node);
  15.324 +//        }
  15.325 +//
  15.326 +//    }
  15.327 +//    
  15.328 +//    //removes all empty rule nodes in the tree path from the given node to the parse tree root
  15.329 +//    private void removeLeafRuleNodes(RuleNode node) {
  15.330 +//        for(;;) {
  15.331 +//            if(node.children().isEmpty()) {
  15.332 +//                RuleNode parent = (RuleNode)node.parent();
  15.333 +//                if(parent == null) {
  15.334 +//                    return ;
  15.335 +//                }
  15.336 +//                parent.deleteChild(node);
  15.337 +//                node = parent;
  15.338 +//            } else {
  15.339 +//                break;
  15.340 +//            }
  15.341 +//        }
  15.342 +//    }
  15.343 +//    
  15.344 +//    private void synchronizeAncestorsBoundaries(RuleNode en) {
  15.345 +//        RuleNode n = en;
  15.346 +//            for (;;) {
  15.347 +//                if (n == null) {
  15.348 +//                    break;
  15.349 +//                }
  15.350 +//                
  15.351 +//                //adjust the parent nodes ranges to the errorNode
  15.352 +//                if (n.from() == -1 || n.from() > en.from()) {
  15.353 +//                    n.from = en.from();
  15.354 +//                }
  15.355 +//                if(n.to() == -1 || n.to() < en.to()) {                    
  15.356 +//                    n.to = en.to();
  15.357 +//                }
  15.358 +//                
  15.359 +//                n = (RuleNode) n.parent();
  15.360 +//            }
  15.361 +//    }
  15.362 +//
  15.363 +//    public Collection<ProblemDescription> getProblems() {
  15.364 +//        return problems;
  15.365 +//    }
  15.366 +//
  15.367 +//    //note: it would be possible to handle this all in consumeToken since it is called from the
  15.368 +//    //BaseRecognizer.consumeUntil(...) {   input.consume();   } but for the better usability
  15.369 +//    //it is done this way. So the beginResyn/endResync doesn't have to be used.
  15.370 +//    //the NbParseTreeBuilder.consumeToken() method ignores tokens with ERROR type so they
  15.371 +//    //won't be duplicated in the parse tree
  15.372 +//    
  15.373 +//    //creates a "recovery" node with all the skipped tokens as children
  15.374 +//    void consumeSkippedTokens(List<Token> tokens) {
  15.375 +//        if(tokens.isEmpty()) {
  15.376 +//            return ;
  15.377 +//        }
  15.378 +//
  15.379 +//        CommonToken first = (CommonToken)tokens.get(0);
  15.380 +//        CommonToken last = (CommonToken)tokens.get(tokens.size() - 1);
  15.381 +//        
  15.382 +//        
  15.383 +//
  15.384 +//        //if there's just one recovered token and the token is the same as the unexpectedToken just skip the 
  15.385 +//        //recovery node creation, the parse tree for the errorneous piece of code is already complete
  15.386 +//        boolean ignoreFirstToken = unexpectedToken  == first;
  15.387 +//        if(ignoreFirstToken && tokens.size() == 1) {
  15.388 +//            return ;
  15.389 +//        }
  15.390 +//        
  15.391 +//        //do not add the first token as children of the recovery node if it has been already
  15.392 +//        //added as a child of the error node created for the RecognitionException
  15.393 +//        if(ignoreFirstToken) {
  15.394 +//            first = (CommonToken)tokens.get(1); //use second
  15.395 +//        }
  15.396 +//        
  15.397 +//        //find last error which triggered this recovery and add the skipped tokens to it
  15.398 +////        ErrorNode errorNode = errorNodes.peek();
  15.399 +////        RuleNode peek = callStack.peek();
  15.400 +////        if(!(peek instanceof ErrorNode)) {
  15.401 +//        
  15.402 +//        RuleNode peek = errorNodes.peek();
  15.403 +//        
  15.404 +//            RuleNode node = new RuleNode(NodeType.recovery, source);
  15.405 +//            peek.addChild(node);
  15.406 +//            node.setParent(peek);
  15.407 +//            peek = node;
  15.408 +//            
  15.409 +////        }
  15.410 +//            
  15.411 +//        
  15.412 +//        //set first and last token
  15.413 +//        peek.setFirstToken(first);
  15.414 +//        peek.setLastToken(last);
  15.415 +//        
  15.416 +//        synchronizeAncestorsBoundaries(peek);
  15.417 +//        
  15.418 +//        //set range
  15.419 +//        peek.from = CommonTokenUtil.getCommonTokenOffsetRange(first)[0]; 
  15.420 +//        peek.to = CommonTokenUtil.getCommonTokenOffsetRange(last)[1]; 
  15.421 +//        
  15.422 +//        //set the error tokens as children of the error node
  15.423 +//        for(int i = (ignoreFirstToken ? 1 : 0); i < tokens.size(); i++) {
  15.424 +//            CommonToken token = (CommonToken)tokens.get(i);
  15.425 +//            TokenNode tokenNode = new TokenNode(source, token);
  15.426 +//            addNodeChild(peek, tokenNode);
  15.427 +//        }
  15.428 +//        
  15.429 +//        //create and artificial error token so the rules on stack can properly set their ranges
  15.430 +//        lastConsumedToken = new CommonToken(Token.INVALID_TOKEN_TYPE);
  15.431 +//        lastConsumedToken.setStartIndex(first.getStartIndex());
  15.432 +//        lastConsumedToken.setStopIndex(last.getStopIndex()); 
  15.433 +//                
  15.434 +//    }
  15.435 +//    
  15.436 +//    
  15.437 +    private void addNodeChild(AbstractParseTreeNode parent, AbstractParseTreeNode child) {
  15.438 +        parent.addChild(child);
  15.439 +        child.setParent(parent);
  15.440 +    }
  15.441 +//    
  15.442 +//    private static class Pair<T> {
  15.443 +//        T n1, n2;
  15.444 +//        public Pair(T n1, T n2) {
  15.445 +//            this.n1 = n1;
  15.446 +//            this.n2 = n2;
  15.447 +//        }
  15.448 +//    }
  15.449 +//    
  15.450 +}
    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/Node.java	Mon Jan 14 15:49:47 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 +import java.util.List;
   16.48 +import java.util.Map;
   16.49 +
   16.50 +/**
   16.51 + * Node of the css source parse tree.
   16.52 + *
   16.53 + * @author marekfukala
   16.54 + */
   16.55 +public interface Node {
   16.56 +    
   16.57 +    public int from();
   16.58 +
   16.59 +    public int to();
   16.60 +    
   16.61 +    public String name();
   16.62 +
   16.63 +    public NodeType type();
   16.64 +    
   16.65 +    public List<Node> children();
   16.66 +    
   16.67 +    public Node parent();
   16.68 +    
   16.69 +    public CharSequence image();
   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/NodeType.java	Mon Jan 14 15:49:47 2013 +0100
    17.3 @@ -0,0 +1,68 @@
    17.4 +/*
    17.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.6 + *
    17.7 + * Copyright 2011 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 2011 Sun Microsystems, Inc.
   17.44 + */
   17.45 +package org.netbeans.modules.antlr.editor;
   17.46 +
   17.47 +/**
   17.48 + * Node types for all the CSS3 ANTLR grammar elements.
   17.49 + * 
   17.50 + * This enum must keep in sync with the ANTLR grammar set of rules!!!
   17.51 + *
   17.52 + * @author mfukala@netbeans.org
   17.53 + */
   17.54 +public enum NodeType {
   17.55 +
   17.56 +    root,
   17.57 +    token,
   17.58 +   
   17.59 +    invalidRule, ebnf, finallyClause, notSet, option, attrScope, 
   17.60 +        element, tokensSpec, treeSpec, ruleScopeSpec, tokenSpec, 
   17.61 +        rewrite_tree_ebnf, optionsSpec, rewrite_template_ref, throwsSpec, 
   17.62 +        exceptionGroup, ebnfSuffix, rewrite_alternative, rewrite_tree, 
   17.63 +        synpred1_ANTLRv3, elementNoOptionSpec, block, rule, rewrite_template, 
   17.64 +        rewrite_tree_alternative, terminal, rewrite_tree_block, range, 
   17.65 +        rewrite_tree_atom, altList, rewrite_template_arg, rewrite, 
   17.66 +        action, rewrite_tree_element, ruleAction, grammarDef, synpred2_ANTLRv3, 
   17.67 +        actionScopeName, id, rewrite_template_args, notTerminal, 
   17.68 +        optionValue, alternative, atom, rewrite_indirect_template_head, 
   17.69 +        exceptionHandler
   17.70 +    
   17.71 +}
    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/NodeUtil.java	Mon Jan 14 15:49:47 2013 +0100
    18.3 @@ -0,0 +1,330 @@
    18.4 +/*
    18.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.6 + *
    18.7 + * Copyright 1997-2010 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 2008 Sun Microsystems, Inc.
   18.44 + */
   18.45 +package org.netbeans.modules.antlr.editor;
   18.46 +
   18.47 +import java.io.PrintWriter;
   18.48 +import java.util.ArrayList;
   18.49 +import java.util.EnumSet;
   18.50 +import java.util.List;
   18.51 +import java.util.Locale;
   18.52 +import java.util.StringTokenizer;
   18.53 +import java.util.concurrent.atomic.AtomicBoolean;
   18.54 +import java.util.concurrent.atomic.AtomicReference;
   18.55 +
   18.56 +/**
   18.57 + * Utility methods to work with the css source parse trees.
   18.58 + *
   18.59 + * @author mfukala@netbeans.org
   18.60 + */
   18.61 +public final class NodeUtil {
   18.62 +
   18.63 +    private static final String INDENT = "    ";//NOI18N
   18.64 +
   18.65 +    private NodeUtil() {
   18.66 +    }
   18.67 +
   18.68 +    public static int[] getTrimmedNodeRange(Node node) {
   18.69 +        CharSequence text = node.image();
   18.70 +        int from_diff;
   18.71 +        int to_diff;
   18.72 +        for (from_diff = 0; from_diff < text.length(); from_diff++) {
   18.73 +            if (!Character.isWhitespace(text.charAt(from_diff))) {
   18.74 +                break;
   18.75 +            }
   18.76 +        }
   18.77 +
   18.78 +        for (to_diff = 0; to_diff < text.length() - from_diff; to_diff++) {
   18.79 +            if (!Character.isWhitespace(text.charAt(text.length() - 1 - to_diff))) {
   18.80 +                break;
   18.81 +            }
   18.82 +        }
   18.83 +
   18.84 +        return new int[]{node.from() + from_diff, node.to() - to_diff};
   18.85 +    }
   18.86 +
   18.87 +    public static Node findNonTokenNodeAtOffset(Node node, int offset) {
   18.88 +        Node found = findNodeAtOffset(node, offset);
   18.89 +        return found instanceof TokenNode
   18.90 +                ? found.parent()
   18.91 +                : found;
   18.92 +
   18.93 +    }
   18.94 +
   18.95 +    public static Node findNodeAtOffset(Node node, int astOffset) {
   18.96 +        int so = node.from();
   18.97 +        int eo = node.to();
   18.98 +
   18.99 +
  18.100 +        if (astOffset < so || astOffset > eo) {
  18.101 +            //we are out of the scope - may happen just with the first client call
  18.102 +            return null;
  18.103 +        }
  18.104 +
  18.105 +        if (astOffset >= so && astOffset <= eo && node.children().isEmpty()) {
  18.106 +            //if the node matches and has no children we found it
  18.107 +            return node;
  18.108 +        }
  18.109 +
  18.110 +        for (Node child : node.children()) {
  18.111 +
  18.112 +            int ch_so = child.from();
  18.113 +            int ch_eo = child.to();
  18.114 +            if (astOffset >= ch_so && astOffset <= ch_eo) {
  18.115 +                //the child is or contains the searched node
  18.116 +                return findNodeAtOffset(child, astOffset);
  18.117 +            }
  18.118 +
  18.119 +        }
  18.120 +
  18.121 +        return node;
  18.122 +    }
  18.123 +
  18.124 +    /** @return first child of the node with the specified kind. */
  18.125 +    public static Node getChildByType(Node node, NodeType type) {
  18.126 +        Node[] children = getChildrenByType(node, type);
  18.127 +        return children.length == 0 ? null : children[0];
  18.128 +    }
  18.129 +
  18.130 +    /**
  18.131 +     * 
  18.132 +     * @param node
  18.133 +     * @param tokenId
  18.134 +     * @return 
  18.135 +     */
  18.136 +    public static Node getChildTokenNode(Node node, AntlrTokenId tokenId) {
  18.137 +        Node[] children = getChildrenByType(node, NodeType.token);
  18.138 +        for (Node n : children) {
  18.139 +            TokenNode tn = (TokenNode) n;
  18.140 +            if (tn.getTokenId() == tokenId) {
  18.141 +                return n;
  18.142 +            }
  18.143 +        }
  18.144 +        return null;
  18.145 +    }
  18.146 +
  18.147 +    public static AntlrTokenId getTokenNodeTokenId(Node node) {
  18.148 +        //strange, possibly better expose TokenNode!
  18.149 +        if (node.type() != NodeType.token) {
  18.150 +            throw new IllegalArgumentException(
  18.151 +                    String.format("The argument must by of NodeType.token type. The actual type is %s", node.type()));
  18.152 +        }
  18.153 +        return ((TokenNode) node).getTokenId();
  18.154 +    }
  18.155 +
  18.156 +    public static Node getAncestorByType(Node node, final NodeType type) {
  18.157 +        AtomicReference<Node> found = new AtomicReference<Node>();
  18.158 +        NodeVisitor visitor = new NodeVisitor<AtomicReference<Node>>(found) {
  18.159 +
  18.160 +            @Override
  18.161 +            public boolean visit(Node node) {
  18.162 +                if (node.type() == type) {
  18.163 +                    getResult().set(node);
  18.164 +                    return true;
  18.165 +                }
  18.166 +                return false;
  18.167 +            }
  18.168 +        };
  18.169 +        visitor.visitAncestors(node);
  18.170 +        return found.get();
  18.171 +    }
  18.172 +    
  18.173 +    public static List<Node> getChildrenRecursivelyByType(Node root, final NodeType... type) {
  18.174 +        final EnumSet<NodeType> nodeTypes = EnumSet.of(type[0], type);
  18.175 +        List<Node> found = new ArrayList<Node>();
  18.176 +        NodeVisitor<List<Node>> visitor = new NodeVisitor<List<Node>>(found) {
  18.177 +
  18.178 +            @Override
  18.179 +            public boolean visit(Node node) {
  18.180 +                if(nodeTypes.contains(node.type())) {
  18.181 +                    getResult().add(node);
  18.182 +                }
  18.183 +                return false;
  18.184 +            }
  18.185 +        };
  18.186 +        
  18.187 +        visitor.visitChildren(root);
  18.188 +        return visitor.getResult();
  18.189 +    }
  18.190 +
  18.191 +    /** @return list of children of the node with the specified kind. */
  18.192 +    public static Node[] getChildrenByType(Node node, NodeType type) {
  18.193 +        ArrayList<Node> list = new ArrayList<Node>(node.children().size() / 4);
  18.194 +        for (Node child : node.children()) {
  18.195 +            if (child.type() == type) {
  18.196 +                list.add(child);
  18.197 +            }
  18.198 +        }
  18.199 +        return list.toArray(new Node[]{});
  18.200 +    }
  18.201 +
  18.202 +    /** @return A sibling node before or after the given node. */
  18.203 +    public static Node getSibling(Node node, boolean before) {
  18.204 +        Node parent = node.parent();
  18.205 +        if (parent == null) {
  18.206 +            return null;
  18.207 +        }
  18.208 +        Node sibling = null;
  18.209 +        for (int i = 0; i < parent.children().size(); i++) {
  18.210 +            List<Node> children = parent.children();
  18.211 +            Node child = children.get(i);
  18.212 +            if (child == node) {
  18.213 +                //we found myself
  18.214 +                if (before) {
  18.215 +                    if (i == 0) {
  18.216 +                        //we are first node, no sibling before
  18.217 +                        return null;
  18.218 +                    } else {
  18.219 +                        return children.get(i - 1);
  18.220 +                    }
  18.221 +                } else {
  18.222 +                    //after
  18.223 +                    if (i == children.size() - 1) {
  18.224 +                        //we are last node, no sibling after
  18.225 +                        return null;
  18.226 +                    } else {
  18.227 +                        return children.get(i + 1);
  18.228 +                    }
  18.229 +                }
  18.230 +            }
  18.231 +        }
  18.232 +        return sibling;
  18.233 +    }
  18.234 +
  18.235 +    public static Node query(Node base, String path) {
  18.236 +        return query(base, path, false);
  18.237 +    }
  18.238 +
  18.239 +    /** find an Node according to the given tree path
  18.240 +     * example of path: declaration/property|1/color -- find a second color property  (index from zero)
  18.241 +     */
  18.242 +    public static Node query(Node base, String path, boolean caseInsensitive) {
  18.243 +        StringTokenizer st = new StringTokenizer(path, "/");
  18.244 +        Node found = base;
  18.245 +        while (st.hasMoreTokens()) {
  18.246 +            String token = st.nextToken();
  18.247 +            int indexDelim = token.indexOf('|');
  18.248 +
  18.249 +            String nodeName = indexDelim >= 0 ? token.substring(0, indexDelim) : token;
  18.250 +            if (caseInsensitive) {
  18.251 +                nodeName = nodeName.toLowerCase(Locale.ENGLISH);
  18.252 +            }
  18.253 +            String sindex = indexDelim >= 0 ? token.substring(indexDelim + 1, token.length()) : "0";
  18.254 +            int index = Integer.parseInt(sindex);
  18.255 +
  18.256 +            int count = 0;
  18.257 +            Node foundLocal = null;
  18.258 +            for (Node child : found.children()) {
  18.259 +                String childName = child.name();
  18.260 +                if ((caseInsensitive ? childName = childName.toLowerCase(Locale.ENGLISH) : childName).equals(nodeName) && count++ == index) {
  18.261 +                    foundLocal = child;
  18.262 +                    break;
  18.263 +                }
  18.264 +            }
  18.265 +            if (foundLocal != null) {
  18.266 +                found = foundLocal;
  18.267 +
  18.268 +                if (!st.hasMoreTokens()) {
  18.269 +                    //last token, we may return
  18.270 +                    assert found.name().equals(nodeName);
  18.271 +                    return found;
  18.272 +                }
  18.273 +
  18.274 +            } else {
  18.275 +                System.err.println(String.format("NodeUtil.query: Could find child '%s' in the node '%s'!", nodeName, found.name()));
  18.276 +                return null; //no found
  18.277 +            }
  18.278 +        }
  18.279 +
  18.280 +        return null;
  18.281 +    }
  18.282 +
  18.283 +    public static void dumpTree(Node node) {
  18.284 +        PrintWriter pw = new PrintWriter(System.out);
  18.285 +        dumpTree(node, pw);
  18.286 +        pw.flush();
  18.287 +    }
  18.288 +
  18.289 +    public static void dumpTree(Node node, PrintWriter pw) {
  18.290 +        dump(node, 0, pw);
  18.291 +
  18.292 +    }
  18.293 +
  18.294 +    private static void dump(Node tree, int level, PrintWriter pw) {
  18.295 +        for (int i = 0; i < level; i++) {
  18.296 +            pw.print(INDENT);
  18.297 +        }
  18.298 +        pw.print(tree.toString());
  18.299 +        pw.println();
  18.300 +        for (Node c : tree.children()) {
  18.301 +            dump(c, level + 1, pw);
  18.302 +        }
  18.303 +    }
  18.304 +
  18.305 +
  18.306 +    public static boolean isOfType(Node node, NodeType... types) {
  18.307 +        for(NodeType type : types) {
  18.308 +            if(node.type() == type) {
  18.309 +                return true;
  18.310 +            }
  18.311 +        }
  18.312 +        return false;
  18.313 +    }
  18.314 +    
  18.315 +//    public static boolean containsError(Node node) {
  18.316 +//        AtomicBoolean error = new AtomicBoolean(false);
  18.317 +//        NodeVisitor<AtomicBoolean> visitor = new NodeVisitor<AtomicBoolean>(error) {
  18.318 +//
  18.319 +//            @Override
  18.320 +//            public boolean visit(Node node) {
  18.321 +//                if(node.type() == NodeType.error) {
  18.322 +//                    getResult().set(true);
  18.323 +//                    return true;
  18.324 +//                }
  18.325 +//                return false;
  18.326 +//            }
  18.327 +//        };
  18.328 +//        
  18.329 +//        visitor.visitChildren(node);
  18.330 +//        
  18.331 +//        return visitor.getResult().get();
  18.332 +//    }
  18.333 +}
    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/NodeVisitor.java	Mon Jan 14 15:49:47 2013 +0100
    19.3 @@ -0,0 +1,142 @@
    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 +import java.util.Collection;
   19.48 +import java.util.List;
   19.49 +
   19.50 +/**
   19.51 + * Allows to visit the css source parse trees.
   19.52 + *
   19.53 + * @author marekfukala
   19.54 + */
   19.55 +public abstract class NodeVisitor<T> {
   19.56 +    
   19.57 +    private T result;
   19.58 +    private boolean cancelled = false;
   19.59 +    
   19.60 +    
   19.61 +    public NodeVisitor(T result) {
   19.62 +        this.result = result;
   19.63 +    }
   19.64 +    
   19.65 +    public NodeVisitor() {
   19.66 +        this(null);
   19.67 +    }
   19.68 +    
   19.69 +    /**
   19.70 +     * Performs the given node visit.
   19.71 +     * @param node
   19.72 +     * @return true if the visiting process should be interrupted
   19.73 +     */
   19.74 +    public abstract boolean visit(Node node);
   19.75 +    
   19.76 +    public T getResult() {
   19.77 +        return result;
   19.78 +    }
   19.79 +    
   19.80 +    /**
   19.81 +     * Implementors may use this flag to possibly stop the visit(...) method 
   19.82 +     * execution. The nodes recursive visiting is canceled automatically once
   19.83 +     * cancel() method is called.
   19.84 +     * 
   19.85 +     * @return true if the visitor should stop performing the code.
   19.86 +     */
   19.87 +    protected boolean isCancelled() {
   19.88 +        return cancelled;
   19.89 +    }
   19.90 +    
   19.91 +    public void cancel() {
   19.92 +        cancelled = true;
   19.93 +    }
   19.94 +    
   19.95 +    public void visitAncestors(Node node) {
   19.96 +        Node parent = node.parent();
   19.97 +        if (parent != null) {
   19.98 +            if(isCancelled()) {
   19.99 +                return ;
  19.100 +            }
  19.101 +            if(visit(parent)) {
  19.102 +                return; //visiting stopped by the visitor
  19.103 +            }
  19.104 +            visitAncestors(parent);
  19.105 +        }
  19.106 +    }
  19.107 +    
  19.108 +    public Node visitChildren(Node node) {
  19.109 +        List<Node> children = node.children();
  19.110 +        if (children != null) {
  19.111 +            for (Node child : children) {
  19.112 +                if(isCancelled()) {
  19.113 +                    return null;
  19.114 +                }
  19.115 +                if(visit(child)) {
  19.116 +                    return child; //visiting stopped by the visitor
  19.117 +                }
  19.118 +                //recursion
  19.119 +                Node breakNode = visitChildren(child); 
  19.120 +                if(breakNode != null) {
  19.121 +                    return breakNode;
  19.122 +                }
  19.123 +            }
  19.124 +        }
  19.125 +        return null;
  19.126 +    }
  19.127 +    
  19.128 +    public static <TE> void visitChildren(Node node, Collection<NodeVisitor<TE>> visitors) {
  19.129 +        List<Node> children = node.children();
  19.130 +        if (children != null) {
  19.131 +            for (Node child : children) {
  19.132 +                for(NodeVisitor v : visitors) {
  19.133 +                    if(v.isCancelled()) {
  19.134 +                        continue; //skip the cancelled visitors
  19.135 +                    }
  19.136 +                    v.visit(child);
  19.137 +                }
  19.138 +                //recursion
  19.139 +                visitChildren(child, visitors); 
  19.140 +            }
  19.141 +        }
  19.142 +    }
  19.143 +    
  19.144 +    
  19.145 +}
    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/ProblemDescription.java	Mon Jan 14 15:49:47 2013 +0100
    20.3 @@ -0,0 +1,137 @@
    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 + * Representation of an error in css source.
   20.49 + *
   20.50 + * @author marekfukala
   20.51 + */
   20.52 +public final class ProblemDescription {
   20.53 +    
   20.54 +    public enum Type {
   20.55 +        INFO, WARNING, ERROR, FATAL;
   20.56 +    }
   20.57 +    
   20.58 +    public enum Keys {
   20.59 +        LEXING, PARSING, AST;
   20.60 +    }
   20.61 +    
   20.62 +    private final int from, to;
   20.63 +    private final String description;
   20.64 +    private final String key;
   20.65 +    private Type type;
   20.66 +    
   20.67 +    public ProblemDescription(int from, int to, String description, String key, Type type) {
   20.68 +        this.from = from;
   20.69 +        this.to = to;
   20.70 +        this.description = description;
   20.71 +        this.key = key;
   20.72 +        this.type = type;
   20.73 +    }
   20.74 +
   20.75 +    public String getDescription() {
   20.76 +        return description;
   20.77 +    }
   20.78 +
   20.79 +    public int getFrom() {
   20.80 +        return from;
   20.81 +    }
   20.82 +
   20.83 +    public String getKey() {
   20.84 +        return key;
   20.85 +    }
   20.86 +
   20.87 +    public int getTo() {
   20.88 +        return to;
   20.89 +    }
   20.90 +
   20.91 +    public Type getType() {
   20.92 +        return type;
   20.93 +    }
   20.94 +    
   20.95 +    @Override
   20.96 +    public String toString() {
   20.97 +        return "ProblemDescription{" + "from=" + from + ", to=" + to + ", description=" + description + ", key=" + key + ", type=" + type + '}';
   20.98 +    }
   20.99 +
  20.100 +    @Override
  20.101 +    public boolean equals(Object obj) {
  20.102 +        if (obj == null) {
  20.103 +            return false;
  20.104 +        }
  20.105 +        if (getClass() != obj.getClass()) {
  20.106 +            return false;
  20.107 +        }
  20.108 +        final ProblemDescription other = (ProblemDescription) obj;
  20.109 +        if (this.from != other.from) {
  20.110 +            return false;
  20.111 +        }
  20.112 +        if (this.to != other.to) {
  20.113 +            return false;
  20.114 +        }
  20.115 +        if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
  20.116 +            return false;
  20.117 +        }
  20.118 +        if ((this.key == null) ? (other.key != null) : !this.key.equals(other.key)) {
  20.119 +            return false;
  20.120 +        }
  20.121 +        if (this.type != other.type) {
  20.122 +            return false;
  20.123 +        }
  20.124 +        return true;
  20.125 +    }
  20.126 +
  20.127 +    @Override
  20.128 +    public int hashCode() {
  20.129 +        int hash = 5;
  20.130 +        hash = 19 * hash + this.from;
  20.131 +        hash = 19 * hash + this.to;
  20.132 +        hash = 19 * hash + (this.description != null ? this.description.hashCode() : 0);
  20.133 +        hash = 19 * hash + (this.key != null ? this.key.hashCode() : 0);
  20.134 +        hash = 19 * hash + (this.type != null ? this.type.hashCode() : 0);
  20.135 +        return hash;
  20.136 +    }
  20.137 +    
  20.138 +    
  20.139 +    
  20.140 +}
    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/RootNode.java	Mon Jan 14 15:49:47 2013 +0100
    21.3 @@ -0,0 +1,65 @@
    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 +
   21.48 +/**
   21.49 + *
   21.50 + * @author marekfukala
   21.51 + */
   21.52 +public class RootNode extends RuleNode {
   21.53 +
   21.54 +    public RootNode(CharSequence source) {
   21.55 +        super(NodeType.root, source);
   21.56 +    }
   21.57 +    
   21.58 +    @Override
   21.59 +    public int from() {
   21.60 +        return 0;
   21.61 +    }
   21.62 +
   21.63 +    @Override
   21.64 +    public int to() {
   21.65 +        return getSource().length();
   21.66 +    }
   21.67 +    
   21.68 +}
    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/RuleNode.java	Mon Jan 14 15:49:47 2013 +0100
    22.3 @@ -0,0 +1,91 @@
    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 RuleNode extends AbstractParseTreeNode {
   22.54 +    
   22.55 +    private NodeType rule;
   22.56 +    int from = -1, to = -1;
   22.57 +    
   22.58 +    RuleNode(NodeType rule, CharSequence source) {
   22.59 +        super(source);
   22.60 +        this.rule = rule;
   22.61 +    }
   22.62 +    
   22.63 +    //used by NbParseTreeBuilder
   22.64 +    void setFirstToken(CommonToken token) {
   22.65 +        assert token != null : "Attempting to set null first token in rule " + name();
   22.66 +        this.from = CommonTokenUtil.getCommonTokenOffsetRange(token)[0];
   22.67 +    }
   22.68 +    
   22.69 +    void setLastToken(CommonToken token) {
   22.70 +        assert token != null : "Attempting to set null last token in rule " + name();
   22.71 +        this.to = CommonTokenUtil.getCommonTokenOffsetRange(token)[1];
   22.72 +    }
   22.73 +
   22.74 +    @Override
   22.75 +    public int from() {
   22.76 +        return from;
   22.77 +    }
   22.78 +
   22.79 +    @Override
   22.80 +    public int to() {
   22.81 +        return to;
   22.82 +    }
   22.83 +
   22.84 +    @Override
   22.85 +    public NodeType type() {
   22.86 +        return rule;
   22.87 +    }
   22.88 +
   22.89 +    @Override
   22.90 +    public String name() {
   22.91 +        return type().name();
   22.92 +    }
   22.93 +
   22.94 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/TokenNode.java	Mon Jan 14 15:49:47 2013 +0100
    23.3 @@ -0,0 +1,109 @@
    23.4 +/*
    23.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    23.6 + *
    23.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
    23.8 + *
    23.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   23.10 + * Other names may be trademarks of their respective owners.
   23.11 + *
   23.12 + * The contents of this file are subject to the terms of either the GNU
   23.13 + * General Public License Version 2 only ("GPL") or the Common
   23.14 + * Development and Distribution License("CDDL") (collectively, the
   23.15 + * "License"). You may not use this file except in compliance with the
   23.16 + * License. You can obtain a copy of the License at
   23.17 + * http://www.netbeans.org/cddl-gplv2.html
   23.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   23.19 + * specific language governing permissions and limitations under the
   23.20 + * License.  When distributing the software, include this License Header
   23.21 + * Notice in each file and include the License file at
   23.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   23.23 + * particular file as subject to the "Classpath" exception as provided
   23.24 + * by Oracle in the GPL Version 2 section of the License file that
   23.25 + * accompanied this code. If applicable, add the following below the
   23.26 + * License Header, with the fields enclosed by brackets [] replaced by
   23.27 + * your own identifying information:
   23.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   23.29 + *
   23.30 + * If you wish your version of this file to be governed by only the CDDL
   23.31 + * or only the GPL Version 2, indicate your decision by adding
   23.32 + * "[Contributor] elects to include this software in this distribution
   23.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   23.34 + * single choice of license, a recipient has the option to distribute
   23.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   23.36 + * to extend the choice of license to its licensees as provided above.
   23.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   23.38 + * Version 2 license, then the option applies only if the new code is
   23.39 + * made subject to such option by the copyright holder.
   23.40 + *
   23.41 + * Contributor(s):
   23.42 + *
   23.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
   23.44 + */
   23.45 +package org.netbeans.modules.antlr.editor;
   23.46 +
   23.47 +import org.antlr.runtime.CommonToken;
   23.48 +
   23.49 +/**
   23.50 + *
   23.51 + * @author marekfukala
   23.52 + */
   23.53 +public class TokenNode extends AbstractParseTreeNode {
   23.54 +
   23.55 +    private final int from, to;
   23.56 +    private AntlrTokenId tokenId;
   23.57 +
   23.58 +    public TokenNode(CharSequence source, CommonToken token) {
   23.59 +        super(source); 
   23.60 +        int[] range = CommonTokenUtil.getCommonTokenOffsetRange(token);
   23.61 +        from = range[0];
   23.62 +        to = range[1];
   23.63 +        tokenId = AntlrTokenId.forTokenTypeCode(token.getType());
   23.64 +    }
   23.65 +
   23.66 +    @Override
   23.67 +    public String name() {
   23.68 +        return image().toString();
   23.69 +    }
   23.70 +    
   23.71 +    @Override
   23.72 +    public NodeType type() {
   23.73 +        return NodeType.token;
   23.74 +    }
   23.75 +
   23.76 +    /**
   23.77 +     * Gets the kind of the token encapsulated by this TokenNode. Please notice
   23.78 +     * that it's not possible to get the token itself since the parser source
   23.79 +     * is not a stream of the netbeans tokens, but tokens generated by the antlr lexer.
   23.80 +     */
   23.81 +    public AntlrTokenId getTokenId() {
   23.82 +        return tokenId;
   23.83 +    }
   23.84 +
   23.85 +    @Override
   23.86 +    public int from() {
   23.87 +        return from;
   23.88 +    }
   23.89 +
   23.90 +    @Override
   23.91 +    public int to() {
   23.92 +        return to;
   23.93 +    }
   23.94 +
   23.95 +    @Override
   23.96 +    public String toString() {
   23.97 +        return new StringBuilder(super.toString())
   23.98 +                .append(' ')
   23.99 +                .append('\'')
  23.100 +                .append(escapeNL(image()))
  23.101 +                .append('\'')
  23.102 +                .append(' ')
  23.103 +                .append('[')
  23.104 +                .append(getTokenId())
  23.105 +                .append(']')
  23.106 +                .toString();
  23.107 +    }
  23.108 +    
  23.109 +    private CharSequence escapeNL(CharSequence text) {
  23.110 +        return text.toString().replaceAll("\n", "\\\\n");
  23.111 +    }
  23.112 +}
    24.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/fontsColors.xml	Mon Jan 14 10:29:48 2013 +0100
    24.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/fontsColors.xml	Mon Jan 14 15:49:47 2013 +0100
    24.3 @@ -47,7 +47,24 @@
    24.4  
    24.5  <fontscolors>
    24.6      
    24.7 +    <fontcolor  name="whitespaces" default="default"/>
    24.8 +    <fontcolor  name="comments" default="comment"/>
    24.9      
   24.10 +    <fontcolor name="tokens" foreColor="007c00"> 
   24.11 +    </fontcolor>
   24.12      
   24.13 +    <fontcolor name="rules" default="identifier">
   24.14 +        <font style="bold" />
   24.15 +    </fontcolor>
   24.16 +    
   24.17 +    
   24.18 +    <fontcolor name="strings" default="string"/>
   24.19 +    
   24.20 +    <fontcolor name="others" default="default"/>    
   24.21 +    <fontcolor name="braces" default="separator"/>
   24.22 +    <fontcolor name="operators" default="operator"/>
   24.23 +    
   24.24 +    <fontcolor name="keywords" default="keyword"/>
   24.25 +    <fontcolor name="numbers" default="number"/>
   24.26      
   24.27  </fontscolors>
    25.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Lexer.java	Mon Jan 14 10:29:48 2013 +0100
    25.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Lexer.java	Mon Jan 14 15:49:47 2013 +0100
    25.3 @@ -1,6 +1,6 @@
    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/ANTLRv3.g 2013-01-11 15:01:27
    25.5 -
    25.6 -package org.netbeans.antlr.editor.gen;
    25.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
    25.8 +
    25.9 +package org.netbeans.modules.antlr.editor.gen;
   25.10  
   25.11  
   25.12  import org.antlr.runtime.*;
    26.1 --- a/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Parser.java	Mon Jan 14 10:29:48 2013 +0100
    26.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Parser.java	Mon Jan 14 15:49:47 2013 +0100
    26.3 @@ -1,6 +1,6 @@
    26.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
    26.5 -
    26.6 -package org.netbeans.antlr.editor.gen;
    26.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
    26.8 +
    26.9 +package org.netbeans.modules.antlr.editor.gen;
   26.10  
   26.11  
   26.12  import org.antlr.runtime.*;
   26.13 @@ -115,17 +115,17 @@
   26.14      // delegators
   26.15  
   26.16      public static final String[] ruleNames = new String[] {
   26.17 -        "invalidRule", "elementNoOptionSpec", "ruleAction", "synpred2_ANTLRv3", 
   26.18 -        "rewrite_tree_ebnf", "id", "rule", "treeSpec", "rewrite_template", 
   26.19 -        "tokensSpec", "ebnfSuffix", "alternative", "notTerminal", "terminal", 
   26.20 -        "ruleScopeSpec", "notSet", "range", "ebnf", "rewrite_alternative", 
   26.21 -        "rewrite_template_ref", "rewrite_tree_block", "option", "exceptionHandler", 
   26.22 -        "synpred1_ANTLRv3", "rewrite_template_args", "throwsSpec", "actionScopeName", 
   26.23 -        "finallyClause", "rewrite_tree_element", "rewrite_tree_alternative", 
   26.24 -        "optionsSpec", "rewrite_template_arg", "tokenSpec", "attrScope", 
   26.25 -        "altList", "exceptionGroup", "atom", "rewrite_tree", "element", 
   26.26 -        "rewrite_tree_atom", "rewrite_indirect_template_head", "grammarDef", 
   26.27 -        "block", "rewrite", "optionValue", "action"
   26.28 +        "invalidRule", "ebnf", "finallyClause", "notSet", "option", "attrScope", 
   26.29 +        "element", "tokensSpec", "treeSpec", "ruleScopeSpec", "tokenSpec", 
   26.30 +        "rewrite_tree_ebnf", "optionsSpec", "rewrite_template_ref", "throwsSpec", 
   26.31 +        "exceptionGroup", "ebnfSuffix", "rewrite_alternative", "rewrite_tree", 
   26.32 +        "synpred1_ANTLRv3", "elementNoOptionSpec", "block", "rule", "rewrite_template", 
   26.33 +        "rewrite_tree_alternative", "terminal", "rewrite_tree_block", "range", 
   26.34 +        "rewrite_tree_atom", "altList", "rewrite_template_arg", "rewrite", 
   26.35 +        "action", "rewrite_tree_element", "ruleAction", "grammarDef", "synpred2_ANTLRv3", 
   26.36 +        "actionScopeName", "id", "rewrite_template_args", "notTerminal", 
   26.37 +        "optionValue", "alternative", "atom", "rewrite_indirect_template_head", 
   26.38 +        "exceptionHandler"
   26.39      };
   26.40      public static final boolean[] decisionCanBacktrack = new boolean[] {
   26.41          false, // invalid decision
   26.42 @@ -610,7 +610,7 @@
   26.43  
   26.44  
   26.45              // AST REWRITE
   26.46 -            // elements: tokensSpec, DOC_COMMENT, rule, action, optionsSpec, id, attrScope
   26.47 +            // elements: optionsSpec, action, tokensSpec, attrScope, id, rule, DOC_COMMENT
   26.48              // token labels: 
   26.49              // rule labels: retval
   26.50              // token list labels: 
   26.51 @@ -1015,7 +1015,7 @@
   26.52  
   26.53  
   26.54                      // AST REWRITE
   26.55 -                    // elements: lit, TOKEN_REF, 71
   26.56 +                    // elements: TOKEN_REF, lit, 71
   26.57                      // token labels: lit
   26.58                      // rule labels: retval
   26.59                      // token list labels: 
   26.60 @@ -1169,7 +1169,7 @@
   26.61  
   26.62  
   26.63              // AST REWRITE
   26.64 -            // elements: ACTION, SCOPE, id
   26.65 +            // elements: id, ACTION, SCOPE
   26.66              // token labels: 
   26.67              // rule labels: retval
   26.68              // token list labels: 
   26.69 @@ -1348,7 +1348,7 @@
   26.70  
   26.71  
   26.72              // AST REWRITE
   26.73 -            // elements: ACTION, id, 72, actionScopeName
   26.74 +            // elements: 72, ACTION, id, actionScopeName
   26.75              // token labels: 
   26.76              // rule labels: retval
   26.77              // token list labels: 
   26.78 @@ -1695,7 +1695,7 @@
   26.79  
   26.80  
   26.81              // AST REWRITE
   26.82 -            // elements: OPTIONS, option
   26.83 +            // elements: option, OPTIONS
   26.84              // token labels: 
   26.85              // rule labels: retval
   26.86              // token list labels: 
   26.87 @@ -1818,7 +1818,7 @@
   26.88  
   26.89  
   26.90              // AST REWRITE
   26.91 -            // elements: 71, optionValue, id
   26.92 +            // elements: id, optionValue, 71
   26.93              // token labels: 
   26.94              // rule labels: retval
   26.95              // token list labels: 
   26.96 @@ -2613,7 +2613,7 @@
   26.97  
   26.98  
   26.99              // AST REWRITE
  26.100 -            // elements: ruleAction, arg, optionsSpec, ruleScopeSpec, id, altList, exceptionGroup, rt
  26.101 +            // elements: ruleScopeSpec, arg, altList, exceptionGroup, ruleAction, rt, id, optionsSpec
  26.102              // token labels: arg, rt
  26.103              // rule labels: retval
  26.104              // token list labels: 
  26.105 @@ -2802,7 +2802,7 @@
  26.106  
  26.107  
  26.108              // AST REWRITE
  26.109 -            // elements: id, 72, ACTION
  26.110 +            // elements: ACTION, id, 72
  26.111              // token labels: 
  26.112              // rule labels: retval
  26.113              // token list labels: 
  26.114 @@ -3245,7 +3245,7 @@
  26.115  
  26.116  
  26.117                      // AST REWRITE
  26.118 -                    // elements: SCOPE, id
  26.119 +                    // elements: id, SCOPE
  26.120                      // token labels: 
  26.121                      // rule labels: retval
  26.122                      // token list labels: 
  26.123 @@ -3622,7 +3622,7 @@
  26.124  
  26.125  
  26.126              // AST REWRITE
  26.127 -            // elements: rewrite, optionsSpec, alternative
  26.128 +            // elements: optionsSpec, alternative, rewrite
  26.129              // token labels: 
  26.130              // rule labels: retval
  26.131              // token list labels: 
  26.132 @@ -3821,7 +3821,7 @@
  26.133  
  26.134  
  26.135              // AST REWRITE
  26.136 -            // elements: rewrite, alternative
  26.137 +            // elements: alternative, rewrite
  26.138              // token labels: 
  26.139              // rule labels: retval
  26.140              // token list labels: 
  26.141 @@ -4463,7 +4463,7 @@
  26.142  
  26.143  
  26.144              // AST REWRITE
  26.145 -            // elements: 86, ACTION
  26.146 +            // elements: ACTION, 86
  26.147              // token labels: 
  26.148              // rule labels: retval
  26.149              // token list labels: 
  26.150 @@ -4778,7 +4778,7 @@
  26.151  
  26.152  
  26.153                              // AST REWRITE
  26.154 -                            // elements: ebnfSuffix, labelOp, atom, id
  26.155 +                            // elements: atom, labelOp, id, ebnfSuffix
  26.156                              // token labels: labelOp
  26.157                              // rule labels: retval
  26.158                              // token list labels: 
  26.159 @@ -4853,7 +4853,7 @@
  26.160                              {
  26.161  
  26.162                              // AST REWRITE
  26.163 -                            // elements: atom, labelOp, id
  26.164 +                            // elements: id, atom, labelOp
  26.165                              // token labels: labelOp
  26.166                              // rule labels: retval
  26.167                              // token list labels: 
  26.168 @@ -5006,7 +5006,7 @@
  26.169  
  26.170  
  26.171                              // AST REWRITE
  26.172 -                            // elements: labelOp, ebnfSuffix, block, id
  26.173 +                            // elements: id, ebnfSuffix, block, labelOp
  26.174                              // token labels: labelOp
  26.175                              // rule labels: retval
  26.176                              // token list labels: 
  26.177 @@ -5174,7 +5174,7 @@
  26.178  
  26.179  
  26.180                              // AST REWRITE
  26.181 -                            // elements: ebnfSuffix, atom
  26.182 +                            // elements: atom, ebnfSuffix
  26.183                              // token labels: 
  26.184                              // rule labels: retval
  26.185                              // token list labels: 
  26.186 @@ -5451,7 +5451,7 @@
  26.187  
  26.188  
  26.189                              // AST REWRITE
  26.190 -                            // elements: ebnfSuffix, treeSpec
  26.191 +                            // elements: treeSpec, ebnfSuffix
  26.192                              // token labels: 
  26.193                              // rule labels: retval
  26.194                              // token list labels: 
  26.195 @@ -5944,7 +5944,7 @@
  26.196  
  26.197  
  26.198                              // AST REWRITE
  26.199 -                            // elements: notSet, op
  26.200 +                            // elements: op, notSet
  26.201                              // token labels: op
  26.202                              // rule labels: retval
  26.203                              // token list labels: 
  26.204 @@ -6132,7 +6132,7 @@
  26.205  
  26.206  
  26.207                      // AST REWRITE
  26.208 -                    // elements: op, op, RULE_REF, arg, RULE_REF, RULE_REF, RULE_REF, arg
  26.209 +                    // elements: RULE_REF, op, arg, RULE_REF, arg, op, RULE_REF, RULE_REF
  26.210                      // token labels: arg, op
  26.211                      // rule labels: retval
  26.212                      // token list labels: 
  26.213 @@ -6314,7 +6314,7 @@
  26.214  
  26.215  
  26.216                      // AST REWRITE
  26.217 -                    // elements: 89, notTerminal
  26.218 +                    // elements: notTerminal, 89
  26.219                      // token labels: 
  26.220                      // rule labels: retval
  26.221                      // token list labels: 
  26.222 @@ -6360,7 +6360,7 @@
  26.223  
  26.224  
  26.225                      // AST REWRITE
  26.226 -                    // elements: block, 89
  26.227 +                    // elements: 89, block
  26.228                      // token labels: 
  26.229                      // rule labels: retval
  26.230                      // token list labels: 
  26.231 @@ -6999,7 +6999,7 @@
  26.232  
  26.233  
  26.234              // AST REWRITE
  26.235 -            // elements: c1, c2
  26.236 +            // elements: c2, c1
  26.237              // token labels: c1, c2
  26.238              // rule labels: retval
  26.239              // token list labels: 
  26.240 @@ -7393,7 +7393,7 @@
  26.241  
  26.242  
  26.243                      // AST REWRITE
  26.244 -                    // elements: ROOT, terminal
  26.245 +                    // elements: terminal, ROOT
  26.246                      // token labels: 
  26.247                      // rule labels: retval
  26.248                      // token list labels: 
  26.249 @@ -7917,7 +7917,7 @@
  26.250  
  26.251  
  26.252                      // AST REWRITE
  26.253 -                    // elements: predicated, last, preds, rew2, rew
  26.254 +                    // elements: predicated, preds, last, rew, rew2
  26.255                      // token labels: rew2
  26.256                      // rule labels: retval, last
  26.257                      // token list labels: rew, preds
  26.258 @@ -9271,7 +9271,7 @@
  26.259  
  26.260  
  26.261              // AST REWRITE
  26.262 -            // elements: rewrite_tree_element, rewrite_tree_atom
  26.263 +            // elements: rewrite_tree_atom, rewrite_tree_element
  26.264              // token labels: 
  26.265              // rule labels: retval
  26.266              // token list labels: 
  26.267 @@ -9479,7 +9479,7 @@
  26.268  
  26.269  
  26.270                      // AST REWRITE
  26.271 -                    // elements: id, str, rewrite_template_args
  26.272 +                    // elements: rewrite_template_args, str, id
  26.273                      // token labels: str
  26.274                      // rule labels: retval
  26.275                      // token list labels: 
  26.276 @@ -9791,7 +9791,7 @@
  26.277  
  26.278  
  26.279              // AST REWRITE
  26.280 -            // elements: ACTION, rewrite_template_args
  26.281 +            // elements: rewrite_template_args, ACTION
  26.282              // token labels: 
  26.283              // rule labels: retval
  26.284              // token list labels: 
  26.285 @@ -10114,7 +10114,7 @@
  26.286  
  26.287  
  26.288              // AST REWRITE
  26.289 -            // elements: ACTION, id
  26.290 +            // elements: id, ACTION
  26.291              // token labels: 
  26.292              // rule labels: retval
  26.293              // token list labels: 
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.java	Mon Jan 14 15:49:47 2013 +0100
    27.3 @@ -0,0 +1,5081 @@
    27.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
    27.5 +
    27.6 +package org.netbeans.modules.antlr.editor.gen;
    27.7 +
    27.8 +
    27.9 +import org.antlr.runtime.*;
   27.10 +import org.antlr.runtime.tree.*;import java.util.Stack;
   27.11 +import java.util.List;
   27.12 +import java.util.ArrayList;
   27.13 +
   27.14 +import org.antlr.runtime.debug.*;
   27.15 +import java.io.IOException;
   27.16 +/** ANTLR v3 tree grammar to walk trees created by ANTLRv3.g */
   27.17 +public class ANTLRv3Tree extends DebugTreeParser {
   27.18 +    public static final String[] tokenNames = new String[] {
   27.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'", "'+='", "'=>'", "'~'", "'?'", "'+'", "'.'", "'$'"
   27.20 +    };
   27.21 +    public static final int EOF=-1;
   27.22 +    public static final int T__65=65;
   27.23 +    public static final int T__66=66;
   27.24 +    public static final int T__67=67;
   27.25 +    public static final int T__68=68;
   27.26 +    public static final int T__69=69;
   27.27 +    public static final int T__70=70;
   27.28 +    public static final int T__71=71;
   27.29 +    public static final int T__72=72;
   27.30 +    public static final int T__73=73;
   27.31 +    public static final int T__74=74;
   27.32 +    public static final int T__75=75;
   27.33 +    public static final int T__76=76;
   27.34 +    public static final int T__77=77;
   27.35 +    public static final int T__78=78;
   27.36 +    public static final int T__79=79;
   27.37 +    public static final int T__80=80;
   27.38 +    public static final int T__81=81;
   27.39 +    public static final int T__82=82;
   27.40 +    public static final int T__83=83;
   27.41 +    public static final int T__84=84;
   27.42 +    public static final int T__85=85;
   27.43 +    public static final int T__86=86;
   27.44 +    public static final int T__87=87;
   27.45 +    public static final int T__88=88;
   27.46 +    public static final int T__89=89;
   27.47 +    public static final int T__90=90;
   27.48 +    public static final int T__91=91;
   27.49 +    public static final int T__92=92;
   27.50 +    public static final int T__93=93;
   27.51 +    public static final int DOC_COMMENT=4;
   27.52 +    public static final int PARSER=5;
   27.53 +    public static final int LEXER=6;
   27.54 +    public static final int RULE=7;
   27.55 +    public static final int BLOCK=8;
   27.56 +    public static final int OPTIONAL=9;
   27.57 +    public static final int CLOSURE=10;
   27.58 +    public static final int POSITIVE_CLOSURE=11;
   27.59 +    public static final int SYNPRED=12;
   27.60 +    public static final int RANGE=13;
   27.61 +    public static final int CHAR_RANGE=14;
   27.62 +    public static final int EPSILON=15;
   27.63 +    public static final int ALT=16;
   27.64 +    public static final int EOR=17;
   27.65 +    public static final int EOB=18;
   27.66 +    public static final int EOA=19;
   27.67 +    public static final int ID=20;
   27.68 +    public static final int ARG=21;
   27.69 +    public static final int ARGLIST=22;
   27.70 +    public static final int RET=23;
   27.71 +    public static final int LEXER_GRAMMAR=24;
   27.72 +    public static final int PARSER_GRAMMAR=25;
   27.73 +    public static final int TREE_GRAMMAR=26;
   27.74 +    public static final int COMBINED_GRAMMAR=27;
   27.75 +    public static final int INITACTION=28;
   27.76 +    public static final int LABEL=29;
   27.77 +    public static final int TEMPLATE=30;
   27.78 +    public static final int SCOPE=31;
   27.79 +    public static final int SEMPRED=32;
   27.80 +    public static final int GATED_SEMPRED=33;
   27.81 +    public static final int SYN_SEMPRED=34;
   27.82 +    public static final int BACKTRACK_SEMPRED=35;
   27.83 +    public static final int FRAGMENT=36;
   27.84 +    public static final int TREE_BEGIN=37;
   27.85 +    public static final int ROOT=38;
   27.86 +    public static final int BANG=39;
   27.87 +    public static final int REWRITE=40;
   27.88 +    public static final int TOKENS=41;
   27.89 +    public static final int TOKEN_REF=42;
   27.90 +    public static final int STRING_LITERAL=43;
   27.91 +    public static final int CHAR_LITERAL=44;
   27.92 +    public static final int ACTION=45;
   27.93 +    public static final int OPTIONS=46;
   27.94 +    public static final int INT=47;
   27.95 +    public static final int ARG_ACTION=48;
   27.96 +    public static final int RULE_REF=49;
   27.97 +    public static final int DOUBLE_QUOTE_STRING_LITERAL=50;
   27.98 +    public static final int DOUBLE_ANGLE_STRING_LITERAL=51;
   27.99 +    public static final int SRC=52;
  27.100 +    public static final int SL_COMMENT=53;
  27.101 +    public static final int ML_COMMENT=54;
  27.102 +    public static final int LITERAL_CHAR=55;
  27.103 +    public static final int ESC=56;
  27.104 +    public static final int XDIGIT=57;
  27.105 +    public static final int NESTED_ARG_ACTION=58;
  27.106 +    public static final int ACTION_STRING_LITERAL=59;
  27.107 +    public static final int ACTION_CHAR_LITERAL=60;
  27.108 +    public static final int NESTED_ACTION=61;
  27.109 +    public static final int ACTION_ESC=62;
  27.110 +    public static final int WS_LOOP=63;
  27.111 +    public static final int WS=64;
  27.112 +
  27.113 +    // delegates
  27.114 +    // delegators
  27.115 +
  27.116 +    public static final String[] ruleNames = new String[] {
  27.117 +        "invalidRule", "rewrite_tree_ebnf", "modifier", "rewrite_indirect_template_head", 
  27.118 +        "grammarType", "rewrite_tree_element", "terminal", "ruleAction", 
  27.119 +        "elementNoOptionSpec", "rewrite_template_args", "tokensSpec", "option", 
  27.120 +        "atom", "altList", "action", "rewrite_tree_block", "optionValue", 
  27.121 +        "rewrite_tree_alternative", "attrScope", "tokenSpec", "rewrite_template", 
  27.122 +        "rewrite_tree", "rewrite", "exceptionGroup", "block", "notTerminal", 
  27.123 +        "exceptionHandler", "notSet", "rewrite_tree_atom", "rewrite_alternative", 
  27.124 +        "ebnfSuffix", "range", "ebnf", "throwsSpec", "optionsSpec", "grammarDef", 
  27.125 +        "alternative", "rewrite_template_ref", "treeSpec", "finallyClause", 
  27.126 +        "element", "ruleScopeSpec", "rewrite_template_arg", "rule"
  27.127 +    };
  27.128 +    public static final boolean[] decisionCanBacktrack = new boolean[] {
  27.129 +        false, // invalid decision
  27.130 +        false, false, false, false, false, false, false, false, false, false, 
  27.131 +            false, false, false, false, false, false, false, false, false, 
  27.132 +            false, false, false, false, false, false, false, false, false, 
  27.133 +            false, false, false, false, false, false, false, false, false, 
  27.134 +            false, false, false, false, false, false, false, false
  27.135 +    };
  27.136 +
  27.137 +     
  27.138 +        public int ruleLevel = 0;
  27.139 +        public int getRuleLevel() { return ruleLevel; }
  27.140 +        public void incRuleLevel() { ruleLevel++; }
  27.141 +        public void decRuleLevel() { ruleLevel--; }
  27.142 +        public ANTLRv3Tree(TreeNodeStream input) {
  27.143 +            this(input, DebugEventSocketProxy.DEFAULT_DEBUGGER_PORT, new RecognizerSharedState());
  27.144 +        }
  27.145 +        public ANTLRv3Tree(TreeNodeStream input, int port, RecognizerSharedState state) {
  27.146 +            super(input, state);
  27.147 +            DebugEventSocketProxy proxy =
  27.148 +                new DebugEventSocketProxy(this, port, input.getTreeAdaptor());
  27.149 +            setDebugListener(proxy);
  27.150 +            try {
  27.151 +                proxy.handshake();
  27.152 +            }
  27.153 +            catch (IOException ioe) {
  27.154 +                reportError(ioe);
  27.155 +            }
  27.156 +        }
  27.157 +    public ANTLRv3Tree(TreeNodeStream input, DebugEventListener dbg) {
  27.158 +        super(input, dbg, new RecognizerSharedState());
  27.159 +
  27.160 +    }
  27.161 +    protected boolean evalPredicate(boolean result, String predicate) {
  27.162 +        dbg.semanticPredicate(result, predicate);
  27.163 +        return result;
  27.164 +    }
  27.165 +
  27.166 +
  27.167 +    public String[] getTokenNames() { return ANTLRv3Tree.tokenNames; }
  27.168 +    public String getGrammarFileName() { return "/Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g"; }
  27.169 +
  27.170 +
  27.171 +
  27.172 +    // $ANTLR start "grammarDef"
  27.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 )+ ) ;
  27.174 +    public final void grammarDef() throws RecognitionException {
  27.175 +        try { dbg.enterRule(getGrammarFileName(), "grammarDef");
  27.176 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.177 +        incRuleLevel();
  27.178 +        dbg.location(41, 1);
  27.179 +
  27.180 +        try {
  27.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 )+ ) )
  27.182 +            dbg.enterAlt(1);
  27.183 +
  27.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 )+ )
  27.185 +            {
  27.186 +            dbg.location(42,9);
  27.187 +            dbg.location(42,12);
  27.188 +            pushFollow(FOLLOW_grammarType_in_grammarDef52);
  27.189 +            grammarType();
  27.190 +
  27.191 +            state._fsp--;
  27.192 +
  27.193 +
  27.194 +            match(input, Token.DOWN, null); 
  27.195 +            dbg.location(42,24);
  27.196 +            match(input,ID,FOLLOW_ID_in_grammarDef54); 
  27.197 +            dbg.location(42,27);
  27.198 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:27: ( DOC_COMMENT )?
  27.199 +            int alt1=2;
  27.200 +            try { dbg.enterSubRule(1);
  27.201 +            try { dbg.enterDecision(1, decisionCanBacktrack[1]);
  27.202 +
  27.203 +            int LA1_0 = input.LA(1);
  27.204 +
  27.205 +            if ( (LA1_0==DOC_COMMENT) ) {
  27.206 +                alt1=1;
  27.207 +            }
  27.208 +            } finally {dbg.exitDecision(1);}
  27.209 +
  27.210 +            switch (alt1) {
  27.211 +                case 1 :
  27.212 +                    dbg.enterAlt(1);
  27.213 +
  27.214 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:27: DOC_COMMENT
  27.215 +                    {
  27.216 +                    dbg.location(42,27);
  27.217 +                    match(input,DOC_COMMENT,FOLLOW_DOC_COMMENT_in_grammarDef56); 
  27.218 +
  27.219 +                    }
  27.220 +                    break;
  27.221 +
  27.222 +            }
  27.223 +            } finally {dbg.exitSubRule(1);}
  27.224 +
  27.225 +            dbg.location(42,40);
  27.226 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:40: ( optionsSpec )?
  27.227 +            int alt2=2;
  27.228 +            try { dbg.enterSubRule(2);
  27.229 +            try { dbg.enterDecision(2, decisionCanBacktrack[2]);
  27.230 +
  27.231 +            int LA2_0 = input.LA(1);
  27.232 +
  27.233 +            if ( (LA2_0==OPTIONS) ) {
  27.234 +                alt2=1;
  27.235 +            }
  27.236 +            } finally {dbg.exitDecision(2);}
  27.237 +
  27.238 +            switch (alt2) {
  27.239 +                case 1 :
  27.240 +                    dbg.enterAlt(1);
  27.241 +
  27.242 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:40: optionsSpec
  27.243 +                    {
  27.244 +                    dbg.location(42,40);
  27.245 +                    pushFollow(FOLLOW_optionsSpec_in_grammarDef59);
  27.246 +                    optionsSpec();
  27.247 +
  27.248 +                    state._fsp--;
  27.249 +
  27.250 +
  27.251 +                    }
  27.252 +                    break;
  27.253 +
  27.254 +            }
  27.255 +            } finally {dbg.exitSubRule(2);}
  27.256 +
  27.257 +            dbg.location(42,53);
  27.258 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:53: ( tokensSpec )?
  27.259 +            int alt3=2;
  27.260 +            try { dbg.enterSubRule(3);
  27.261 +            try { dbg.enterDecision(3, decisionCanBacktrack[3]);
  27.262 +
  27.263 +            int LA3_0 = input.LA(1);
  27.264 +
  27.265 +            if ( (LA3_0==TOKENS) ) {
  27.266 +                alt3=1;
  27.267 +            }
  27.268 +            } finally {dbg.exitDecision(3);}
  27.269 +
  27.270 +            switch (alt3) {
  27.271 +                case 1 :
  27.272 +                    dbg.enterAlt(1);
  27.273 +
  27.274 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:53: tokensSpec
  27.275 +                    {
  27.276 +                    dbg.location(42,53);
  27.277 +                    pushFollow(FOLLOW_tokensSpec_in_grammarDef62);
  27.278 +                    tokensSpec();
  27.279 +
  27.280 +                    state._fsp--;
  27.281 +
  27.282 +
  27.283 +                    }
  27.284 +                    break;
  27.285 +
  27.286 +            }
  27.287 +            } finally {dbg.exitSubRule(3);}
  27.288 +
  27.289 +            dbg.location(42,65);
  27.290 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:65: ( attrScope )*
  27.291 +            try { dbg.enterSubRule(4);
  27.292 +
  27.293 +            loop4:
  27.294 +            do {
  27.295 +                int alt4=2;
  27.296 +                try { dbg.enterDecision(4, decisionCanBacktrack[4]);
  27.297 +
  27.298 +                int LA4_0 = input.LA(1);
  27.299 +
  27.300 +                if ( (LA4_0==SCOPE) ) {
  27.301 +                    alt4=1;
  27.302 +                }
  27.303 +
  27.304 +
  27.305 +                } finally {dbg.exitDecision(4);}
  27.306 +
  27.307 +                switch (alt4) {
  27.308 +            	case 1 :
  27.309 +            	    dbg.enterAlt(1);
  27.310 +
  27.311 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:65: attrScope
  27.312 +            	    {
  27.313 +            	    dbg.location(42,65);
  27.314 +            	    pushFollow(FOLLOW_attrScope_in_grammarDef65);
  27.315 +            	    attrScope();
  27.316 +
  27.317 +            	    state._fsp--;
  27.318 +
  27.319 +
  27.320 +            	    }
  27.321 +            	    break;
  27.322 +
  27.323 +            	default :
  27.324 +            	    break loop4;
  27.325 +                }
  27.326 +            } while (true);
  27.327 +            } finally {dbg.exitSubRule(4);}
  27.328 +
  27.329 +            dbg.location(42,76);
  27.330 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:76: ( action )*
  27.331 +            try { dbg.enterSubRule(5);
  27.332 +
  27.333 +            loop5:
  27.334 +            do {
  27.335 +                int alt5=2;
  27.336 +                try { dbg.enterDecision(5, decisionCanBacktrack[5]);
  27.337 +
  27.338 +                int LA5_0 = input.LA(1);
  27.339 +
  27.340 +                if ( (LA5_0==72) ) {
  27.341 +                    alt5=1;
  27.342 +                }
  27.343 +
  27.344 +
  27.345 +                } finally {dbg.exitDecision(5);}
  27.346 +
  27.347 +                switch (alt5) {
  27.348 +            	case 1 :
  27.349 +            	    dbg.enterAlt(1);
  27.350 +
  27.351 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:76: action
  27.352 +            	    {
  27.353 +            	    dbg.location(42,76);
  27.354 +            	    pushFollow(FOLLOW_action_in_grammarDef68);
  27.355 +            	    action();
  27.356 +
  27.357 +            	    state._fsp--;
  27.358 +
  27.359 +
  27.360 +            	    }
  27.361 +            	    break;
  27.362 +
  27.363 +            	default :
  27.364 +            	    break loop5;
  27.365 +                }
  27.366 +            } while (true);
  27.367 +            } finally {dbg.exitSubRule(5);}
  27.368 +
  27.369 +            dbg.location(42,84);
  27.370 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:84: ( rule )+
  27.371 +            int cnt6=0;
  27.372 +            try { dbg.enterSubRule(6);
  27.373 +
  27.374 +            loop6:
  27.375 +            do {
  27.376 +                int alt6=2;
  27.377 +                try { dbg.enterDecision(6, decisionCanBacktrack[6]);
  27.378 +
  27.379 +                int LA6_0 = input.LA(1);
  27.380 +
  27.381 +                if ( (LA6_0==RULE) ) {
  27.382 +                    alt6=1;
  27.383 +                }
  27.384 +
  27.385 +
  27.386 +                } finally {dbg.exitDecision(6);}
  27.387 +
  27.388 +                switch (alt6) {
  27.389 +            	case 1 :
  27.390 +            	    dbg.enterAlt(1);
  27.391 +
  27.392 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:42:84: rule
  27.393 +            	    {
  27.394 +            	    dbg.location(42,84);
  27.395 +            	    pushFollow(FOLLOW_rule_in_grammarDef71);
  27.396 +            	    rule();
  27.397 +
  27.398 +            	    state._fsp--;
  27.399 +
  27.400 +
  27.401 +            	    }
  27.402 +            	    break;
  27.403 +
  27.404 +            	default :
  27.405 +            	    if ( cnt6 >= 1 ) break loop6;
  27.406 +                        EarlyExitException eee =
  27.407 +                            new EarlyExitException(6, input);
  27.408 +                        dbg.recognitionException(eee);
  27.409 +
  27.410 +                        throw eee;
  27.411 +                }
  27.412 +                cnt6++;
  27.413 +            } while (true);
  27.414 +            } finally {dbg.exitSubRule(6);}
  27.415 +
  27.416 +
  27.417 +            match(input, Token.UP, null); 
  27.418 +
  27.419 +            }
  27.420 +
  27.421 +        }
  27.422 +        catch (RecognitionException re) {
  27.423 +            reportError(re);
  27.424 +            recover(input,re);
  27.425 +        }
  27.426 +        finally {
  27.427 +        }
  27.428 +        dbg.location(43, 5);
  27.429 +
  27.430 +        }
  27.431 +        finally {
  27.432 +            dbg.exitRule(getGrammarFileName(), "grammarDef");
  27.433 +            decRuleLevel();
  27.434 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.435 +        }
  27.436 +
  27.437 +        return ;
  27.438 +    }
  27.439 +    // $ANTLR end "grammarDef"
  27.440 +
  27.441 +
  27.442 +    // $ANTLR start "grammarType"
  27.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 );
  27.444 +    public final void grammarType() throws RecognitionException {
  27.445 +        try { dbg.enterRule(getGrammarFileName(), "grammarType");
  27.446 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.447 +        incRuleLevel();
  27.448 +        dbg.location(45, 1);
  27.449 +
  27.450 +        try {
  27.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 )
  27.452 +            dbg.enterAlt(1);
  27.453 +
  27.454 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
  27.455 +            {
  27.456 +            dbg.location(46,2);
  27.457 +            if ( (input.LA(1)>=LEXER_GRAMMAR && input.LA(1)<=COMBINED_GRAMMAR) ) {
  27.458 +                input.consume();
  27.459 +                state.errorRecovery=false;
  27.460 +            }
  27.461 +            else {
  27.462 +                MismatchedSetException mse = new MismatchedSetException(null,input);
  27.463 +                dbg.recognitionException(mse);
  27.464 +                throw mse;
  27.465 +            }
  27.466 +
  27.467 +
  27.468 +            }
  27.469 +
  27.470 +        }
  27.471 +        catch (RecognitionException re) {
  27.472 +            reportError(re);
  27.473 +            recover(input,re);
  27.474 +        }
  27.475 +        finally {
  27.476 +        }
  27.477 +        dbg.location(50, 5);
  27.478 +
  27.479 +        }
  27.480 +        finally {
  27.481 +            dbg.exitRule(getGrammarFileName(), "grammarType");
  27.482 +            decRuleLevel();
  27.483 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.484 +        }
  27.485 +
  27.486 +        return ;
  27.487 +    }
  27.488 +    // $ANTLR end "grammarType"
  27.489 +
  27.490 +
  27.491 +    // $ANTLR start "tokensSpec"
  27.492 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:52:1: tokensSpec : ^( TOKENS ( tokenSpec )+ ) ;
  27.493 +    public final void tokensSpec() throws RecognitionException {
  27.494 +        try { dbg.enterRule(getGrammarFileName(), "tokensSpec");
  27.495 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.496 +        incRuleLevel();
  27.497 +        dbg.location(52, 1);
  27.498 +
  27.499 +        try {
  27.500 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:2: ( ^( TOKENS ( tokenSpec )+ ) )
  27.501 +            dbg.enterAlt(1);
  27.502 +
  27.503 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:4: ^( TOKENS ( tokenSpec )+ )
  27.504 +            {
  27.505 +            dbg.location(53,4);
  27.506 +            dbg.location(53,6);
  27.507 +            match(input,TOKENS,FOLLOW_TOKENS_in_tokensSpec127); 
  27.508 +
  27.509 +            match(input, Token.DOWN, null); 
  27.510 +            dbg.location(53,13);
  27.511 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:13: ( tokenSpec )+
  27.512 +            int cnt7=0;
  27.513 +            try { dbg.enterSubRule(7);
  27.514 +
  27.515 +            loop7:
  27.516 +            do {
  27.517 +                int alt7=2;
  27.518 +                try { dbg.enterDecision(7, decisionCanBacktrack[7]);
  27.519 +
  27.520 +                int LA7_0 = input.LA(1);
  27.521 +
  27.522 +                if ( (LA7_0==TOKEN_REF||LA7_0==71) ) {
  27.523 +                    alt7=1;
  27.524 +                }
  27.525 +
  27.526 +
  27.527 +                } finally {dbg.exitDecision(7);}
  27.528 +
  27.529 +                switch (alt7) {
  27.530 +            	case 1 :
  27.531 +            	    dbg.enterAlt(1);
  27.532 +
  27.533 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:53:13: tokenSpec
  27.534 +            	    {
  27.535 +            	    dbg.location(53,13);
  27.536 +            	    pushFollow(FOLLOW_tokenSpec_in_tokensSpec129);
  27.537 +            	    tokenSpec();
  27.538 +
  27.539 +            	    state._fsp--;
  27.540 +
  27.541 +
  27.542 +            	    }
  27.543 +            	    break;
  27.544 +
  27.545 +            	default :
  27.546 +            	    if ( cnt7 >= 1 ) break loop7;
  27.547 +                        EarlyExitException eee =
  27.548 +                            new EarlyExitException(7, input);
  27.549 +                        dbg.recognitionException(eee);
  27.550 +
  27.551 +                        throw eee;
  27.552 +                }
  27.553 +                cnt7++;
  27.554 +            } while (true);
  27.555 +            } finally {dbg.exitSubRule(7);}
  27.556 +
  27.557 +
  27.558 +            match(input, Token.UP, null); 
  27.559 +
  27.560 +            }
  27.561 +
  27.562 +        }
  27.563 +        catch (RecognitionException re) {
  27.564 +            reportError(re);
  27.565 +            recover(input,re);
  27.566 +        }
  27.567 +        finally {
  27.568 +        }
  27.569 +        dbg.location(54, 2);
  27.570 +
  27.571 +        }
  27.572 +        finally {
  27.573 +            dbg.exitRule(getGrammarFileName(), "tokensSpec");
  27.574 +            decRuleLevel();
  27.575 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.576 +        }
  27.577 +
  27.578 +        return ;
  27.579 +    }
  27.580 +    // $ANTLR end "tokensSpec"
  27.581 +
  27.582 +
  27.583 +    // $ANTLR start "tokenSpec"
  27.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 );
  27.585 +    public final void tokenSpec() throws RecognitionException {
  27.586 +        try { dbg.enterRule(getGrammarFileName(), "tokenSpec");
  27.587 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.588 +        incRuleLevel();
  27.589 +        dbg.location(56, 1);
  27.590 +
  27.591 +        try {
  27.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 )
  27.593 +            int alt8=3;
  27.594 +            try { dbg.enterDecision(8, decisionCanBacktrack[8]);
  27.595 +
  27.596 +            int LA8_0 = input.LA(1);
  27.597 +
  27.598 +            if ( (LA8_0==71) ) {
  27.599 +                int LA8_1 = input.LA(2);
  27.600 +
  27.601 +                if ( (LA8_1==DOWN) ) {
  27.602 +                    int LA8_3 = input.LA(3);
  27.603 +
  27.604 +                    if ( (LA8_3==TOKEN_REF) ) {
  27.605 +                        int LA8_4 = input.LA(4);
  27.606 +
  27.607 +                        if ( (LA8_4==STRING_LITERAL) ) {
  27.608 +                            alt8=1;
  27.609 +                        }
  27.610 +                        else if ( (LA8_4==CHAR_LITERAL) ) {
  27.611 +                            alt8=2;
  27.612 +                        }
  27.613 +                        else {
  27.614 +                            NoViableAltException nvae =
  27.615 +                                new NoViableAltException("", 8, 4, input);
  27.616 +
  27.617 +                            dbg.recognitionException(nvae);
  27.618 +                            throw nvae;
  27.619 +                        }
  27.620 +                    }
  27.621 +                    else {
  27.622 +                        NoViableAltException nvae =
  27.623 +                            new NoViableAltException("", 8, 3, input);
  27.624 +
  27.625 +                        dbg.recognitionException(nvae);
  27.626 +                        throw nvae;
  27.627 +                    }
  27.628 +                }
  27.629 +                else {
  27.630 +                    NoViableAltException nvae =
  27.631 +                        new NoViableAltException("", 8, 1, input);
  27.632 +
  27.633 +                    dbg.recognitionException(nvae);
  27.634 +                    throw nvae;
  27.635 +                }
  27.636 +            }
  27.637 +            else if ( (LA8_0==TOKEN_REF) ) {
  27.638 +                alt8=3;
  27.639 +            }
  27.640 +            else {
  27.641 +                NoViableAltException nvae =
  27.642 +                    new NoViableAltException("", 8, 0, input);
  27.643 +
  27.644 +                dbg.recognitionException(nvae);
  27.645 +                throw nvae;
  27.646 +            }
  27.647 +            } finally {dbg.exitDecision(8);}
  27.648 +
  27.649 +            switch (alt8) {
  27.650 +                case 1 :
  27.651 +                    dbg.enterAlt(1);
  27.652 +
  27.653 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:57:4: ^( '=' TOKEN_REF STRING_LITERAL )
  27.654 +                    {
  27.655 +                    dbg.location(57,4);
  27.656 +                    dbg.location(57,6);
  27.657 +                    match(input,71,FOLLOW_71_in_tokenSpec143); 
  27.658 +
  27.659 +                    match(input, Token.DOWN, null); 
  27.660 +                    dbg.location(57,10);
  27.661 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec145); 
  27.662 +                    dbg.location(57,20);
  27.663 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenSpec147); 
  27.664 +
  27.665 +                    match(input, Token.UP, null); 
  27.666 +
  27.667 +                    }
  27.668 +                    break;
  27.669 +                case 2 :
  27.670 +                    dbg.enterAlt(2);
  27.671 +
  27.672 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:58:4: ^( '=' TOKEN_REF CHAR_LITERAL )
  27.673 +                    {
  27.674 +                    dbg.location(58,4);
  27.675 +                    dbg.location(58,6);
  27.676 +                    match(input,71,FOLLOW_71_in_tokenSpec154); 
  27.677 +
  27.678 +                    match(input, Token.DOWN, null); 
  27.679 +                    dbg.location(58,10);
  27.680 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec156); 
  27.681 +                    dbg.location(58,20);
  27.682 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_tokenSpec158); 
  27.683 +
  27.684 +                    match(input, Token.UP, null); 
  27.685 +
  27.686 +                    }
  27.687 +                    break;
  27.688 +                case 3 :
  27.689 +                    dbg.enterAlt(3);
  27.690 +
  27.691 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:59:4: TOKEN_REF
  27.692 +                    {
  27.693 +                    dbg.location(59,4);
  27.694 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec164); 
  27.695 +
  27.696 +                    }
  27.697 +                    break;
  27.698 +
  27.699 +            }
  27.700 +        }
  27.701 +        catch (RecognitionException re) {
  27.702 +            reportError(re);
  27.703 +            recover(input,re);
  27.704 +        }
  27.705 +        finally {
  27.706 +        }
  27.707 +        dbg.location(60, 2);
  27.708 +
  27.709 +        }
  27.710 +        finally {
  27.711 +            dbg.exitRule(getGrammarFileName(), "tokenSpec");
  27.712 +            decRuleLevel();
  27.713 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.714 +        }
  27.715 +
  27.716 +        return ;
  27.717 +    }
  27.718 +    // $ANTLR end "tokenSpec"
  27.719 +
  27.720 +
  27.721 +    // $ANTLR start "attrScope"
  27.722 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:62:1: attrScope : ^( 'scope' ID ACTION ) ;
  27.723 +    public final void attrScope() throws RecognitionException {
  27.724 +        try { dbg.enterRule(getGrammarFileName(), "attrScope");
  27.725 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.726 +        incRuleLevel();
  27.727 +        dbg.location(62, 1);
  27.728 +
  27.729 +        try {
  27.730 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:63:2: ( ^( 'scope' ID ACTION ) )
  27.731 +            dbg.enterAlt(1);
  27.732 +
  27.733 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:63:4: ^( 'scope' ID ACTION )
  27.734 +            {
  27.735 +            dbg.location(63,4);
  27.736 +            dbg.location(63,6);
  27.737 +            match(input,SCOPE,FOLLOW_SCOPE_in_attrScope176); 
  27.738 +
  27.739 +            match(input, Token.DOWN, null); 
  27.740 +            dbg.location(63,14);
  27.741 +            match(input,ID,FOLLOW_ID_in_attrScope178); 
  27.742 +            dbg.location(63,17);
  27.743 +            match(input,ACTION,FOLLOW_ACTION_in_attrScope180); 
  27.744 +
  27.745 +            match(input, Token.UP, null); 
  27.746 +
  27.747 +            }
  27.748 +
  27.749 +        }
  27.750 +        catch (RecognitionException re) {
  27.751 +            reportError(re);
  27.752 +            recover(input,re);
  27.753 +        }
  27.754 +        finally {
  27.755 +        }
  27.756 +        dbg.location(64, 2);
  27.757 +
  27.758 +        }
  27.759 +        finally {
  27.760 +            dbg.exitRule(getGrammarFileName(), "attrScope");
  27.761 +            decRuleLevel();
  27.762 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.763 +        }
  27.764 +
  27.765 +        return ;
  27.766 +    }
  27.767 +    // $ANTLR end "attrScope"
  27.768 +
  27.769 +
  27.770 +    // $ANTLR start "action"
  27.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 ) );
  27.772 +    public final void action() throws RecognitionException {
  27.773 +        try { dbg.enterRule(getGrammarFileName(), "action");
  27.774 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.775 +        incRuleLevel();
  27.776 +        dbg.location(66, 1);
  27.777 +
  27.778 +        try {
  27.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 ) )
  27.780 +            int alt9=2;
  27.781 +            try { dbg.enterDecision(9, decisionCanBacktrack[9]);
  27.782 +
  27.783 +            int LA9_0 = input.LA(1);
  27.784 +
  27.785 +            if ( (LA9_0==72) ) {
  27.786 +                int LA9_1 = input.LA(2);
  27.787 +
  27.788 +                if ( (LA9_1==DOWN) ) {
  27.789 +                    int LA9_2 = input.LA(3);
  27.790 +
  27.791 +                    if ( (LA9_2==ID) ) {
  27.792 +                        int LA9_3 = input.LA(4);
  27.793 +
  27.794 +                        if ( (LA9_3==ID) ) {
  27.795 +                            alt9=1;
  27.796 +                        }
  27.797 +                        else if ( (LA9_3==ACTION) ) {
  27.798 +                            alt9=2;
  27.799 +                        }
  27.800 +                        else {
  27.801 +                            NoViableAltException nvae =
  27.802 +                                new NoViableAltException("", 9, 3, input);
  27.803 +
  27.804 +                            dbg.recognitionException(nvae);
  27.805 +                            throw nvae;
  27.806 +                        }
  27.807 +                    }
  27.808 +                    else {
  27.809 +                        NoViableAltException nvae =
  27.810 +                            new NoViableAltException("", 9, 2, input);
  27.811 +
  27.812 +                        dbg.recognitionException(nvae);
  27.813 +                        throw nvae;
  27.814 +                    }
  27.815 +                }
  27.816 +                else {
  27.817 +                    NoViableAltException nvae =
  27.818 +                        new NoViableAltException("", 9, 1, input);
  27.819 +
  27.820 +                    dbg.recognitionException(nvae);
  27.821 +                    throw nvae;
  27.822 +                }
  27.823 +            }
  27.824 +            else {
  27.825 +                NoViableAltException nvae =
  27.826 +                    new NoViableAltException("", 9, 0, input);
  27.827 +
  27.828 +                dbg.recognitionException(nvae);
  27.829 +                throw nvae;
  27.830 +            }
  27.831 +            } finally {dbg.exitDecision(9);}
  27.832 +
  27.833 +            switch (alt9) {
  27.834 +                case 1 :
  27.835 +                    dbg.enterAlt(1);
  27.836 +
  27.837 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:67:4: ^( '@' ID ID ACTION )
  27.838 +                    {
  27.839 +                    dbg.location(67,4);
  27.840 +                    dbg.location(67,6);
  27.841 +                    match(input,72,FOLLOW_72_in_action193); 
  27.842 +
  27.843 +                    match(input, Token.DOWN, null); 
  27.844 +                    dbg.location(67,10);
  27.845 +                    match(input,ID,FOLLOW_ID_in_action195); 
  27.846 +                    dbg.location(67,13);
  27.847 +                    match(input,ID,FOLLOW_ID_in_action197); 
  27.848 +                    dbg.location(67,16);
  27.849 +                    match(input,ACTION,FOLLOW_ACTION_in_action199); 
  27.850 +
  27.851 +                    match(input, Token.UP, null); 
  27.852 +
  27.853 +                    }
  27.854 +                    break;
  27.855 +                case 2 :
  27.856 +                    dbg.enterAlt(2);
  27.857 +
  27.858 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:68:4: ^( '@' ID ACTION )
  27.859 +                    {
  27.860 +                    dbg.location(68,4);
  27.861 +                    dbg.location(68,6);
  27.862 +                    match(input,72,FOLLOW_72_in_action206); 
  27.863 +
  27.864 +                    match(input, Token.DOWN, null); 
  27.865 +                    dbg.location(68,10);
  27.866 +                    match(input,ID,FOLLOW_ID_in_action208); 
  27.867 +                    dbg.location(68,13);
  27.868 +                    match(input,ACTION,FOLLOW_ACTION_in_action210); 
  27.869 +
  27.870 +                    match(input, Token.UP, null); 
  27.871 +
  27.872 +                    }
  27.873 +                    break;
  27.874 +
  27.875 +            }
  27.876 +        }
  27.877 +        catch (RecognitionException re) {
  27.878 +            reportError(re);
  27.879 +            recover(input,re);
  27.880 +        }
  27.881 +        finally {
  27.882 +        }
  27.883 +        dbg.location(69, 2);
  27.884 +
  27.885 +        }
  27.886 +        finally {
  27.887 +            dbg.exitRule(getGrammarFileName(), "action");
  27.888 +            decRuleLevel();
  27.889 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.890 +        }
  27.891 +
  27.892 +        return ;
  27.893 +    }
  27.894 +    // $ANTLR end "action"
  27.895 +
  27.896 +
  27.897 +    // $ANTLR start "optionsSpec"
  27.898 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:71:1: optionsSpec : ^( OPTIONS ( option )+ ) ;
  27.899 +    public final void optionsSpec() throws RecognitionException {
  27.900 +        try { dbg.enterRule(getGrammarFileName(), "optionsSpec");
  27.901 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.902 +        incRuleLevel();
  27.903 +        dbg.location(71, 1);
  27.904 +
  27.905 +        try {
  27.906 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:2: ( ^( OPTIONS ( option )+ ) )
  27.907 +            dbg.enterAlt(1);
  27.908 +
  27.909 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:4: ^( OPTIONS ( option )+ )
  27.910 +            {
  27.911 +            dbg.location(72,4);
  27.912 +            dbg.location(72,6);
  27.913 +            match(input,OPTIONS,FOLLOW_OPTIONS_in_optionsSpec223); 
  27.914 +
  27.915 +            match(input, Token.DOWN, null); 
  27.916 +            dbg.location(72,14);
  27.917 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:14: ( option )+
  27.918 +            int cnt10=0;
  27.919 +            try { dbg.enterSubRule(10);
  27.920 +
  27.921 +            loop10:
  27.922 +            do {
  27.923 +                int alt10=2;
  27.924 +                try { dbg.enterDecision(10, decisionCanBacktrack[10]);
  27.925 +
  27.926 +                int LA10_0 = input.LA(1);
  27.927 +
  27.928 +                if ( (LA10_0==71) ) {
  27.929 +                    alt10=1;
  27.930 +                }
  27.931 +
  27.932 +
  27.933 +                } finally {dbg.exitDecision(10);}
  27.934 +
  27.935 +                switch (alt10) {
  27.936 +            	case 1 :
  27.937 +            	    dbg.enterAlt(1);
  27.938 +
  27.939 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:72:14: option
  27.940 +            	    {
  27.941 +            	    dbg.location(72,14);
  27.942 +            	    pushFollow(FOLLOW_option_in_optionsSpec225);
  27.943 +            	    option();
  27.944 +
  27.945 +            	    state._fsp--;
  27.946 +
  27.947 +
  27.948 +            	    }
  27.949 +            	    break;
  27.950 +
  27.951 +            	default :
  27.952 +            	    if ( cnt10 >= 1 ) break loop10;
  27.953 +                        EarlyExitException eee =
  27.954 +                            new EarlyExitException(10, input);
  27.955 +                        dbg.recognitionException(eee);
  27.956 +
  27.957 +                        throw eee;
  27.958 +                }
  27.959 +                cnt10++;
  27.960 +            } while (true);
  27.961 +            } finally {dbg.exitSubRule(10);}
  27.962 +
  27.963 +
  27.964 +            match(input, Token.UP, null); 
  27.965 +
  27.966 +            }
  27.967 +
  27.968 +        }
  27.969 +        catch (RecognitionException re) {
  27.970 +            reportError(re);
  27.971 +            recover(input,re);
  27.972 +        }
  27.973 +        finally {
  27.974 +        }
  27.975 +        dbg.location(73, 2);
  27.976 +
  27.977 +        }
  27.978 +        finally {
  27.979 +            dbg.exitRule(getGrammarFileName(), "optionsSpec");
  27.980 +            decRuleLevel();
  27.981 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
  27.982 +        }
  27.983 +
  27.984 +        return ;
  27.985 +    }
  27.986 +    // $ANTLR end "optionsSpec"
  27.987 +
  27.988 +
  27.989 +    // $ANTLR start "option"
  27.990 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:75:1: option : ^( '=' ID optionValue ) ;
  27.991 +    public final void option() throws RecognitionException {
  27.992 +        try { dbg.enterRule(getGrammarFileName(), "option");
  27.993 +        if ( getRuleLevel()==0 ) {dbg.commence();}
  27.994 +        incRuleLevel();
  27.995 +        dbg.location(75, 1);
  27.996 +
  27.997 +        try {
  27.998 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:76:5: ( ^( '=' ID optionValue ) )
  27.999 +            dbg.enterAlt(1);
 27.1000 +
 27.1001 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:76:9: ^( '=' ID optionValue )
 27.1002 +            {
 27.1003 +            dbg.location(76,9);
 27.1004 +            dbg.location(76,11);
 27.1005 +            match(input,71,FOLLOW_71_in_option244); 
 27.1006 +
 27.1007 +            match(input, Token.DOWN, null); 
 27.1008 +            dbg.location(76,15);
 27.1009 +            match(input,ID,FOLLOW_ID_in_option246); 
 27.1010 +            dbg.location(76,18);
 27.1011 +            pushFollow(FOLLOW_optionValue_in_option248);
 27.1012 +            optionValue();
 27.1013 +
 27.1014 +            state._fsp--;
 27.1015 +
 27.1016 +
 27.1017 +            match(input, Token.UP, null); 
 27.1018 +
 27.1019 +            }
 27.1020 +
 27.1021 +        }
 27.1022 +        catch (RecognitionException re) {
 27.1023 +            reportError(re);
 27.1024 +            recover(input,re);
 27.1025 +        }
 27.1026 +        finally {
 27.1027 +        }
 27.1028 +        dbg.location(77, 3);
 27.1029 +
 27.1030 +        }
 27.1031 +        finally {
 27.1032 +            dbg.exitRule(getGrammarFileName(), "option");
 27.1033 +            decRuleLevel();
 27.1034 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1035 +        }
 27.1036 +
 27.1037 +        return ;
 27.1038 +    }
 27.1039 +    // $ANTLR end "option"
 27.1040 +
 27.1041 +
 27.1042 +    // $ANTLR start "optionValue"
 27.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 );
 27.1044 +    public final void optionValue() throws RecognitionException {
 27.1045 +        try { dbg.enterRule(getGrammarFileName(), "optionValue");
 27.1046 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1047 +        incRuleLevel();
 27.1048 +        dbg.location(79, 1);
 27.1049 +
 27.1050 +        try {
 27.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 )
 27.1052 +            dbg.enterAlt(1);
 27.1053 +
 27.1054 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 27.1055 +            {
 27.1056 +            dbg.location(80,5);
 27.1057 +            if ( input.LA(1)==ID||(input.LA(1)>=STRING_LITERAL && input.LA(1)<=CHAR_LITERAL)||input.LA(1)==INT ) {
 27.1058 +                input.consume();
 27.1059 +                state.errorRecovery=false;
 27.1060 +            }
 27.1061 +            else {
 27.1062 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 27.1063 +                dbg.recognitionException(mse);
 27.1064 +                throw mse;
 27.1065 +            }
 27.1066 +
 27.1067 +
 27.1068 +            }
 27.1069 +
 27.1070 +        }
 27.1071 +        catch (RecognitionException re) {
 27.1072 +            reportError(re);
 27.1073 +            recover(input,re);
 27.1074 +        }
 27.1075 +        finally {
 27.1076 +        }
 27.1077 +        dbg.location(84, 5);
 27.1078 +
 27.1079 +        }
 27.1080 +        finally {
 27.1081 +            dbg.exitRule(getGrammarFileName(), "optionValue");
 27.1082 +            decRuleLevel();
 27.1083 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1084 +        }
 27.1085 +
 27.1086 +        return ;
 27.1087 +    }
 27.1088 +    // $ANTLR end "optionValue"
 27.1089 +
 27.1090 +
 27.1091 +    // $ANTLR start "rule"
 27.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 ) ;
 27.1093 +    public final void rule() throws RecognitionException {
 27.1094 +        try { dbg.enterRule(getGrammarFileName(), "rule");
 27.1095 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1096 +        incRuleLevel();
 27.1097 +        dbg.location(86, 1);
 27.1098 +
 27.1099 +        try {
 27.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 ) )
 27.1101 +            dbg.enterAlt(1);
 27.1102 +
 27.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 )
 27.1104 +            {
 27.1105 +            dbg.location(87,4);
 27.1106 +            dbg.location(87,7);
 27.1107 +            match(input,RULE,FOLLOW_RULE_in_rule314); 
 27.1108 +
 27.1109 +            match(input, Token.DOWN, null); 
 27.1110 +            dbg.location(87,12);
 27.1111 +            match(input,ID,FOLLOW_ID_in_rule316); 
 27.1112 +            dbg.location(87,15);
 27.1113 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:15: ( modifier )?
 27.1114 +            int alt11=2;
 27.1115 +            try { dbg.enterSubRule(11);
 27.1116 +            try { dbg.enterDecision(11, decisionCanBacktrack[11]);
 27.1117 +
 27.1118 +            int LA11_0 = input.LA(1);
 27.1119 +
 27.1120 +            if ( (LA11_0==FRAGMENT||(LA11_0>=75 && LA11_0<=77)) ) {
 27.1121 +                alt11=1;
 27.1122 +            }
 27.1123 +            } finally {dbg.exitDecision(11);}
 27.1124 +
 27.1125 +            switch (alt11) {
 27.1126 +                case 1 :
 27.1127 +                    dbg.enterAlt(1);
 27.1128 +
 27.1129 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:15: modifier
 27.1130 +                    {
 27.1131 +                    dbg.location(87,15);
 27.1132 +                    pushFollow(FOLLOW_modifier_in_rule318);
 27.1133 +                    modifier();
 27.1134 +
 27.1135 +                    state._fsp--;
 27.1136 +
 27.1137 +
 27.1138 +                    }
 27.1139 +                    break;
 27.1140 +
 27.1141 +            }
 27.1142 +            } finally {dbg.exitSubRule(11);}
 27.1143 +
 27.1144 +            dbg.location(87,25);
 27.1145 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:25: ( ^( ARG ARG_ACTION ) )?
 27.1146 +            int alt12=2;
 27.1147 +            try { dbg.enterSubRule(12);
 27.1148 +            try { dbg.enterDecision(12, decisionCanBacktrack[12]);
 27.1149 +
 27.1150 +            int LA12_0 = input.LA(1);
 27.1151 +
 27.1152 +            if ( (LA12_0==ARG) ) {
 27.1153 +                alt12=1;
 27.1154 +            }
 27.1155 +            } finally {dbg.exitDecision(12);}
 27.1156 +
 27.1157 +            switch (alt12) {
 27.1158 +                case 1 :
 27.1159 +                    dbg.enterAlt(1);
 27.1160 +
 27.1161 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:26: ^( ARG ARG_ACTION )
 27.1162 +                    {
 27.1163 +                    dbg.location(87,26);
 27.1164 +                    dbg.location(87,28);
 27.1165 +                    match(input,ARG,FOLLOW_ARG_in_rule323); 
 27.1166 +
 27.1167 +                    match(input, Token.DOWN, null); 
 27.1168 +                    dbg.location(87,32);
 27.1169 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule325); 
 27.1170 +
 27.1171 +                    match(input, Token.UP, null); 
 27.1172 +
 27.1173 +                    }
 27.1174 +                    break;
 27.1175 +
 27.1176 +            }
 27.1177 +            } finally {dbg.exitSubRule(12);}
 27.1178 +
 27.1179 +            dbg.location(87,46);
 27.1180 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:46: ( ^( RET ARG_ACTION ) )?
 27.1181 +            int alt13=2;
 27.1182 +            try { dbg.enterSubRule(13);
 27.1183 +            try { dbg.enterDecision(13, decisionCanBacktrack[13]);
 27.1184 +
 27.1185 +            int LA13_0 = input.LA(1);
 27.1186 +
 27.1187 +            if ( (LA13_0==RET) ) {
 27.1188 +                alt13=1;
 27.1189 +            }
 27.1190 +            } finally {dbg.exitDecision(13);}
 27.1191 +
 27.1192 +            switch (alt13) {
 27.1193 +                case 1 :
 27.1194 +                    dbg.enterAlt(1);
 27.1195 +
 27.1196 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:87:47: ^( RET ARG_ACTION )
 27.1197 +                    {
 27.1198 +                    dbg.location(87,47);
 27.1199 +                    dbg.location(87,49);
 27.1200 +                    match(input,RET,FOLLOW_RET_in_rule332); 
 27.1201 +
 27.1202 +                    match(input, Token.DOWN, null); 
 27.1203 +                    dbg.location(87,53);
 27.1204 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rule334); 
 27.1205 +
 27.1206 +                    match(input, Token.UP, null); 
 27.1207 +
 27.1208 +                    }
 27.1209 +                    break;
 27.1210 +
 27.1211 +            }
 27.1212 +            } finally {dbg.exitSubRule(13);}
 27.1213 +
 27.1214 +            dbg.location(88,9);
 27.1215 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:9: ( optionsSpec )?
 27.1216 +            int alt14=2;
 27.1217 +            try { dbg.enterSubRule(14);
 27.1218 +            try { dbg.enterDecision(14, decisionCanBacktrack[14]);
 27.1219 +
 27.1220 +            int LA14_0 = input.LA(1);
 27.1221 +
 27.1222 +            if ( (LA14_0==OPTIONS) ) {
 27.1223 +                alt14=1;
 27.1224 +            }
 27.1225 +            } finally {dbg.exitDecision(14);}
 27.1226 +
 27.1227 +            switch (alt14) {
 27.1228 +                case 1 :
 27.1229 +                    dbg.enterAlt(1);
 27.1230 +
 27.1231 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:9: optionsSpec
 27.1232 +                    {
 27.1233 +                    dbg.location(88,9);
 27.1234 +                    pushFollow(FOLLOW_optionsSpec_in_rule347);
 27.1235 +                    optionsSpec();
 27.1236 +
 27.1237 +                    state._fsp--;
 27.1238 +
 27.1239 +
 27.1240 +                    }
 27.1241 +                    break;
 27.1242 +
 27.1243 +            }
 27.1244 +            } finally {dbg.exitSubRule(14);}
 27.1245 +
 27.1246 +            dbg.location(88,22);
 27.1247 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:22: ( ruleScopeSpec )?
 27.1248 +            int alt15=2;
 27.1249 +            try { dbg.enterSubRule(15);
 27.1250 +            try { dbg.enterDecision(15, decisionCanBacktrack[15]);
 27.1251 +
 27.1252 +            int LA15_0 = input.LA(1);
 27.1253 +
 27.1254 +            if ( (LA15_0==SCOPE) ) {
 27.1255 +                alt15=1;
 27.1256 +            }
 27.1257 +            } finally {dbg.exitDecision(15);}
 27.1258 +
 27.1259 +            switch (alt15) {
 27.1260 +                case 1 :
 27.1261 +                    dbg.enterAlt(1);
 27.1262 +
 27.1263 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:22: ruleScopeSpec
 27.1264 +                    {
 27.1265 +                    dbg.location(88,22);
 27.1266 +                    pushFollow(FOLLOW_ruleScopeSpec_in_rule350);
 27.1267 +                    ruleScopeSpec();
 27.1268 +
 27.1269 +                    state._fsp--;
 27.1270 +
 27.1271 +
 27.1272 +                    }
 27.1273 +                    break;
 27.1274 +
 27.1275 +            }
 27.1276 +            } finally {dbg.exitSubRule(15);}
 27.1277 +
 27.1278 +            dbg.location(88,37);
 27.1279 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:37: ( ruleAction )*
 27.1280 +            try { dbg.enterSubRule(16);
 27.1281 +
 27.1282 +            loop16:
 27.1283 +            do {
 27.1284 +                int alt16=2;
 27.1285 +                try { dbg.enterDecision(16, decisionCanBacktrack[16]);
 27.1286 +
 27.1287 +                int LA16_0 = input.LA(1);
 27.1288 +
 27.1289 +                if ( (LA16_0==72) ) {
 27.1290 +                    alt16=1;
 27.1291 +                }
 27.1292 +
 27.1293 +
 27.1294 +                } finally {dbg.exitDecision(16);}
 27.1295 +
 27.1296 +                switch (alt16) {
 27.1297 +            	case 1 :
 27.1298 +            	    dbg.enterAlt(1);
 27.1299 +
 27.1300 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:88:37: ruleAction
 27.1301 +            	    {
 27.1302 +            	    dbg.location(88,37);
 27.1303 +            	    pushFollow(FOLLOW_ruleAction_in_rule353);
 27.1304 +            	    ruleAction();
 27.1305 +
 27.1306 +            	    state._fsp--;
 27.1307 +
 27.1308 +
 27.1309 +            	    }
 27.1310 +            	    break;
 27.1311 +
 27.1312 +            	default :
 27.1313 +            	    break loop16;
 27.1314 +                }
 27.1315 +            } while (true);
 27.1316 +            } finally {dbg.exitSubRule(16);}
 27.1317 +
 27.1318 +            dbg.location(89,9);
 27.1319 +            pushFollow(FOLLOW_altList_in_rule364);
 27.1320 +            altList();
 27.1321 +
 27.1322 +            state._fsp--;
 27.1323 +
 27.1324 +            dbg.location(90,9);
 27.1325 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:90:9: ( exceptionGroup )?
 27.1326 +            int alt17=2;
 27.1327 +            try { dbg.enterSubRule(17);
 27.1328 +            try { dbg.enterDecision(17, decisionCanBacktrack[17]);
 27.1329 +
 27.1330 +            int LA17_0 = input.LA(1);
 27.1331 +
 27.1332 +            if ( ((LA17_0>=85 && LA17_0<=86)) ) {
 27.1333 +                alt17=1;
 27.1334 +            }
 27.1335 +            } finally {dbg.exitDecision(17);}
 27.1336 +
 27.1337 +            switch (alt17) {
 27.1338 +                case 1 :
 27.1339 +                    dbg.enterAlt(1);
 27.1340 +
 27.1341 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:90:9: exceptionGroup
 27.1342 +                    {
 27.1343 +                    dbg.location(90,9);
 27.1344 +                    pushFollow(FOLLOW_exceptionGroup_in_rule374);
 27.1345 +                    exceptionGroup();
 27.1346 +
 27.1347 +                    state._fsp--;
 27.1348 +
 27.1349 +
 27.1350 +                    }
 27.1351 +                    break;
 27.1352 +
 27.1353 +            }
 27.1354 +            } finally {dbg.exitSubRule(17);}
 27.1355 +
 27.1356 +            dbg.location(90,25);
 27.1357 +            match(input,EOR,FOLLOW_EOR_in_rule377); 
 27.1358 +
 27.1359 +            match(input, Token.UP, null); 
 27.1360 +
 27.1361 +            }
 27.1362 +
 27.1363 +        }
 27.1364 +        catch (RecognitionException re) {
 27.1365 +            reportError(re);
 27.1366 +            recover(input,re);
 27.1367 +        }
 27.1368 +        finally {
 27.1369 +        }
 27.1370 +        dbg.location(92, 2);
 27.1371 +
 27.1372 +        }
 27.1373 +        finally {
 27.1374 +            dbg.exitRule(getGrammarFileName(), "rule");
 27.1375 +            decRuleLevel();
 27.1376 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1377 +        }
 27.1378 +
 27.1379 +        return ;
 27.1380 +    }
 27.1381 +    // $ANTLR end "rule"
 27.1382 +
 27.1383 +
 27.1384 +    // $ANTLR start "modifier"
 27.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' );
 27.1386 +    public final void modifier() throws RecognitionException {
 27.1387 +        try { dbg.enterRule(getGrammarFileName(), "modifier");
 27.1388 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1389 +        incRuleLevel();
 27.1390 +        dbg.location(94, 1);
 27.1391 +
 27.1392 +        try {
 27.1393 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:95:2: ( 'protected' | 'public' | 'private' | 'fragment' )
 27.1394 +            dbg.enterAlt(1);
 27.1395 +
 27.1396 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 27.1397 +            {
 27.1398 +            dbg.location(95,2);
 27.1399 +            if ( input.LA(1)==FRAGMENT||(input.LA(1)>=75 && input.LA(1)<=77) ) {
 27.1400 +                input.consume();
 27.1401 +                state.errorRecovery=false;
 27.1402 +            }
 27.1403 +            else {
 27.1404 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 27.1405 +                dbg.recognitionException(mse);
 27.1406 +                throw mse;
 27.1407 +            }
 27.1408 +
 27.1409 +
 27.1410 +            }
 27.1411 +
 27.1412 +        }
 27.1413 +        catch (RecognitionException re) {
 27.1414 +            reportError(re);
 27.1415 +            recover(input,re);
 27.1416 +        }
 27.1417 +        finally {
 27.1418 +        }
 27.1419 +        dbg.location(96, 2);
 27.1420 +
 27.1421 +        }
 27.1422 +        finally {
 27.1423 +            dbg.exitRule(getGrammarFileName(), "modifier");
 27.1424 +            decRuleLevel();
 27.1425 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1426 +        }
 27.1427 +
 27.1428 +        return ;
 27.1429 +    }
 27.1430 +    // $ANTLR end "modifier"
 27.1431 +
 27.1432 +
 27.1433 +    // $ANTLR start "ruleAction"
 27.1434 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:98:1: ruleAction : ^( '@' ID ACTION ) ;
 27.1435 +    public final void ruleAction() throws RecognitionException {
 27.1436 +        try { dbg.enterRule(getGrammarFileName(), "ruleAction");
 27.1437 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1438 +        incRuleLevel();
 27.1439 +        dbg.location(98, 1);
 27.1440 +
 27.1441 +        try {
 27.1442 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:100:2: ( ^( '@' ID ACTION ) )
 27.1443 +            dbg.enterAlt(1);
 27.1444 +
 27.1445 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:100:4: ^( '@' ID ACTION )
 27.1446 +            {
 27.1447 +            dbg.location(100,4);
 27.1448 +            dbg.location(100,6);
 27.1449 +            match(input,72,FOLLOW_72_in_ruleAction416); 
 27.1450 +
 27.1451 +            match(input, Token.DOWN, null); 
 27.1452 +            dbg.location(100,10);
 27.1453 +            match(input,ID,FOLLOW_ID_in_ruleAction418); 
 27.1454 +            dbg.location(100,13);
 27.1455 +            match(input,ACTION,FOLLOW_ACTION_in_ruleAction420); 
 27.1456 +
 27.1457 +            match(input, Token.UP, null); 
 27.1458 +
 27.1459 +            }
 27.1460 +
 27.1461 +        }
 27.1462 +        catch (RecognitionException re) {
 27.1463 +            reportError(re);
 27.1464 +            recover(input,re);
 27.1465 +        }
 27.1466 +        finally {
 27.1467 +        }
 27.1468 +        dbg.location(101, 2);
 27.1469 +
 27.1470 +        }
 27.1471 +        finally {
 27.1472 +            dbg.exitRule(getGrammarFileName(), "ruleAction");
 27.1473 +            decRuleLevel();
 27.1474 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1475 +        }
 27.1476 +
 27.1477 +        return ;
 27.1478 +    }
 27.1479 +    // $ANTLR end "ruleAction"
 27.1480 +
 27.1481 +
 27.1482 +    // $ANTLR start "throwsSpec"
 27.1483 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:103:1: throwsSpec : ^( 'throws' ( ID )+ ) ;
 27.1484 +    public final void throwsSpec() throws RecognitionException {
 27.1485 +        try { dbg.enterRule(getGrammarFileName(), "throwsSpec");
 27.1486 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1487 +        incRuleLevel();
 27.1488 +        dbg.location(103, 1);
 27.1489 +
 27.1490 +        try {
 27.1491 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:2: ( ^( 'throws' ( ID )+ ) )
 27.1492 +            dbg.enterAlt(1);
 27.1493 +
 27.1494 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:4: ^( 'throws' ( ID )+ )
 27.1495 +            {
 27.1496 +            dbg.location(104,4);
 27.1497 +            dbg.location(104,6);
 27.1498 +            match(input,80,FOLLOW_80_in_throwsSpec433); 
 27.1499 +
 27.1500 +            match(input, Token.DOWN, null); 
 27.1501 +            dbg.location(104,15);
 27.1502 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:15: ( ID )+
 27.1503 +            int cnt18=0;
 27.1504 +            try { dbg.enterSubRule(18);
 27.1505 +
 27.1506 +            loop18:
 27.1507 +            do {
 27.1508 +                int alt18=2;
 27.1509 +                try { dbg.enterDecision(18, decisionCanBacktrack[18]);
 27.1510 +
 27.1511 +                int LA18_0 = input.LA(1);
 27.1512 +
 27.1513 +                if ( (LA18_0==ID) ) {
 27.1514 +                    alt18=1;
 27.1515 +                }
 27.1516 +
 27.1517 +
 27.1518 +                } finally {dbg.exitDecision(18);}
 27.1519 +
 27.1520 +                switch (alt18) {
 27.1521 +            	case 1 :
 27.1522 +            	    dbg.enterAlt(1);
 27.1523 +
 27.1524 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:104:15: ID
 27.1525 +            	    {
 27.1526 +            	    dbg.location(104,15);
 27.1527 +            	    match(input,ID,FOLLOW_ID_in_throwsSpec435); 
 27.1528 +
 27.1529 +            	    }
 27.1530 +            	    break;
 27.1531 +
 27.1532 +            	default :
 27.1533 +            	    if ( cnt18 >= 1 ) break loop18;
 27.1534 +                        EarlyExitException eee =
 27.1535 +                            new EarlyExitException(18, input);
 27.1536 +                        dbg.recognitionException(eee);
 27.1537 +
 27.1538 +                        throw eee;
 27.1539 +                }
 27.1540 +                cnt18++;
 27.1541 +            } while (true);
 27.1542 +            } finally {dbg.exitSubRule(18);}
 27.1543 +
 27.1544 +
 27.1545 +            match(input, Token.UP, null); 
 27.1546 +
 27.1547 +            }
 27.1548 +
 27.1549 +        }
 27.1550 +        catch (RecognitionException re) {
 27.1551 +            reportError(re);
 27.1552 +            recover(input,re);
 27.1553 +        }
 27.1554 +        finally {
 27.1555 +        }
 27.1556 +        dbg.location(105, 2);
 27.1557 +
 27.1558 +        }
 27.1559 +        finally {
 27.1560 +            dbg.exitRule(getGrammarFileName(), "throwsSpec");
 27.1561 +            decRuleLevel();
 27.1562 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1563 +        }
 27.1564 +
 27.1565 +        return ;
 27.1566 +    }
 27.1567 +    // $ANTLR end "throwsSpec"
 27.1568 +
 27.1569 +
 27.1570 +    // $ANTLR start "ruleScopeSpec"
 27.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 )+ ) );
 27.1572 +    public final void ruleScopeSpec() throws RecognitionException {
 27.1573 +        try { dbg.enterRule(getGrammarFileName(), "ruleScopeSpec");
 27.1574 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1575 +        incRuleLevel();
 27.1576 +        dbg.location(107, 1);
 27.1577 +
 27.1578 +        try {
 27.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 )+ ) )
 27.1580 +            int alt21=3;
 27.1581 +            try { dbg.enterDecision(21, decisionCanBacktrack[21]);
 27.1582 +
 27.1583 +            int LA21_0 = input.LA(1);
 27.1584 +
 27.1585 +            if ( (LA21_0==SCOPE) ) {
 27.1586 +                int LA21_1 = input.LA(2);
 27.1587 +
 27.1588 +                if ( (LA21_1==DOWN) ) {
 27.1589 +                    int LA21_2 = input.LA(3);
 27.1590 +
 27.1591 +                    if ( (LA21_2==ACTION) ) {
 27.1592 +                        int LA21_3 = input.LA(4);
 27.1593 +
 27.1594 +                        if ( (LA21_3==UP) ) {
 27.1595 +                            alt21=1;
 27.1596 +                        }
 27.1597 +                        else if ( (LA21_3==ID) ) {
 27.1598 +                            alt21=2;
 27.1599 +                        }
 27.1600 +                        else {
 27.1601 +                            NoViableAltException nvae =
 27.1602 +                                new NoViableAltException("", 21, 3, input);
 27.1603 +
 27.1604 +                            dbg.recognitionException(nvae);
 27.1605 +                            throw nvae;
 27.1606 +                        }
 27.1607 +                    }
 27.1608 +                    else if ( (LA21_2==ID) ) {
 27.1609 +                        alt21=3;
 27.1610 +                    }
 27.1611 +                    else {
 27.1612 +                        NoViableAltException nvae =
 27.1613 +                            new NoViableAltException("", 21, 2, input);
 27.1614 +
 27.1615 +                        dbg.recognitionException(nvae);
 27.1616 +                        throw nvae;
 27.1617 +                    }
 27.1618 +                }
 27.1619 +                else {
 27.1620 +                    NoViableAltException nvae =
 27.1621 +                        new NoViableAltException("", 21, 1, input);
 27.1622 +
 27.1623 +                    dbg.recognitionException(nvae);
 27.1624 +                    throw nvae;
 27.1625 +                }
 27.1626 +            }
 27.1627 +            else {
 27.1628 +                NoViableAltException nvae =
 27.1629 +                    new NoViableAltException("", 21, 0, input);
 27.1630 +
 27.1631 +                dbg.recognitionException(nvae);
 27.1632 +                throw nvae;
 27.1633 +            }
 27.1634 +            } finally {dbg.exitDecision(21);}
 27.1635 +
 27.1636 +            switch (alt21) {
 27.1637 +                case 1 :
 27.1638 +                    dbg.enterAlt(1);
 27.1639 +
 27.1640 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:108:4: ^( 'scope' ACTION )
 27.1641 +                    {
 27.1642 +                    dbg.location(108,4);
 27.1643 +                    dbg.location(108,6);
 27.1644 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec449); 
 27.1645 +
 27.1646 +                    match(input, Token.DOWN, null); 
 27.1647 +                    dbg.location(108,14);
 27.1648 +                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec451); 
 27.1649 +
 27.1650 +                    match(input, Token.UP, null); 
 27.1651 +
 27.1652 +                    }
 27.1653 +                    break;
 27.1654 +                case 2 :
 27.1655 +                    dbg.enterAlt(2);
 27.1656 +
 27.1657 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:4: ^( 'scope' ACTION ( ID )+ )
 27.1658 +                    {
 27.1659 +                    dbg.location(109,4);
 27.1660 +                    dbg.location(109,6);
 27.1661 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec458); 
 27.1662 +
 27.1663 +                    match(input, Token.DOWN, null); 
 27.1664 +                    dbg.location(109,14);
 27.1665 +                    match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec460); 
 27.1666 +                    dbg.location(109,21);
 27.1667 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:21: ( ID )+
 27.1668 +                    int cnt19=0;
 27.1669 +                    try { dbg.enterSubRule(19);
 27.1670 +
 27.1671 +                    loop19:
 27.1672 +                    do {
 27.1673 +                        int alt19=2;
 27.1674 +                        try { dbg.enterDecision(19, decisionCanBacktrack[19]);
 27.1675 +
 27.1676 +                        int LA19_0 = input.LA(1);
 27.1677 +
 27.1678 +                        if ( (LA19_0==ID) ) {
 27.1679 +                            alt19=1;
 27.1680 +                        }
 27.1681 +
 27.1682 +
 27.1683 +                        } finally {dbg.exitDecision(19);}
 27.1684 +
 27.1685 +                        switch (alt19) {
 27.1686 +                    	case 1 :
 27.1687 +                    	    dbg.enterAlt(1);
 27.1688 +
 27.1689 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:109:21: ID
 27.1690 +                    	    {
 27.1691 +                    	    dbg.location(109,21);
 27.1692 +                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec462); 
 27.1693 +
 27.1694 +                    	    }
 27.1695 +                    	    break;
 27.1696 +
 27.1697 +                    	default :
 27.1698 +                    	    if ( cnt19 >= 1 ) break loop19;
 27.1699 +                                EarlyExitException eee =
 27.1700 +                                    new EarlyExitException(19, input);
 27.1701 +                                dbg.recognitionException(eee);
 27.1702 +
 27.1703 +                                throw eee;
 27.1704 +                        }
 27.1705 +                        cnt19++;
 27.1706 +                    } while (true);
 27.1707 +                    } finally {dbg.exitSubRule(19);}
 27.1708 +
 27.1709 +
 27.1710 +                    match(input, Token.UP, null); 
 27.1711 +
 27.1712 +                    }
 27.1713 +                    break;
 27.1714 +                case 3 :
 27.1715 +                    dbg.enterAlt(3);
 27.1716 +
 27.1717 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:4: ^( 'scope' ( ID )+ )
 27.1718 +                    {
 27.1719 +                    dbg.location(110,4);
 27.1720 +                    dbg.location(110,6);
 27.1721 +                    match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec470); 
 27.1722 +
 27.1723 +                    match(input, Token.DOWN, null); 
 27.1724 +                    dbg.location(110,14);
 27.1725 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:14: ( ID )+
 27.1726 +                    int cnt20=0;
 27.1727 +                    try { dbg.enterSubRule(20);
 27.1728 +
 27.1729 +                    loop20:
 27.1730 +                    do {
 27.1731 +                        int alt20=2;
 27.1732 +                        try { dbg.enterDecision(20, decisionCanBacktrack[20]);
 27.1733 +
 27.1734 +                        int LA20_0 = input.LA(1);
 27.1735 +
 27.1736 +                        if ( (LA20_0==ID) ) {
 27.1737 +                            alt20=1;
 27.1738 +                        }
 27.1739 +
 27.1740 +
 27.1741 +                        } finally {dbg.exitDecision(20);}
 27.1742 +
 27.1743 +                        switch (alt20) {
 27.1744 +                    	case 1 :
 27.1745 +                    	    dbg.enterAlt(1);
 27.1746 +
 27.1747 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:110:14: ID
 27.1748 +                    	    {
 27.1749 +                    	    dbg.location(110,14);
 27.1750 +                    	    match(input,ID,FOLLOW_ID_in_ruleScopeSpec472); 
 27.1751 +
 27.1752 +                    	    }
 27.1753 +                    	    break;
 27.1754 +
 27.1755 +                    	default :
 27.1756 +                    	    if ( cnt20 >= 1 ) break loop20;
 27.1757 +                                EarlyExitException eee =
 27.1758 +                                    new EarlyExitException(20, input);
 27.1759 +                                dbg.recognitionException(eee);
 27.1760 +
 27.1761 +                                throw eee;
 27.1762 +                        }
 27.1763 +                        cnt20++;
 27.1764 +                    } while (true);
 27.1765 +                    } finally {dbg.exitSubRule(20);}
 27.1766 +
 27.1767 +
 27.1768 +                    match(input, Token.UP, null); 
 27.1769 +
 27.1770 +                    }
 27.1771 +                    break;
 27.1772 +
 27.1773 +            }
 27.1774 +        }
 27.1775 +        catch (RecognitionException re) {
 27.1776 +            reportError(re);
 27.1777 +            recover(input,re);
 27.1778 +        }
 27.1779 +        finally {
 27.1780 +        }
 27.1781 +        dbg.location(111, 2);
 27.1782 +
 27.1783 +        }
 27.1784 +        finally {
 27.1785 +            dbg.exitRule(getGrammarFileName(), "ruleScopeSpec");
 27.1786 +            decRuleLevel();
 27.1787 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1788 +        }
 27.1789 +
 27.1790 +        return ;
 27.1791 +    }
 27.1792 +    // $ANTLR end "ruleScopeSpec"
 27.1793 +
 27.1794 +
 27.1795 +    // $ANTLR start "block"
 27.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 ) ;
 27.1797 +    public final void block() throws RecognitionException {
 27.1798 +        try { dbg.enterRule(getGrammarFileName(), "block");
 27.1799 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1800 +        incRuleLevel();
 27.1801 +        dbg.location(113, 1);
 27.1802 +
 27.1803 +        try {
 27.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 ) )
 27.1805 +            dbg.enterAlt(1);
 27.1806 +
 27.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 )
 27.1808 +            {
 27.1809 +            dbg.location(114,9);
 27.1810 +            dbg.location(114,12);
 27.1811 +            match(input,BLOCK,FOLLOW_BLOCK_in_block492); 
 27.1812 +
 27.1813 +            match(input, Token.DOWN, null); 
 27.1814 +            dbg.location(114,18);
 27.1815 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:18: ( optionsSpec )?
 27.1816 +            int alt22=2;
 27.1817 +            try { dbg.enterSubRule(22);
 27.1818 +            try { dbg.enterDecision(22, decisionCanBacktrack[22]);
 27.1819 +
 27.1820 +            int LA22_0 = input.LA(1);
 27.1821 +
 27.1822 +            if ( (LA22_0==OPTIONS) ) {
 27.1823 +                alt22=1;
 27.1824 +            }
 27.1825 +            } finally {dbg.exitDecision(22);}
 27.1826 +
 27.1827 +            switch (alt22) {
 27.1828 +                case 1 :
 27.1829 +                    dbg.enterAlt(1);
 27.1830 +
 27.1831 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:18: optionsSpec
 27.1832 +                    {
 27.1833 +                    dbg.location(114,18);
 27.1834 +                    pushFollow(FOLLOW_optionsSpec_in_block494);
 27.1835 +                    optionsSpec();
 27.1836 +
 27.1837 +                    state._fsp--;
 27.1838 +
 27.1839 +
 27.1840 +                    }
 27.1841 +                    break;
 27.1842 +
 27.1843 +            }
 27.1844 +            } finally {dbg.exitSubRule(22);}
 27.1845 +
 27.1846 +            dbg.location(114,31);
 27.1847 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:31: ( alternative rewrite )+
 27.1848 +            int cnt23=0;
 27.1849 +            try { dbg.enterSubRule(23);
 27.1850 +
 27.1851 +            loop23:
 27.1852 +            do {
 27.1853 +                int alt23=2;
 27.1854 +                try { dbg.enterDecision(23, decisionCanBacktrack[23]);
 27.1855 +
 27.1856 +                int LA23_0 = input.LA(1);
 27.1857 +
 27.1858 +                if ( (LA23_0==ALT) ) {
 27.1859 +                    alt23=1;
 27.1860 +                }
 27.1861 +
 27.1862 +
 27.1863 +                } finally {dbg.exitDecision(23);}
 27.1864 +
 27.1865 +                switch (alt23) {
 27.1866 +            	case 1 :
 27.1867 +            	    dbg.enterAlt(1);
 27.1868 +
 27.1869 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:114:32: alternative rewrite
 27.1870 +            	    {
 27.1871 +            	    dbg.location(114,32);
 27.1872 +            	    pushFollow(FOLLOW_alternative_in_block498);
 27.1873 +            	    alternative();
 27.1874 +
 27.1875 +            	    state._fsp--;
 27.1876 +
 27.1877 +            	    dbg.location(114,44);
 27.1878 +            	    pushFollow(FOLLOW_rewrite_in_block500);
 27.1879 +            	    rewrite();
 27.1880 +
 27.1881 +            	    state._fsp--;
 27.1882 +
 27.1883 +
 27.1884 +            	    }
 27.1885 +            	    break;
 27.1886 +
 27.1887 +            	default :
 27.1888 +            	    if ( cnt23 >= 1 ) break loop23;
 27.1889 +                        EarlyExitException eee =
 27.1890 +                            new EarlyExitException(23, input);
 27.1891 +                        dbg.recognitionException(eee);
 27.1892 +
 27.1893 +                        throw eee;
 27.1894 +                }
 27.1895 +                cnt23++;
 27.1896 +            } while (true);
 27.1897 +            } finally {dbg.exitSubRule(23);}
 27.1898 +
 27.1899 +            dbg.location(114,54);
 27.1900 +            match(input,EOB,FOLLOW_EOB_in_block504); 
 27.1901 +
 27.1902 +            match(input, Token.UP, null); 
 27.1903 +
 27.1904 +            }
 27.1905 +
 27.1906 +        }
 27.1907 +        catch (RecognitionException re) {
 27.1908 +            reportError(re);
 27.1909 +            recover(input,re);
 27.1910 +        }
 27.1911 +        finally {
 27.1912 +        }
 27.1913 +        dbg.location(115, 5);
 27.1914 +
 27.1915 +        }
 27.1916 +        finally {
 27.1917 +            dbg.exitRule(getGrammarFileName(), "block");
 27.1918 +            decRuleLevel();
 27.1919 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.1920 +        }
 27.1921 +
 27.1922 +        return ;
 27.1923 +    }
 27.1924 +    // $ANTLR end "block"
 27.1925 +
 27.1926 +
 27.1927 +    // $ANTLR start "altList"
 27.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 ) ;
 27.1929 +    public final void altList() throws RecognitionException {
 27.1930 +        try { dbg.enterRule(getGrammarFileName(), "altList");
 27.1931 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.1932 +        incRuleLevel();
 27.1933 +        dbg.location(117, 1);
 27.1934 +
 27.1935 +        try {
 27.1936 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:5: ( ^( BLOCK ( alternative rewrite )+ EOB ) )
 27.1937 +            dbg.enterAlt(1);
 27.1938 +
 27.1939 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:9: ^( BLOCK ( alternative rewrite )+ EOB )
 27.1940 +            {
 27.1941 +            dbg.location(118,9);
 27.1942 +            dbg.location(118,12);
 27.1943 +            match(input,BLOCK,FOLLOW_BLOCK_in_altList527); 
 27.1944 +
 27.1945 +            match(input, Token.DOWN, null); 
 27.1946 +            dbg.location(118,18);
 27.1947 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:18: ( alternative rewrite )+
 27.1948 +            int cnt24=0;
 27.1949 +            try { dbg.enterSubRule(24);
 27.1950 +
 27.1951 +            loop24:
 27.1952 +            do {
 27.1953 +                int alt24=2;
 27.1954 +                try { dbg.enterDecision(24, decisionCanBacktrack[24]);
 27.1955 +
 27.1956 +                int LA24_0 = input.LA(1);
 27.1957 +
 27.1958 +                if ( (LA24_0==ALT) ) {
 27.1959 +                    alt24=1;
 27.1960 +                }
 27.1961 +
 27.1962 +
 27.1963 +                } finally {dbg.exitDecision(24);}
 27.1964 +
 27.1965 +                switch (alt24) {
 27.1966 +            	case 1 :
 27.1967 +            	    dbg.enterAlt(1);
 27.1968 +
 27.1969 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:118:19: alternative rewrite
 27.1970 +            	    {
 27.1971 +            	    dbg.location(118,19);
 27.1972 +            	    pushFollow(FOLLOW_alternative_in_altList530);
 27.1973 +            	    alternative();
 27.1974 +
 27.1975 +            	    state._fsp--;
 27.1976 +
 27.1977 +            	    dbg.location(118,31);
 27.1978 +            	    pushFollow(FOLLOW_rewrite_in_altList532);
 27.1979 +            	    rewrite();
 27.1980 +
 27.1981 +            	    state._fsp--;
 27.1982 +
 27.1983 +
 27.1984 +            	    }
 27.1985 +            	    break;
 27.1986 +
 27.1987 +            	default :
 27.1988 +            	    if ( cnt24 >= 1 ) break loop24;
 27.1989 +                        EarlyExitException eee =
 27.1990 +                            new EarlyExitException(24, input);
 27.1991 +                        dbg.recognitionException(eee);
 27.1992 +
 27.1993 +                        throw eee;
 27.1994 +                }
 27.1995 +                cnt24++;
 27.1996 +            } while (true);
 27.1997 +            } finally {dbg.exitSubRule(24);}
 27.1998 +
 27.1999 +            dbg.location(118,41);
 27.2000 +            match(input,EOB,FOLLOW_EOB_in_altList536); 
 27.2001 +
 27.2002 +            match(input, Token.UP, null); 
 27.2003 +
 27.2004 +            }
 27.2005 +
 27.2006 +        }
 27.2007 +        catch (RecognitionException re) {
 27.2008 +            reportError(re);
 27.2009 +            recover(input,re);
 27.2010 +        }
 27.2011 +        finally {
 27.2012 +        }
 27.2013 +        dbg.location(119, 5);
 27.2014 +
 27.2015 +        }
 27.2016 +        finally {
 27.2017 +            dbg.exitRule(getGrammarFileName(), "altList");
 27.2018 +            decRuleLevel();
 27.2019 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2020 +        }
 27.2021 +
 27.2022 +        return ;
 27.2023 +    }
 27.2024 +    // $ANTLR end "altList"
 27.2025 +
 27.2026 +
 27.2027 +    // $ANTLR start "alternative"
 27.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 ) );
 27.2029 +    public final void alternative() throws RecognitionException {
 27.2030 +        try { dbg.enterRule(getGrammarFileName(), "alternative");
 27.2031 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2032 +        incRuleLevel();
 27.2033 +        dbg.location(121, 1);
 27.2034 +
 27.2035 +        try {
 27.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 ) )
 27.2037 +            int alt26=2;
 27.2038 +            try { dbg.enterDecision(26, decisionCanBacktrack[26]);
 27.2039 +
 27.2040 +            int LA26_0 = input.LA(1);
 27.2041 +
 27.2042 +            if ( (LA26_0==ALT) ) {
 27.2043 +                int LA26_1 = input.LA(2);
 27.2044 +
 27.2045 +                if ( (LA26_1==DOWN) ) {
 27.2046 +                    int LA26_2 = input.LA(3);
 27.2047 +
 27.2048 +                    if ( (LA26_2==EPSILON) ) {
 27.2049 +                        alt26=2;
 27.2050 +                    }
 27.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) ) {
 27.2052 +                        alt26=1;
 27.2053 +                    }
 27.2054 +                    else {
 27.2055 +                        NoViableAltException nvae =
 27.2056 +                            new NoViableAltException("", 26, 2, input);
 27.2057 +
 27.2058 +                        dbg.recognitionException(nvae);
 27.2059 +                        throw nvae;
 27.2060 +                    }
 27.2061 +                }
 27.2062 +                else {
 27.2063 +                    NoViableAltException nvae =
 27.2064 +                        new NoViableAltException("", 26, 1, input);
 27.2065 +
 27.2066 +                    dbg.recognitionException(nvae);
 27.2067 +                    throw nvae;
 27.2068 +                }
 27.2069 +            }
 27.2070 +            else {
 27.2071 +                NoViableAltException nvae =
 27.2072 +                    new NoViableAltException("", 26, 0, input);
 27.2073 +
 27.2074 +                dbg.recognitionException(nvae);
 27.2075 +                throw nvae;
 27.2076 +            }
 27.2077 +            } finally {dbg.exitDecision(26);}
 27.2078 +
 27.2079 +            switch (alt26) {
 27.2080 +                case 1 :
 27.2081 +                    dbg.enterAlt(1);
 27.2082 +
 27.2083 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:9: ^( ALT ( element )+ EOA )
 27.2084 +                    {
 27.2085 +                    dbg.location(122,9);
 27.2086 +                    dbg.location(122,11);
 27.2087 +                    match(input,ALT,FOLLOW_ALT_in_alternative558); 
 27.2088 +
 27.2089 +                    match(input, Token.DOWN, null); 
 27.2090 +                    dbg.location(122,15);
 27.2091 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:15: ( element )+
 27.2092 +                    int cnt25=0;
 27.2093 +                    try { dbg.enterSubRule(25);
 27.2094 +
 27.2095 +                    loop25:
 27.2096 +                    do {
 27.2097 +                        int alt25=2;
 27.2098 +                        try { dbg.enterDecision(25, decisionCanBacktrack[25]);
 27.2099 +
 27.2100 +                        int LA25_0 = input.LA(1);
 27.2101 +
 27.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) ) {
 27.2103 +                            alt25=1;
 27.2104 +                        }
 27.2105 +
 27.2106 +
 27.2107 +                        } finally {dbg.exitDecision(25);}
 27.2108 +
 27.2109 +                        switch (alt25) {
 27.2110 +                    	case 1 :
 27.2111 +                    	    dbg.enterAlt(1);
 27.2112 +
 27.2113 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:122:15: element
 27.2114 +                    	    {
 27.2115 +                    	    dbg.location(122,15);
 27.2116 +                    	    pushFollow(FOLLOW_element_in_alternative560);
 27.2117 +                    	    element();
 27.2118 +
 27.2119 +                    	    state._fsp--;
 27.2120 +
 27.2121 +
 27.2122 +                    	    }
 27.2123 +                    	    break;
 27.2124 +
 27.2125 +                    	default :
 27.2126 +                    	    if ( cnt25 >= 1 ) break loop25;
 27.2127 +                                EarlyExitException eee =
 27.2128 +                                    new EarlyExitException(25, input);
 27.2129 +                                dbg.recognitionException(eee);
 27.2130 +
 27.2131 +                                throw eee;
 27.2132 +                        }
 27.2133 +                        cnt25++;
 27.2134 +                    } while (true);
 27.2135 +                    } finally {dbg.exitSubRule(25);}
 27.2136 +
 27.2137 +                    dbg.location(122,24);
 27.2138 +                    match(input,EOA,FOLLOW_EOA_in_alternative563); 
 27.2139 +
 27.2140 +                    match(input, Token.UP, null); 
 27.2141 +
 27.2142 +                    }
 27.2143 +                    break;
 27.2144 +                case 2 :
 27.2145 +                    dbg.enterAlt(2);
 27.2146 +
 27.2147 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:123:9: ^( ALT EPSILON EOA )
 27.2148 +                    {
 27.2149 +                    dbg.location(123,9);
 27.2150 +                    dbg.location(123,11);
 27.2151 +                    match(input,ALT,FOLLOW_ALT_in_alternative575); 
 27.2152 +
 27.2153 +                    match(input, Token.DOWN, null); 
 27.2154 +                    dbg.location(123,15);
 27.2155 +                    match(input,EPSILON,FOLLOW_EPSILON_in_alternative577); 
 27.2156 +                    dbg.location(123,23);
 27.2157 +                    match(input,EOA,FOLLOW_EOA_in_alternative579); 
 27.2158 +
 27.2159 +                    match(input, Token.UP, null); 
 27.2160 +
 27.2161 +                    }
 27.2162 +                    break;
 27.2163 +
 27.2164 +            }
 27.2165 +        }
 27.2166 +        catch (RecognitionException re) {
 27.2167 +            reportError(re);
 27.2168 +            recover(input,re);
 27.2169 +        }
 27.2170 +        finally {
 27.2171 +        }
 27.2172 +        dbg.location(124, 5);
 27.2173 +
 27.2174 +        }
 27.2175 +        finally {
 27.2176 +            dbg.exitRule(getGrammarFileName(), "alternative");
 27.2177 +            decRuleLevel();
 27.2178 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2179 +        }
 27.2180 +
 27.2181 +        return ;
 27.2182 +    }
 27.2183 +    // $ANTLR end "alternative"
 27.2184 +
 27.2185 +
 27.2186 +    // $ANTLR start "exceptionGroup"
 27.2187 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:126:1: exceptionGroup : ( ( exceptionHandler )+ ( finallyClause )? | finallyClause );
 27.2188 +    public final void exceptionGroup() throws RecognitionException {
 27.2189 +        try { dbg.enterRule(getGrammarFileName(), "exceptionGroup");
 27.2190 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2191 +        incRuleLevel();
 27.2192 +        dbg.location(126, 1);
 27.2193 +
 27.2194 +        try {
 27.2195 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:2: ( ( exceptionHandler )+ ( finallyClause )? | finallyClause )
 27.2196 +            int alt29=2;
 27.2197 +            try { dbg.enterDecision(29, decisionCanBacktrack[29]);
 27.2198 +
 27.2199 +            int LA29_0 = input.LA(1);
 27.2200 +
 27.2201 +            if ( (LA29_0==85) ) {
 27.2202 +                alt29=1;
 27.2203 +            }
 27.2204 +            else if ( (LA29_0==86) ) {
 27.2205 +                alt29=2;
 27.2206 +            }
 27.2207 +            else {
 27.2208 +                NoViableAltException nvae =
 27.2209 +                    new NoViableAltException("", 29, 0, input);
 27.2210 +
 27.2211 +                dbg.recognitionException(nvae);
 27.2212 +                throw nvae;
 27.2213 +            }
 27.2214 +            } finally {dbg.exitDecision(29);}
 27.2215 +
 27.2216 +            switch (alt29) {
 27.2217 +                case 1 :
 27.2218 +                    dbg.enterAlt(1);
 27.2219 +
 27.2220 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: ( exceptionHandler )+ ( finallyClause )?
 27.2221 +                    {
 27.2222 +                    dbg.location(127,4);
 27.2223 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: ( exceptionHandler )+
 27.2224 +                    int cnt27=0;
 27.2225 +                    try { dbg.enterSubRule(27);
 27.2226 +
 27.2227 +                    loop27:
 27.2228 +                    do {
 27.2229 +                        int alt27=2;
 27.2230 +                        try { dbg.enterDecision(27, decisionCanBacktrack[27]);
 27.2231 +
 27.2232 +                        int LA27_0 = input.LA(1);
 27.2233 +
 27.2234 +                        if ( (LA27_0==85) ) {
 27.2235 +                            alt27=1;
 27.2236 +                        }
 27.2237 +
 27.2238 +
 27.2239 +                        } finally {dbg.exitDecision(27);}
 27.2240 +
 27.2241 +                        switch (alt27) {
 27.2242 +                    	case 1 :
 27.2243 +                    	    dbg.enterAlt(1);
 27.2244 +
 27.2245 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:4: exceptionHandler
 27.2246 +                    	    {
 27.2247 +                    	    dbg.location(127,4);
 27.2248 +                    	    pushFollow(FOLLOW_exceptionHandler_in_exceptionGroup594);
 27.2249 +                    	    exceptionHandler();
 27.2250 +
 27.2251 +                    	    state._fsp--;
 27.2252 +
 27.2253 +
 27.2254 +                    	    }
 27.2255 +                    	    break;
 27.2256 +
 27.2257 +                    	default :
 27.2258 +                    	    if ( cnt27 >= 1 ) break loop27;
 27.2259 +                                EarlyExitException eee =
 27.2260 +                                    new EarlyExitException(27, input);
 27.2261 +                                dbg.recognitionException(eee);
 27.2262 +
 27.2263 +                                throw eee;
 27.2264 +                        }
 27.2265 +                        cnt27++;
 27.2266 +                    } while (true);
 27.2267 +                    } finally {dbg.exitSubRule(27);}
 27.2268 +
 27.2269 +                    dbg.location(127,22);
 27.2270 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:22: ( finallyClause )?
 27.2271 +                    int alt28=2;
 27.2272 +                    try { dbg.enterSubRule(28);
 27.2273 +                    try { dbg.enterDecision(28, decisionCanBacktrack[28]);
 27.2274 +
 27.2275 +                    int LA28_0 = input.LA(1);
 27.2276 +
 27.2277 +                    if ( (LA28_0==86) ) {
 27.2278 +                        alt28=1;
 27.2279 +                    }
 27.2280 +                    } finally {dbg.exitDecision(28);}
 27.2281 +
 27.2282 +                    switch (alt28) {
 27.2283 +                        case 1 :
 27.2284 +                            dbg.enterAlt(1);
 27.2285 +
 27.2286 +                            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:127:22: finallyClause
 27.2287 +                            {
 27.2288 +                            dbg.location(127,22);
 27.2289 +                            pushFollow(FOLLOW_finallyClause_in_exceptionGroup597);
 27.2290 +                            finallyClause();
 27.2291 +
 27.2292 +                            state._fsp--;
 27.2293 +
 27.2294 +
 27.2295 +                            }
 27.2296 +                            break;
 27.2297 +
 27.2298 +                    }
 27.2299 +                    } finally {dbg.exitSubRule(28);}
 27.2300 +
 27.2301 +
 27.2302 +                    }
 27.2303 +                    break;
 27.2304 +                case 2 :
 27.2305 +                    dbg.enterAlt(2);
 27.2306 +
 27.2307 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:128:4: finallyClause
 27.2308 +                    {
 27.2309 +                    dbg.location(128,4);
 27.2310 +                    pushFollow(FOLLOW_finallyClause_in_exceptionGroup603);
 27.2311 +                    finallyClause();
 27.2312 +
 27.2313 +                    state._fsp--;
 27.2314 +
 27.2315 +
 27.2316 +                    }
 27.2317 +                    break;
 27.2318 +
 27.2319 +            }
 27.2320 +        }
 27.2321 +        catch (RecognitionException re) {
 27.2322 +            reportError(re);
 27.2323 +            recover(input,re);
 27.2324 +        }
 27.2325 +        finally {
 27.2326 +        }
 27.2327 +        dbg.location(129, 5);
 27.2328 +
 27.2329 +        }
 27.2330 +        finally {
 27.2331 +            dbg.exitRule(getGrammarFileName(), "exceptionGroup");
 27.2332 +            decRuleLevel();
 27.2333 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2334 +        }
 27.2335 +
 27.2336 +        return ;
 27.2337 +    }
 27.2338 +    // $ANTLR end "exceptionGroup"
 27.2339 +
 27.2340 +
 27.2341 +    // $ANTLR start "exceptionHandler"
 27.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 ) ;
 27.2343 +    public final void exceptionHandler() throws RecognitionException {
 27.2344 +        try { dbg.enterRule(getGrammarFileName(), "exceptionHandler");
 27.2345 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2346 +        incRuleLevel();
 27.2347 +        dbg.location(131, 1);
 27.2348 +
 27.2349 +        try {
 27.2350 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:132:5: ( ^( 'catch' ARG_ACTION ACTION ) )
 27.2351 +            dbg.enterAlt(1);
 27.2352 +
 27.2353 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:132:10: ^( 'catch' ARG_ACTION ACTION )
 27.2354 +            {
 27.2355 +            dbg.location(132,10);
 27.2356 +            dbg.location(132,12);
 27.2357 +            match(input,85,FOLLOW_85_in_exceptionHandler624); 
 27.2358 +
 27.2359 +            match(input, Token.DOWN, null); 
 27.2360 +            dbg.location(132,20);
 27.2361 +            match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_exceptionHandler626); 
 27.2362 +            dbg.location(132,31);
 27.2363 +            match(input,ACTION,FOLLOW_ACTION_in_exceptionHandler628); 
 27.2364 +
 27.2365 +            match(input, Token.UP, null); 
 27.2366 +
 27.2367 +            }
 27.2368 +
 27.2369 +        }
 27.2370 +        catch (RecognitionException re) {
 27.2371 +            reportError(re);
 27.2372 +            recover(input,re);
 27.2373 +        }
 27.2374 +        finally {
 27.2375 +        }
 27.2376 +        dbg.location(133, 5);
 27.2377 +
 27.2378 +        }
 27.2379 +        finally {
 27.2380 +            dbg.exitRule(getGrammarFileName(), "exceptionHandler");
 27.2381 +            decRuleLevel();
 27.2382 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2383 +        }
 27.2384 +
 27.2385 +        return ;
 27.2386 +    }
 27.2387 +    // $ANTLR end "exceptionHandler"
 27.2388 +
 27.2389 +
 27.2390 +    // $ANTLR start "finallyClause"
 27.2391 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:135:1: finallyClause : ^( 'finally' ACTION ) ;
 27.2392 +    public final void finallyClause() throws RecognitionException {
 27.2393 +        try { dbg.enterRule(getGrammarFileName(), "finallyClause");
 27.2394 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2395 +        incRuleLevel();
 27.2396 +        dbg.location(135, 1);
 27.2397 +
 27.2398 +        try {
 27.2399 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:136:5: ( ^( 'finally' ACTION ) )
 27.2400 +            dbg.enterAlt(1);
 27.2401 +
 27.2402 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:136:10: ^( 'finally' ACTION )
 27.2403 +            {
 27.2404 +            dbg.location(136,10);
 27.2405 +            dbg.location(136,12);
 27.2406 +            match(input,86,FOLLOW_86_in_finallyClause650); 
 27.2407 +
 27.2408 +            match(input, Token.DOWN, null); 
 27.2409 +            dbg.location(136,22);
 27.2410 +            match(input,ACTION,FOLLOW_ACTION_in_finallyClause652); 
 27.2411 +
 27.2412 +            match(input, Token.UP, null); 
 27.2413 +
 27.2414 +            }
 27.2415 +
 27.2416 +        }
 27.2417 +        catch (RecognitionException re) {
 27.2418 +            reportError(re);
 27.2419 +            recover(input,re);
 27.2420 +        }
 27.2421 +        finally {
 27.2422 +        }
 27.2423 +        dbg.location(137, 5);
 27.2424 +
 27.2425 +        }
 27.2426 +        finally {
 27.2427 +            dbg.exitRule(getGrammarFileName(), "finallyClause");
 27.2428 +            decRuleLevel();
 27.2429 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2430 +        }
 27.2431 +
 27.2432 +        return ;
 27.2433 +    }
 27.2434 +    // $ANTLR end "finallyClause"
 27.2435 +
 27.2436 +
 27.2437 +    // $ANTLR start "element"
 27.2438 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:139:1: element : elementNoOptionSpec ;
 27.2439 +    public final void element() throws RecognitionException {
 27.2440 +        try { dbg.enterRule(getGrammarFileName(), "element");
 27.2441 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2442 +        incRuleLevel();
 27.2443 +        dbg.location(139, 1);
 27.2444 +
 27.2445 +        try {
 27.2446 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:140:2: ( elementNoOptionSpec )
 27.2447 +            dbg.enterAlt(1);
 27.2448 +
 27.2449 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:140:4: elementNoOptionSpec
 27.2450 +            {
 27.2451 +            dbg.location(140,4);
 27.2452 +            pushFollow(FOLLOW_elementNoOptionSpec_in_element667);
 27.2453 +            elementNoOptionSpec();
 27.2454 +
 27.2455 +            state._fsp--;
 27.2456 +
 27.2457 +
 27.2458 +            }
 27.2459 +
 27.2460 +        }
 27.2461 +        catch (RecognitionException re) {
 27.2462 +            reportError(re);
 27.2463 +            recover(input,re);
 27.2464 +        }
 27.2465 +        finally {
 27.2466 +        }
 27.2467 +        dbg.location(141, 2);
 27.2468 +
 27.2469 +        }
 27.2470 +        finally {
 27.2471 +            dbg.exitRule(getGrammarFileName(), "element");
 27.2472 +            decRuleLevel();
 27.2473 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2474 +        }
 27.2475 +
 27.2476 +        return ;
 27.2477 +    }
 27.2478 +    // $ANTLR end "element"
 27.2479 +
 27.2480 +
 27.2481 +    // $ANTLR start "elementNoOptionSpec"
 27.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 );
 27.2483 +    public final void elementNoOptionSpec() throws RecognitionException {
 27.2484 +        try { dbg.enterRule(getGrammarFileName(), "elementNoOptionSpec");
 27.2485 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2486 +        incRuleLevel();
 27.2487 +        dbg.location(143, 1);
 27.2488 +
 27.2489 +        try {
 27.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 )
 27.2491 +            int alt30=8;
 27.2492 +            try { dbg.enterDecision(30, decisionCanBacktrack[30]);
 27.2493 +
 27.2494 +            try {
 27.2495 +                isCyclicDecision = true;
 27.2496 +                alt30 = dfa30.predict(input);
 27.2497 +            }
 27.2498 +            catch (NoViableAltException nvae) {
 27.2499 +                dbg.recognitionException(nvae);
 27.2500 +                throw nvae;
 27.2501 +            }
 27.2502 +            } finally {dbg.exitDecision(30);}
 27.2503 +
 27.2504 +            switch (alt30) {
 27.2505 +                case 1 :
 27.2506 +                    dbg.enterAlt(1);
 27.2507 +
 27.2508 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:144:4: ^( ( '=' | '+=' ) ID block )
 27.2509 +                    {
 27.2510 +                    dbg.location(144,4);
 27.2511 +                    dbg.location(144,6);
 27.2512 +                    if ( input.LA(1)==71||input.LA(1)==87 ) {
 27.2513 +                        input.consume();
 27.2514 +                        state.errorRecovery=false;
 27.2515 +                    }
 27.2516 +                    else {
 27.2517 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 27.2518 +                        dbg.recognitionException(mse);
 27.2519 +                        throw mse;
 27.2520 +                    }
 27.2521 +
 27.2522 +
 27.2523 +                    match(input, Token.DOWN, null); 
 27.2524 +                    dbg.location(144,17);
 27.2525 +                    match(input,ID,FOLLOW_ID_in_elementNoOptionSpec685); 
 27.2526 +                    dbg.location(144,20);
 27.2527 +                    pushFollow(FOLLOW_block_in_elementNoOptionSpec687);
 27.2528 +                    block();
 27.2529 +
 27.2530 +                    state._fsp--;
 27.2531 +
 27.2532 +
 27.2533 +                    match(input, Token.UP, null); 
 27.2534 +
 27.2535 +                    }
 27.2536 +                    break;
 27.2537 +                case 2 :
 27.2538 +                    dbg.enterAlt(2);
 27.2539 +
 27.2540 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:145:4: ^( ( '=' | '+=' ) ID atom )
 27.2541 +                    {
 27.2542 +                    dbg.location(145,4);
 27.2543 +                    dbg.location(145,6);
 27.2544 +                    if ( input.LA(1)==71||input.LA(1)==87 ) {
 27.2545 +                        input.consume();
 27.2546 +                        state.errorRecovery=false;
 27.2547 +                    }
 27.2548 +                    else {
 27.2549 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 27.2550 +                        dbg.recognitionException(mse);
 27.2551 +                        throw mse;
 27.2552 +                    }
 27.2553 +
 27.2554 +
 27.2555 +                    match(input, Token.DOWN, null); 
 27.2556 +                    dbg.location(145,17);
 27.2557 +                    match(input,ID,FOLLOW_ID_in_elementNoOptionSpec700); 
 27.2558 +                    dbg.location(145,20);
 27.2559 +                    pushFollow(FOLLOW_atom_in_elementNoOptionSpec702);
 27.2560 +                    atom();
 27.2561 +
 27.2562 +                    state._fsp--;
 27.2563 +
 27.2564 +
 27.2565 +                    match(input, Token.UP, null); 
 27.2566 +
 27.2567 +                    }
 27.2568 +                    break;
 27.2569 +                case 3 :
 27.2570 +                    dbg.enterAlt(3);
 27.2571 +
 27.2572 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:146:4: atom
 27.2573 +                    {
 27.2574 +                    dbg.location(146,4);
 27.2575 +                    pushFollow(FOLLOW_atom_in_elementNoOptionSpec708);
 27.2576 +                    atom();
 27.2577 +
 27.2578 +                    state._fsp--;
 27.2579 +
 27.2580 +
 27.2581 +                    }
 27.2582 +                    break;
 27.2583 +                case 4 :
 27.2584 +                    dbg.enterAlt(4);
 27.2585 +
 27.2586 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:147:4: ebnf
 27.2587 +                    {
 27.2588 +                    dbg.location(147,4);
 27.2589 +                    pushFollow(FOLLOW_ebnf_in_elementNoOptionSpec713);
 27.2590 +                    ebnf();
 27.2591 +
 27.2592 +                    state._fsp--;
 27.2593 +
 27.2594 +
 27.2595 +                    }
 27.2596 +                    break;
 27.2597 +                case 5 :
 27.2598 +                    dbg.enterAlt(5);
 27.2599 +
 27.2600 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:148:6: ACTION
 27.2601 +                    {
 27.2602 +                    dbg.location(148,6);
 27.2603 +                    match(input,ACTION,FOLLOW_ACTION_in_elementNoOptionSpec720); 
 27.2604 +
 27.2605 +                    }
 27.2606 +                    break;
 27.2607 +                case 6 :
 27.2608 +                    dbg.enterAlt(6);
 27.2609 +
 27.2610 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:149:6: SEMPRED
 27.2611 +                    {
 27.2612 +                    dbg.location(149,6);
 27.2613 +                    match(input,SEMPRED,FOLLOW_SEMPRED_in_elementNoOptionSpec727); 
 27.2614 +
 27.2615 +                    }
 27.2616 +                    break;
 27.2617 +                case 7 :
 27.2618 +                    dbg.enterAlt(7);
 27.2619 +
 27.2620 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:150:4: GATED_SEMPRED
 27.2621 +                    {
 27.2622 +                    dbg.location(150,4);
 27.2623 +                    match(input,GATED_SEMPRED,FOLLOW_GATED_SEMPRED_in_elementNoOptionSpec732); 
 27.2624 +
 27.2625 +                    }
 27.2626 +                    break;
 27.2627 +                case 8 :
 27.2628 +                    dbg.enterAlt(8);
 27.2629 +
 27.2630 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:151:6: treeSpec
 27.2631 +                    {
 27.2632 +                    dbg.location(151,6);
 27.2633 +                    pushFollow(FOLLOW_treeSpec_in_elementNoOptionSpec739);
 27.2634 +                    treeSpec();
 27.2635 +
 27.2636 +                    state._fsp--;
 27.2637 +
 27.2638 +
 27.2639 +                    }
 27.2640 +                    break;
 27.2641 +
 27.2642 +            }
 27.2643 +        }
 27.2644 +        catch (RecognitionException re) {
 27.2645 +            reportError(re);
 27.2646 +            recover(input,re);
 27.2647 +        }
 27.2648 +        finally {
 27.2649 +        }
 27.2650 +        dbg.location(152, 2);
 27.2651 +
 27.2652 +        }
 27.2653 +        finally {
 27.2654 +            dbg.exitRule(getGrammarFileName(), "elementNoOptionSpec");
 27.2655 +            decRuleLevel();
 27.2656 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2657 +        }
 27.2658 +
 27.2659 +        return ;
 27.2660 +    }
 27.2661 +    // $ANTLR end "elementNoOptionSpec"
 27.2662 +
 27.2663 +
 27.2664 +    // $ANTLR start "atom"
 27.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 );
 27.2666 +    public final void atom() throws RecognitionException {
 27.2667 +        try { dbg.enterRule(getGrammarFileName(), "atom");
 27.2668 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2669 +        incRuleLevel();
 27.2670 +        dbg.location(154, 1);
 27.2671 +
 27.2672 +        try {
 27.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 )
 27.2674 +            int alt31=6;
 27.2675 +            try { dbg.enterDecision(31, decisionCanBacktrack[31]);
 27.2676 +
 27.2677 +            switch ( input.LA(1) ) {
 27.2678 +            case ROOT:
 27.2679 +            case BANG:
 27.2680 +                {
 27.2681 +                alt31=1;
 27.2682 +                }
 27.2683 +                break;
 27.2684 +            case CHAR_RANGE:
 27.2685 +                {
 27.2686 +                alt31=2;
 27.2687 +                }
 27.2688 +                break;
 27.2689 +            case 89:
 27.2690 +                {
 27.2691 +                alt31=3;
 27.2692 +                }
 27.2693 +                break;
 27.2694 +            case RULE_REF:
 27.2695 +                {
 27.2696 +                int LA31_4 = input.LA(2);
 27.2697 +
 27.2698 +                if ( (LA31_4==DOWN) ) {
 27.2699 +                    alt31=4;
 27.2700 +                }
 27.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) ) {
 27.2702 +                    alt31=5;
 27.2703 +                }
 27.2704 +                else {
 27.2705 +                    NoViableAltException nvae =
 27.2706 +                        new NoViableAltException("", 31, 4, input);
 27.2707 +
 27.2708 +                    dbg.recognitionException(nvae);
 27.2709 +                    throw nvae;
 27.2710 +                }
 27.2711 +                }
 27.2712 +                break;
 27.2713 +            case TOKEN_REF:
 27.2714 +            case STRING_LITERAL:
 27.2715 +            case CHAR_LITERAL:
 27.2716 +            case 92:
 27.2717 +                {
 27.2718 +                alt31=6;
 27.2719 +                }
 27.2720 +                break;
 27.2721 +            default:
 27.2722 +                NoViableAltException nvae =
 27.2723 +                    new NoViableAltException("", 31, 0, input);
 27.2724 +
 27.2725 +                dbg.recognitionException(nvae);
 27.2726 +                throw nvae;
 27.2727 +            }
 27.2728 +
 27.2729 +            } finally {dbg.exitDecision(31);}
 27.2730 +
 27.2731 +            switch (alt31) {
 27.2732 +                case 1 :
 27.2733 +                    dbg.enterAlt(1);
 27.2734 +
 27.2735 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:154:9: ^( ( '^' | '!' ) atom )
 27.2736 +                    {
 27.2737 +                    dbg.location(154,9);
 27.2738 +                    dbg.location(154,11);
 27.2739 +                    if ( (input.LA(1)>=ROOT && input.LA(1)<=BANG) ) {
 27.2740 +                        input.consume();
 27.2741 +                        state.errorRecovery=false;
 27.2742 +                    }
 27.2743 +                    else {
 27.2744 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 27.2745 +                        dbg.recognitionException(mse);
 27.2746 +                        throw mse;
 27.2747 +                    }
 27.2748 +
 27.2749 +
 27.2750 +                    match(input, Token.DOWN, null); 
 27.2751 +                    dbg.location(154,21);
 27.2752 +                    pushFollow(FOLLOW_atom_in_atom757);
 27.2753 +                    atom();
 27.2754 +
 27.2755 +                    state._fsp--;
 27.2756 +
 27.2757 +
 27.2758 +                    match(input, Token.UP, null); 
 27.2759 +
 27.2760 +                    }
 27.2761 +                    break;
 27.2762 +                case 2 :
 27.2763 +                    dbg.enterAlt(2);
 27.2764 +
 27.2765 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:155:4: range
 27.2766 +                    {
 27.2767 +                    dbg.location(155,4);
 27.2768 +                    pushFollow(FOLLOW_range_in_atom763);
 27.2769 +                    range();
 27.2770 +
 27.2771 +                    state._fsp--;
 27.2772 +
 27.2773 +
 27.2774 +                    }
 27.2775 +                    break;
 27.2776 +                case 3 :
 27.2777 +                    dbg.enterAlt(3);
 27.2778 +
 27.2779 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:156:4: notSet
 27.2780 +                    {
 27.2781 +                    dbg.location(156,4);
 27.2782 +                    pushFollow(FOLLOW_notSet_in_atom768);
 27.2783 +                    notSet();
 27.2784 +
 27.2785 +                    state._fsp--;
 27.2786 +
 27.2787 +
 27.2788 +                    }
 27.2789 +                    break;
 27.2790 +                case 4 :
 27.2791 +                    dbg.enterAlt(4);
 27.2792 +
 27.2793 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:157:7: ^( RULE_REF ARG_ACTION )
 27.2794 +                    {
 27.2795 +                    dbg.location(157,7);
 27.2796 +                    dbg.location(157,9);
 27.2797 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom777); 
 27.2798 +
 27.2799 +                    match(input, Token.DOWN, null); 
 27.2800 +                    dbg.location(157,18);
 27.2801 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_atom779); 
 27.2802 +
 27.2803 +                    match(input, Token.UP, null); 
 27.2804 +
 27.2805 +                    }
 27.2806 +                    break;
 27.2807 +                case 5 :
 27.2808 +                    dbg.enterAlt(5);
 27.2809 +
 27.2810 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:158:7: RULE_REF
 27.2811 +                    {
 27.2812 +                    dbg.location(158,7);
 27.2813 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_atom788); 
 27.2814 +
 27.2815 +                    }
 27.2816 +                    break;
 27.2817 +                case 6 :
 27.2818 +                    dbg.enterAlt(6);
 27.2819 +
 27.2820 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:159:9: terminal
 27.2821 +                    {
 27.2822 +                    dbg.location(159,9);
 27.2823 +                    pushFollow(FOLLOW_terminal_in_atom798);
 27.2824 +                    terminal();
 27.2825 +
 27.2826 +                    state._fsp--;
 27.2827 +
 27.2828 +
 27.2829 +                    }
 27.2830 +                    break;
 27.2831 +
 27.2832 +            }
 27.2833 +        }
 27.2834 +        catch (RecognitionException re) {
 27.2835 +            reportError(re);
 27.2836 +            recover(input,re);
 27.2837 +        }
 27.2838 +        finally {
 27.2839 +        }
 27.2840 +        dbg.location(160, 5);
 27.2841 +
 27.2842 +        }
 27.2843 +        finally {
 27.2844 +            dbg.exitRule(getGrammarFileName(), "atom");
 27.2845 +            decRuleLevel();
 27.2846 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2847 +        }
 27.2848 +
 27.2849 +        return ;
 27.2850 +    }
 27.2851 +    // $ANTLR end "atom"
 27.2852 +
 27.2853 +
 27.2854 +    // $ANTLR start "notSet"
 27.2855 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:162:1: notSet : ( ^( '~' notTerminal ) | ^( '~' block ) );
 27.2856 +    public final void notSet() throws RecognitionException {
 27.2857 +        try { dbg.enterRule(getGrammarFileName(), "notSet");
 27.2858 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2859 +        incRuleLevel();
 27.2860 +        dbg.location(162, 1);
 27.2861 +
 27.2862 +        try {
 27.2863 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:163:2: ( ^( '~' notTerminal ) | ^( '~' block ) )
 27.2864 +            int alt32=2;
 27.2865 +            try { dbg.enterDecision(32, decisionCanBacktrack[32]);
 27.2866 +
 27.2867 +            int LA32_0 = input.LA(1);
 27.2868 +
 27.2869 +            if ( (LA32_0==89) ) {
 27.2870 +                int LA32_1 = input.LA(2);
 27.2871 +
 27.2872 +                if ( (LA32_1==DOWN) ) {
 27.2873 +                    int LA32_2 = input.LA(3);
 27.2874 +
 27.2875 +                    if ( ((LA32_2>=TOKEN_REF && LA32_2<=CHAR_LITERAL)) ) {
 27.2876 +                        alt32=1;
 27.2877 +                    }
 27.2878 +                    else if ( (LA32_2==BLOCK) ) {
 27.2879 +                        alt32=2;
 27.2880 +                    }
 27.2881 +                    else {
 27.2882 +                        NoViableAltException nvae =
 27.2883 +                            new NoViableAltException("", 32, 2, input);
 27.2884 +
 27.2885 +                        dbg.recognitionException(nvae);
 27.2886 +                        throw nvae;
 27.2887 +                    }
 27.2888 +                }
 27.2889 +                else {
 27.2890 +                    NoViableAltException nvae =
 27.2891 +                        new NoViableAltException("", 32, 1, input);
 27.2892 +
 27.2893 +                    dbg.recognitionException(nvae);
 27.2894 +                    throw nvae;
 27.2895 +                }
 27.2896 +            }
 27.2897 +            else {
 27.2898 +                NoViableAltException nvae =
 27.2899 +                    new NoViableAltException("", 32, 0, input);
 27.2900 +
 27.2901 +                dbg.recognitionException(nvae);
 27.2902 +                throw nvae;
 27.2903 +            }
 27.2904 +            } finally {dbg.exitDecision(32);}
 27.2905 +
 27.2906 +            switch (alt32) {
 27.2907 +                case 1 :
 27.2908 +                    dbg.enterAlt(1);
 27.2909 +
 27.2910 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:163:4: ^( '~' notTerminal )
 27.2911 +                    {
 27.2912 +                    dbg.location(163,4);
 27.2913 +                    dbg.location(163,6);
 27.2914 +                    match(input,89,FOLLOW_89_in_notSet813); 
 27.2915 +
 27.2916 +                    match(input, Token.DOWN, null); 
 27.2917 +                    dbg.location(163,10);
 27.2918 +                    pushFollow(FOLLOW_notTerminal_in_notSet815);
 27.2919 +                    notTerminal();
 27.2920 +
 27.2921 +                    state._fsp--;
 27.2922 +
 27.2923 +
 27.2924 +                    match(input, Token.UP, null); 
 27.2925 +
 27.2926 +                    }
 27.2927 +                    break;
 27.2928 +                case 2 :
 27.2929 +                    dbg.enterAlt(2);
 27.2930 +
 27.2931 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:164:4: ^( '~' block )
 27.2932 +                    {
 27.2933 +                    dbg.location(164,4);
 27.2934 +                    dbg.location(164,6);
 27.2935 +                    match(input,89,FOLLOW_89_in_notSet822); 
 27.2936 +
 27.2937 +                    match(input, Token.DOWN, null); 
 27.2938 +                    dbg.location(164,10);
 27.2939 +                    pushFollow(FOLLOW_block_in_notSet824);
 27.2940 +                    block();
 27.2941 +
 27.2942 +                    state._fsp--;
 27.2943 +
 27.2944 +
 27.2945 +                    match(input, Token.UP, null); 
 27.2946 +
 27.2947 +                    }
 27.2948 +                    break;
 27.2949 +
 27.2950 +            }
 27.2951 +        }
 27.2952 +        catch (RecognitionException re) {
 27.2953 +            reportError(re);
 27.2954 +            recover(input,re);
 27.2955 +        }
 27.2956 +        finally {
 27.2957 +        }
 27.2958 +        dbg.location(165, 2);
 27.2959 +
 27.2960 +        }
 27.2961 +        finally {
 27.2962 +            dbg.exitRule(getGrammarFileName(), "notSet");
 27.2963 +            decRuleLevel();
 27.2964 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.2965 +        }
 27.2966 +
 27.2967 +        return ;
 27.2968 +    }
 27.2969 +    // $ANTLR end "notSet"
 27.2970 +
 27.2971 +
 27.2972 +    // $ANTLR start "treeSpec"
 27.2973 +    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:167:1: treeSpec : ^( TREE_BEGIN ( element )+ ) ;
 27.2974 +    public final void treeSpec() throws RecognitionException {
 27.2975 +        try { dbg.enterRule(getGrammarFileName(), "treeSpec");
 27.2976 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.2977 +        incRuleLevel();
 27.2978 +        dbg.location(167, 1);
 27.2979 +
 27.2980 +        try {
 27.2981 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:2: ( ^( TREE_BEGIN ( element )+ ) )
 27.2982 +            dbg.enterAlt(1);
 27.2983 +
 27.2984 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:4: ^( TREE_BEGIN ( element )+ )
 27.2985 +            {
 27.2986 +            dbg.location(168,4);
 27.2987 +            dbg.location(168,6);
 27.2988 +            match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_treeSpec837); 
 27.2989 +
 27.2990 +            match(input, Token.DOWN, null); 
 27.2991 +            dbg.location(168,17);
 27.2992 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:17: ( element )+
 27.2993 +            int cnt33=0;
 27.2994 +            try { dbg.enterSubRule(33);
 27.2995 +
 27.2996 +            loop33:
 27.2997 +            do {
 27.2998 +                int alt33=2;
 27.2999 +                try { dbg.enterDecision(33, decisionCanBacktrack[33]);
 27.3000 +
 27.3001 +                int LA33_0 = input.LA(1);
 27.3002 +
 27.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) ) {
 27.3004 +                    alt33=1;
 27.3005 +                }
 27.3006 +
 27.3007 +
 27.3008 +                } finally {dbg.exitDecision(33);}
 27.3009 +
 27.3010 +                switch (alt33) {
 27.3011 +            	case 1 :
 27.3012 +            	    dbg.enterAlt(1);
 27.3013 +
 27.3014 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:168:17: element
 27.3015 +            	    {
 27.3016 +            	    dbg.location(168,17);
 27.3017 +            	    pushFollow(FOLLOW_element_in_treeSpec839);
 27.3018 +            	    element();
 27.3019 +
 27.3020 +            	    state._fsp--;
 27.3021 +
 27.3022 +
 27.3023 +            	    }
 27.3024 +            	    break;
 27.3025 +
 27.3026 +            	default :
 27.3027 +            	    if ( cnt33 >= 1 ) break loop33;
 27.3028 +                        EarlyExitException eee =
 27.3029 +                            new EarlyExitException(33, input);
 27.3030 +                        dbg.recognitionException(eee);
 27.3031 +
 27.3032 +                        throw eee;
 27.3033 +                }
 27.3034 +                cnt33++;
 27.3035 +            } while (true);
 27.3036 +            } finally {dbg.exitSubRule(33);}
 27.3037 +
 27.3038 +
 27.3039 +            match(input, Token.UP, null); 
 27.3040 +
 27.3041 +            }
 27.3042 +
 27.3043 +        }
 27.3044 +        catch (RecognitionException re) {
 27.3045 +            reportError(re);
 27.3046 +            recover(input,re);
 27.3047 +        }
 27.3048 +        finally {
 27.3049 +        }
 27.3050 +        dbg.location(169, 2);
 27.3051 +
 27.3052 +        }
 27.3053 +        finally {
 27.3054 +            dbg.exitRule(getGrammarFileName(), "treeSpec");
 27.3055 +            decRuleLevel();
 27.3056 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3057 +        }
 27.3058 +
 27.3059 +        return ;
 27.3060 +    }
 27.3061 +    // $ANTLR end "treeSpec"
 27.3062 +
 27.3063 +
 27.3064 +    // $ANTLR start "ebnf"
 27.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 );
 27.3066 +    public final void ebnf() throws RecognitionException {
 27.3067 +        try { dbg.enterRule(getGrammarFileName(), "ebnf");
 27.3068 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3069 +        incRuleLevel();
 27.3070 +        dbg.location(171, 1);
 27.3071 +
 27.3072 +        try {
 27.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 )
 27.3074 +            int alt34=4;
 27.3075 +            try { dbg.enterDecision(34, decisionCanBacktrack[34]);
 27.3076 +
 27.3077 +            switch ( input.LA(1) ) {
 27.3078 +            case SYNPRED:
 27.3079 +                {
 27.3080 +                alt34=1;
 27.3081 +                }
 27.3082 +                break;
 27.3083 +            case SYN_SEMPRED:
 27.3084 +                {
 27.3085 +                alt34=2;
 27.3086 +                }
 27.3087 +                break;
 27.3088 +            case OPTIONAL:
 27.3089 +            case CLOSURE:
 27.3090 +            case POSITIVE_CLOSURE:
 27.3091 +                {
 27.3092 +                alt34=3;
 27.3093 +                }
 27.3094 +                break;
 27.3095 +            case BLOCK:
 27.3096 +                {
 27.3097 +                alt34=4;
 27.3098 +                }
 27.3099 +                break;
 27.3100 +            default:
 27.3101 +                NoViableAltException nvae =
 27.3102 +                    new NoViableAltException("", 34, 0, input);
 27.3103 +
 27.3104 +                dbg.recognitionException(nvae);
 27.3105 +                throw nvae;
 27.3106 +            }
 27.3107 +
 27.3108 +            } finally {dbg.exitDecision(34);}
 27.3109 +
 27.3110 +            switch (alt34) {
 27.3111 +                case 1 :
 27.3112 +                    dbg.enterAlt(1);
 27.3113 +
 27.3114 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:173:4: ^( SYNPRED block )
 27.3115 +                    {
 27.3116 +                    dbg.location(173,4);
 27.3117 +                    dbg.location(173,6);
 27.3118 +                    match(input,SYNPRED,FOLLOW_SYNPRED_in_ebnf855); 
 27.3119 +
 27.3120 +                    match(input, Token.DOWN, null); 
 27.3121 +                    dbg.location(173,14);
 27.3122 +                    pushFollow(FOLLOW_block_in_ebnf857);
 27.3123 +                    block();
 27.3124 +
 27.3125 +                    state._fsp--;
 27.3126 +
 27.3127 +
 27.3128 +                    match(input, Token.UP, null); 
 27.3129 +
 27.3130 +                    }
 27.3131 +                    break;
 27.3132 +                case 2 :
 27.3133 +                    dbg.enterAlt(2);
 27.3134 +
 27.3135 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:174:4: SYN_SEMPRED
 27.3136 +                    {
 27.3137 +                    dbg.location(174,4);
 27.3138 +                    match(input,SYN_SEMPRED,FOLLOW_SYN_SEMPRED_in_ebnf863); 
 27.3139 +
 27.3140 +                    }
 27.3141 +                    break;
 27.3142 +                case 3 :
 27.3143 +                    dbg.enterAlt(3);
 27.3144 +
 27.3145 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:175:4: ^( ebnfSuffix block )
 27.3146 +                    {
 27.3147 +                    dbg.location(175,4);
 27.3148 +                    dbg.location(175,6);
 27.3149 +                    pushFollow(FOLLOW_ebnfSuffix_in_ebnf869);
 27.3150 +                    ebnfSuffix();
 27.3151 +
 27.3152 +                    state._fsp--;
 27.3153 +
 27.3154 +
 27.3155 +                    match(input, Token.DOWN, null); 
 27.3156 +                    dbg.location(175,17);
 27.3157 +                    pushFollow(FOLLOW_block_in_ebnf871);
 27.3158 +                    block();
 27.3159 +
 27.3160 +                    state._fsp--;
 27.3161 +
 27.3162 +
 27.3163 +                    match(input, Token.UP, null); 
 27.3164 +
 27.3165 +                    }
 27.3166 +                    break;
 27.3167 +                case 4 :
 27.3168 +                    dbg.enterAlt(4);
 27.3169 +
 27.3170 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:176:4: block
 27.3171 +                    {
 27.3172 +                    dbg.location(176,4);
 27.3173 +                    pushFollow(FOLLOW_block_in_ebnf877);
 27.3174 +                    block();
 27.3175 +
 27.3176 +                    state._fsp--;
 27.3177 +
 27.3178 +
 27.3179 +                    }
 27.3180 +                    break;
 27.3181 +
 27.3182 +            }
 27.3183 +        }
 27.3184 +        catch (RecognitionException re) {
 27.3185 +            reportError(re);
 27.3186 +            recover(input,re);
 27.3187 +        }
 27.3188 +        finally {
 27.3189 +        }
 27.3190 +        dbg.location(177, 2);
 27.3191 +
 27.3192 +        }
 27.3193 +        finally {
 27.3194 +            dbg.exitRule(getGrammarFileName(), "ebnf");
 27.3195 +            decRuleLevel();
 27.3196 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3197 +        }
 27.3198 +
 27.3199 +        return ;
 27.3200 +    }
 27.3201 +    // $ANTLR end "ebnf"
 27.3202 +
 27.3203 +
 27.3204 +    // $ANTLR start "range"
 27.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 ) ;
 27.3206 +    public final void range() throws RecognitionException {
 27.3207 +        try { dbg.enterRule(getGrammarFileName(), "range");
 27.3208 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3209 +        incRuleLevel();
 27.3210 +        dbg.location(179, 1);
 27.3211 +
 27.3212 +        try {
 27.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 ) )
 27.3214 +            dbg.enterAlt(1);
 27.3215 +
 27.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 )
 27.3217 +            {
 27.3218 +            dbg.location(180,4);
 27.3219 +            dbg.location(180,6);
 27.3220 +            match(input,CHAR_RANGE,FOLLOW_CHAR_RANGE_in_range889); 
 27.3221 +
 27.3222 +            match(input, Token.DOWN, null); 
 27.3223 +            dbg.location(180,17);
 27.3224 +            match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_range891); 
 27.3225 +            dbg.location(180,30);
 27.3226 +            match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_range893); 
 27.3227 +
 27.3228 +            match(input, Token.UP, null); 
 27.3229 +
 27.3230 +            }
 27.3231 +
 27.3232 +        }
 27.3233 +        catch (RecognitionException re) {
 27.3234 +            reportError(re);
 27.3235 +            recover(input,re);
 27.3236 +        }
 27.3237 +        finally {
 27.3238 +        }
 27.3239 +        dbg.location(181, 2);
 27.3240 +
 27.3241 +        }
 27.3242 +        finally {
 27.3243 +            dbg.exitRule(getGrammarFileName(), "range");
 27.3244 +            decRuleLevel();
 27.3245 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3246 +        }
 27.3247 +
 27.3248 +        return ;
 27.3249 +    }
 27.3250 +    // $ANTLR end "range"
 27.3251 +
 27.3252 +
 27.3253 +    // $ANTLR start "terminal"
 27.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 ) | '.' );
 27.3255 +    public final void terminal() throws RecognitionException {
 27.3256 +        try { dbg.enterRule(getGrammarFileName(), "terminal");
 27.3257 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3258 +        incRuleLevel();
 27.3259 +        dbg.location(183, 1);
 27.3260 +
 27.3261 +        try {
 27.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 ) | '.' )
 27.3263 +            int alt35=5;
 27.3264 +            try { dbg.enterDecision(35, decisionCanBacktrack[35]);
 27.3265 +
 27.3266 +            switch ( input.LA(1) ) {
 27.3267 +            case CHAR_LITERAL:
 27.3268 +                {
 27.3269 +                alt35=1;
 27.3270 +                }
 27.3271 +                break;
 27.3272 +            case TOKEN_REF:
 27.3273 +                {
 27.3274 +                int LA35_2 = input.LA(2);
 27.3275 +
 27.3276 +                if ( (LA35_2==DOWN) ) {
 27.3277 +                    alt35=4;
 27.3278 +                }
 27.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) ) {
 27.3280 +                    alt35=2;
 27.3281 +                }
 27.3282 +                else {
 27.3283 +                    NoViableAltException nvae =
 27.3284 +                        new NoViableAltException("", 35, 2, input);
 27.3285 +
 27.3286 +                    dbg.recognitionException(nvae);
 27.3287 +                    throw nvae;
 27.3288 +                }
 27.3289 +                }
 27.3290 +                break;
 27.3291 +            case STRING_LITERAL:
 27.3292 +                {
 27.3293 +                alt35=3;
 27.3294 +                }
 27.3295 +                break;
 27.3296 +            case 92:
 27.3297 +                {
 27.3298 +                alt35=5;
 27.3299 +                }
 27.3300 +                break;
 27.3301 +            default:
 27.3302 +                NoViableAltException nvae =
 27.3303 +                    new NoViableAltException("", 35, 0, input);
 27.3304 +
 27.3305 +                dbg.recognitionException(nvae);
 27.3306 +                throw nvae;
 27.3307 +            }
 27.3308 +
 27.3309 +            } finally {dbg.exitDecision(35);}
 27.3310 +
 27.3311 +            switch (alt35) {
 27.3312 +                case 1 :
 27.3313 +                    dbg.enterAlt(1);
 27.3314 +
 27.3315 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:184:9: CHAR_LITERAL
 27.3316 +                    {
 27.3317 +                    dbg.location(184,9);
 27.3318 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_terminal910); 
 27.3319 +
 27.3320 +                    }
 27.3321 +                    break;
 27.3322 +                case 2 :
 27.3323 +                    dbg.enterAlt(2);
 27.3324 +
 27.3325 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:185:7: TOKEN_REF
 27.3326 +                    {
 27.3327 +                    dbg.location(185,7);
 27.3328 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal918); 
 27.3329 +
 27.3330 +                    }
 27.3331 +                    break;
 27.3332 +                case 3 :
 27.3333 +                    dbg.enterAlt(3);
 27.3334 +
 27.3335 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:186:7: STRING_LITERAL
 27.3336 +                    {
 27.3337 +                    dbg.location(186,7);
 27.3338 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal926); 
 27.3339 +
 27.3340 +                    }
 27.3341 +                    break;
 27.3342 +                case 4 :
 27.3343 +                    dbg.enterAlt(4);
 27.3344 +
 27.3345 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:187:7: ^( TOKEN_REF ARG_ACTION )
 27.3346 +                    {
 27.3347 +                    dbg.location(187,7);
 27.3348 +                    dbg.location(187,9);
 27.3349 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal935); 
 27.3350 +
 27.3351 +                    match(input, Token.DOWN, null); 
 27.3352 +                    dbg.location(187,19);
 27.3353 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal937); 
 27.3354 +
 27.3355 +                    match(input, Token.UP, null); 
 27.3356 +
 27.3357 +                    }
 27.3358 +                    break;
 27.3359 +                case 5 :
 27.3360 +                    dbg.enterAlt(5);
 27.3361 +
 27.3362 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:188:7: '.'
 27.3363 +                    {
 27.3364 +                    dbg.location(188,7);
 27.3365 +                    match(input,92,FOLLOW_92_in_terminal946); 
 27.3366 +
 27.3367 +                    }
 27.3368 +                    break;
 27.3369 +
 27.3370 +            }
 27.3371 +        }
 27.3372 +        catch (RecognitionException re) {
 27.3373 +            reportError(re);
 27.3374 +            recover(input,re);
 27.3375 +        }
 27.3376 +        finally {
 27.3377 +        }
 27.3378 +        dbg.location(189, 2);
 27.3379 +
 27.3380 +        }
 27.3381 +        finally {
 27.3382 +            dbg.exitRule(getGrammarFileName(), "terminal");
 27.3383 +            decRuleLevel();
 27.3384 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3385 +        }
 27.3386 +
 27.3387 +        return ;
 27.3388 +    }
 27.3389 +    // $ANTLR end "terminal"
 27.3390 +
 27.3391 +
 27.3392 +    // $ANTLR start "notTerminal"
 27.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 );
 27.3394 +    public final void notTerminal() throws RecognitionException {
 27.3395 +        try { dbg.enterRule(getGrammarFileName(), "notTerminal");
 27.3396 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3397 +        incRuleLevel();
 27.3398 +        dbg.location(191, 1);
 27.3399 +
 27.3400 +        try {
 27.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 )
 27.3402 +            dbg.enterAlt(1);
 27.3403 +
 27.3404 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 27.3405 +            {
 27.3406 +            dbg.location(192,2);
 27.3407 +            if ( (input.LA(1)>=TOKEN_REF && input.LA(1)<=CHAR_LITERAL) ) {
 27.3408 +                input.consume();
 27.3409 +                state.errorRecovery=false;
 27.3410 +            }
 27.3411 +            else {
 27.3412 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 27.3413 +                dbg.recognitionException(mse);
 27.3414 +                throw mse;
 27.3415 +            }
 27.3416 +
 27.3417 +
 27.3418 +            }
 27.3419 +
 27.3420 +        }
 27.3421 +        catch (RecognitionException re) {
 27.3422 +            reportError(re);
 27.3423 +            recover(input,re);
 27.3424 +        }
 27.3425 +        finally {
 27.3426 +        }
 27.3427 +        dbg.location(195, 2);
 27.3428 +
 27.3429 +        }
 27.3430 +        finally {
 27.3431 +            dbg.exitRule(getGrammarFileName(), "notTerminal");
 27.3432 +            decRuleLevel();
 27.3433 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3434 +        }
 27.3435 +
 27.3436 +        return ;
 27.3437 +    }
 27.3438 +    // $ANTLR end "notTerminal"
 27.3439 +
 27.3440 +
 27.3441 +    // $ANTLR start "ebnfSuffix"
 27.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 );
 27.3443 +    public final void ebnfSuffix() throws RecognitionException {
 27.3444 +        try { dbg.enterRule(getGrammarFileName(), "ebnfSuffix");
 27.3445 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3446 +        incRuleLevel();
 27.3447 +        dbg.location(197, 1);
 27.3448 +
 27.3449 +        try {
 27.3450 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:198:2: ( OPTIONAL | CLOSURE | POSITIVE_CLOSURE )
 27.3451 +            dbg.enterAlt(1);
 27.3452 +
 27.3453 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:
 27.3454 +            {
 27.3455 +            dbg.location(198,2);
 27.3456 +            if ( (input.LA(1)>=OPTIONAL && input.LA(1)<=POSITIVE_CLOSURE) ) {
 27.3457 +                input.consume();
 27.3458 +                state.errorRecovery=false;
 27.3459 +            }
 27.3460 +            else {
 27.3461 +                MismatchedSetException mse = new MismatchedSetException(null,input);
 27.3462 +                dbg.recognitionException(mse);
 27.3463 +                throw mse;
 27.3464 +            }
 27.3465 +
 27.3466 +
 27.3467 +            }
 27.3468 +
 27.3469 +        }
 27.3470 +        catch (RecognitionException re) {
 27.3471 +            reportError(re);
 27.3472 +            recover(input,re);
 27.3473 +        }
 27.3474 +        finally {
 27.3475 +        }
 27.3476 +        dbg.location(201, 2);
 27.3477 +
 27.3478 +        }
 27.3479 +        finally {
 27.3480 +            dbg.exitRule(getGrammarFileName(), "ebnfSuffix");
 27.3481 +            decRuleLevel();
 27.3482 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3483 +        }
 27.3484 +
 27.3485 +        return ;
 27.3486 +    }
 27.3487 +    // $ANTLR end "ebnfSuffix"
 27.3488 +
 27.3489 +
 27.3490 +    // $ANTLR start "rewrite"
 27.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 ) | );
 27.3492 +    public final void rewrite() throws RecognitionException {
 27.3493 +        try { dbg.enterRule(getGrammarFileName(), "rewrite");
 27.3494 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3495 +        incRuleLevel();
 27.3496 +        dbg.location(205, 1);
 27.3497 +
 27.3498 +        try {
 27.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 ) | )
 27.3500 +            int alt37=2;
 27.3501 +            try { dbg.enterDecision(37, decisionCanBacktrack[37]);
 27.3502 +
 27.3503 +            int LA37_0 = input.LA(1);
 27.3504 +
 27.3505 +            if ( (LA37_0==REWRITE) ) {
 27.3506 +                alt37=1;
 27.3507 +            }
 27.3508 +            else if ( (LA37_0==ALT||LA37_0==EOB) ) {
 27.3509 +                alt37=2;
 27.3510 +            }
 27.3511 +            else {
 27.3512 +                NoViableAltException nvae =
 27.3513 +                    new NoViableAltException("", 37, 0, input);
 27.3514 +
 27.3515 +                dbg.recognitionException(nvae);
 27.3516 +                throw nvae;
 27.3517 +            }
 27.3518 +            } finally {dbg.exitDecision(37);}
 27.3519 +
 27.3520 +            switch (alt37) {
 27.3521 +                case 1 :
 27.3522 +                    dbg.enterAlt(1);
 27.3523 +
 27.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 )
 27.3525 +                    {
 27.3526 +                    dbg.location(206,4);
 27.3527 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:4: ( ^( '->' SEMPRED rewrite_alternative ) )*
 27.3528 +                    try { dbg.enterSubRule(36);
 27.3529 +
 27.3530 +                    loop36:
 27.3531 +                    do {
 27.3532 +                        int alt36=2;
 27.3533 +                        try { dbg.enterDecision(36, decisionCanBacktrack[36]);
 27.3534 +
 27.3535 +                        int LA36_0 = input.LA(1);
 27.3536 +
 27.3537 +                        if ( (LA36_0==REWRITE) ) {
 27.3538 +                            int LA36_1 = input.LA(2);
 27.3539 +
 27.3540 +                            if ( (LA36_1==DOWN) ) {
 27.3541 +                                int LA36_2 = input.LA(3);
 27.3542 +
 27.3543 +                                if ( (LA36_2==SEMPRED) ) {
 27.3544 +                                    alt36=1;
 27.3545 +                                }
 27.3546 +
 27.3547 +
 27.3548 +                            }
 27.3549 +
 27.3550 +
 27.3551 +                        }
 27.3552 +
 27.3553 +
 27.3554 +                        } finally {dbg.exitDecision(36);}
 27.3555 +
 27.3556 +                        switch (alt36) {
 27.3557 +                    	case 1 :
 27.3558 +                    	    dbg.enterAlt(1);
 27.3559 +
 27.3560 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:206:5: ^( '->' SEMPRED rewrite_alternative )
 27.3561 +                    	    {
 27.3562 +                    	    dbg.location(206,5);
 27.3563 +                    	    dbg.location(206,7);
 27.3564 +                    	    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1012); 
 27.3565 +
 27.3566 +                    	    match(input, Token.DOWN, null); 
 27.3567 +                    	    dbg.location(206,12);
 27.3568 +                    	    match(input,SEMPRED,FOLLOW_SEMPRED_in_rewrite1014); 
 27.3569 +                    	    dbg.location(206,20);
 27.3570 +                    	    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1016);
 27.3571 +                    	    rewrite_alternative();
 27.3572 +
 27.3573 +                    	    state._fsp--;
 27.3574 +
 27.3575 +
 27.3576 +                    	    match(input, Token.UP, null); 
 27.3577 +
 27.3578 +                    	    }
 27.3579 +                    	    break;
 27.3580 +
 27.3581 +                    	default :
 27.3582 +                    	    break loop36;
 27.3583 +                        }
 27.3584 +                    } while (true);
 27.3585 +                    } finally {dbg.exitSubRule(36);}
 27.3586 +
 27.3587 +                    dbg.location(206,43);
 27.3588 +                    dbg.location(206,45);
 27.3589 +                    match(input,REWRITE,FOLLOW_REWRITE_in_rewrite1022); 
 27.3590 +
 27.3591 +                    match(input, Token.DOWN, null); 
 27.3592 +                    dbg.location(206,50);
 27.3593 +                    pushFollow(FOLLOW_rewrite_alternative_in_rewrite1024);
 27.3594 +                    rewrite_alternative();
 27.3595 +
 27.3596 +                    state._fsp--;
 27.3597 +
 27.3598 +
 27.3599 +                    match(input, Token.UP, null); 
 27.3600 +
 27.3601 +                    }
 27.3602 +                    break;
 27.3603 +                case 2 :
 27.3604 +                    dbg.enterAlt(2);
 27.3605 +
 27.3606 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:208:2: 
 27.3607 +                    {
 27.3608 +                    }
 27.3609 +                    break;
 27.3610 +
 27.3611 +            }
 27.3612 +        }
 27.3613 +        catch (RecognitionException re) {
 27.3614 +            reportError(re);
 27.3615 +            recover(input,re);
 27.3616 +        }
 27.3617 +        finally {
 27.3618 +        }
 27.3619 +        dbg.location(208, 2);
 27.3620 +
 27.3621 +        }
 27.3622 +        finally {
 27.3623 +            dbg.exitRule(getGrammarFileName(), "rewrite");
 27.3624 +            decRuleLevel();
 27.3625 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3626 +        }
 27.3627 +
 27.3628 +        return ;
 27.3629 +    }
 27.3630 +    // $ANTLR end "rewrite"
 27.3631 +
 27.3632 +
 27.3633 +    // $ANTLR start "rewrite_alternative"
 27.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 ) );
 27.3635 +    public final void rewrite_alternative() throws RecognitionException {
 27.3636 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_alternative");
 27.3637 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3638 +        incRuleLevel();
 27.3639 +        dbg.location(210, 1);
 27.3640 +
 27.3641 +        try {
 27.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 ) )
 27.3643 +            int alt38=3;
 27.3644 +            try { dbg.enterDecision(38, decisionCanBacktrack[38]);
 27.3645 +
 27.3646 +            int LA38_0 = input.LA(1);
 27.3647 +
 27.3648 +            if ( (LA38_0==TEMPLATE||LA38_0==ACTION) ) {
 27.3649 +                alt38=1;
 27.3650 +            }
 27.3651 +            else if ( (LA38_0==ALT) ) {
 27.3652 +                int LA38_2 = input.LA(2);
 27.3653 +
 27.3654 +                if ( (LA38_2==DOWN) ) {
 27.3655 +                    int LA38_3 = input.LA(3);
 27.3656 +
 27.3657 +                    if ( (LA38_3==EPSILON) ) {
 27.3658 +                        alt38=3;
 27.3659 +                    }
 27.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) ) {
 27.3661 +                        alt38=2;
 27.3662 +                    }
 27.3663 +                    else {
 27.3664 +                        NoViableAltException nvae =
 27.3665 +                            new NoViableAltException("", 38, 3, input);
 27.3666 +
 27.3667 +                        dbg.recognitionException(nvae);
 27.3668 +                        throw nvae;
 27.3669 +                    }
 27.3670 +                }
 27.3671 +                else {
 27.3672 +                    NoViableAltException nvae =
 27.3673 +                        new NoViableAltException("", 38, 2, input);
 27.3674 +
 27.3675 +                    dbg.recognitionException(nvae);
 27.3676 +                    throw nvae;
 27.3677 +                }
 27.3678 +            }
 27.3679 +            else {
 27.3680 +                NoViableAltException nvae =
 27.3681 +                    new NoViableAltException("", 38, 0, input);
 27.3682 +
 27.3683 +                dbg.recognitionException(nvae);
 27.3684 +                throw nvae;
 27.3685 +            }
 27.3686 +            } finally {dbg.exitDecision(38);}
 27.3687 +
 27.3688 +            switch (alt38) {
 27.3689 +                case 1 :
 27.3690 +                    dbg.enterAlt(1);
 27.3691 +
 27.3692 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:211:4: rewrite_template
 27.3693 +                    {
 27.3694 +                    dbg.location(211,4);
 27.3695 +                    pushFollow(FOLLOW_rewrite_template_in_rewrite_alternative1039);
 27.3696 +                    rewrite_template();
 27.3697 +
 27.3698 +                    state._fsp--;
 27.3699 +
 27.3700 +
 27.3701 +                    }
 27.3702 +                    break;
 27.3703 +                case 2 :
 27.3704 +                    dbg.enterAlt(2);
 27.3705 +
 27.3706 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:212:4: rewrite_tree_alternative
 27.3707 +                    {
 27.3708 +                    dbg.location(212,4);
 27.3709 +                    pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_alternative1044);
 27.3710 +                    rewrite_tree_alternative();
 27.3711 +
 27.3712 +                    state._fsp--;
 27.3713 +
 27.3714 +
 27.3715 +                    }
 27.3716 +                    break;
 27.3717 +                case 3 :
 27.3718 +                    dbg.enterAlt(3);
 27.3719 +
 27.3720 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:213:9: ^( ALT EPSILON EOA )
 27.3721 +                    {
 27.3722 +                    dbg.location(213,9);
 27.3723 +                    dbg.location(213,11);
 27.3724 +                    match(input,ALT,FOLLOW_ALT_in_rewrite_alternative1055); 
 27.3725 +
 27.3726 +                    match(input, Token.DOWN, null); 
 27.3727 +                    dbg.location(213,15);
 27.3728 +                    match(input,EPSILON,FOLLOW_EPSILON_in_rewrite_alternative1057); 
 27.3729 +                    dbg.location(213,23);
 27.3730 +                    match(input,EOA,FOLLOW_EOA_in_rewrite_alternative1059); 
 27.3731 +
 27.3732 +                    match(input, Token.UP, null); 
 27.3733 +
 27.3734 +                    }
 27.3735 +                    break;
 27.3736 +
 27.3737 +            }
 27.3738 +        }
 27.3739 +        catch (RecognitionException re) {
 27.3740 +            reportError(re);
 27.3741 +            recover(input,re);
 27.3742 +        }
 27.3743 +        finally {
 27.3744 +        }
 27.3745 +        dbg.location(214, 2);
 27.3746 +
 27.3747 +        }
 27.3748 +        finally {
 27.3749 +            dbg.exitRule(getGrammarFileName(), "rewrite_alternative");
 27.3750 +            decRuleLevel();
 27.3751 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3752 +        }
 27.3753 +
 27.3754 +        return ;
 27.3755 +    }
 27.3756 +    // $ANTLR end "rewrite_alternative"
 27.3757 +
 27.3758 +
 27.3759 +    // $ANTLR start "rewrite_tree_block"
 27.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 ) ;
 27.3761 +    public final void rewrite_tree_block() throws RecognitionException {
 27.3762 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_block");
 27.3763 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3764 +        incRuleLevel();
 27.3765 +        dbg.location(216, 1);
 27.3766 +
 27.3767 +        try {
 27.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 ) )
 27.3769 +            dbg.enterAlt(1);
 27.3770 +
 27.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 )
 27.3772 +            {
 27.3773 +            dbg.location(217,9);
 27.3774 +            dbg.location(217,11);
 27.3775 +            match(input,BLOCK,FOLLOW_BLOCK_in_rewrite_tree_block1078); 
 27.3776 +
 27.3777 +            match(input, Token.DOWN, null); 
 27.3778 +            dbg.location(217,17);
 27.3779 +            pushFollow(FOLLOW_rewrite_tree_alternative_in_rewrite_tree_block1080);
 27.3780 +            rewrite_tree_alternative();
 27.3781 +
 27.3782 +            state._fsp--;
 27.3783 +
 27.3784 +            dbg.location(217,42);
 27.3785 +            match(input,EOB,FOLLOW_EOB_in_rewrite_tree_block1082); 
 27.3786 +
 27.3787 +            match(input, Token.UP, null); 
 27.3788 +
 27.3789 +            }
 27.3790 +
 27.3791 +        }
 27.3792 +        catch (RecognitionException re) {
 27.3793 +            reportError(re);
 27.3794 +            recover(input,re);
 27.3795 +        }
 27.3796 +        finally {
 27.3797 +        }
 27.3798 +        dbg.location(218, 5);
 27.3799 +
 27.3800 +        }
 27.3801 +        finally {
 27.3802 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_block");
 27.3803 +            decRuleLevel();
 27.3804 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3805 +        }
 27.3806 +
 27.3807 +        return ;
 27.3808 +    }
 27.3809 +    // $ANTLR end "rewrite_tree_block"
 27.3810 +
 27.3811 +
 27.3812 +    // $ANTLR start "rewrite_tree_alternative"
 27.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 ) ;
 27.3814 +    public final void rewrite_tree_alternative() throws RecognitionException {
 27.3815 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_alternative");
 27.3816 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3817 +        incRuleLevel();
 27.3818 +        dbg.location(220, 1);
 27.3819 +
 27.3820 +        try {
 27.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 ) )
 27.3822 +            dbg.enterAlt(1);
 27.3823 +
 27.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 )
 27.3825 +            {
 27.3826 +            dbg.location(221,7);
 27.3827 +            dbg.location(221,9);
 27.3828 +            match(input,ALT,FOLLOW_ALT_in_rewrite_tree_alternative1101); 
 27.3829 +
 27.3830 +            match(input, Token.DOWN, null); 
 27.3831 +            dbg.location(221,13);
 27.3832 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:13: ( rewrite_tree_element )+
 27.3833 +            int cnt39=0;
 27.3834 +            try { dbg.enterSubRule(39);
 27.3835 +
 27.3836 +            loop39:
 27.3837 +            do {
 27.3838 +                int alt39=2;
 27.3839 +                try { dbg.enterDecision(39, decisionCanBacktrack[39]);
 27.3840 +
 27.3841 +                int LA39_0 = input.LA(1);
 27.3842 +
 27.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) ) {
 27.3844 +                    alt39=1;
 27.3845 +                }
 27.3846 +
 27.3847 +
 27.3848 +                } finally {dbg.exitDecision(39);}
 27.3849 +
 27.3850 +                switch (alt39) {
 27.3851 +            	case 1 :
 27.3852 +            	    dbg.enterAlt(1);
 27.3853 +
 27.3854 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:221:13: rewrite_tree_element
 27.3855 +            	    {
 27.3856 +            	    dbg.location(221,13);
 27.3857 +            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree_alternative1103);
 27.3858 +            	    rewrite_tree_element();
 27.3859 +
 27.3860 +            	    state._fsp--;
 27.3861 +
 27.3862 +
 27.3863 +            	    }
 27.3864 +            	    break;
 27.3865 +
 27.3866 +            	default :
 27.3867 +            	    if ( cnt39 >= 1 ) break loop39;
 27.3868 +                        EarlyExitException eee =
 27.3869 +                            new EarlyExitException(39, input);
 27.3870 +                        dbg.recognitionException(eee);
 27.3871 +
 27.3872 +                        throw eee;
 27.3873 +                }
 27.3874 +                cnt39++;
 27.3875 +            } while (true);
 27.3876 +            } finally {dbg.exitSubRule(39);}
 27.3877 +
 27.3878 +            dbg.location(221,35);
 27.3879 +            match(input,EOA,FOLLOW_EOA_in_rewrite_tree_alternative1106); 
 27.3880 +
 27.3881 +            match(input, Token.UP, null); 
 27.3882 +
 27.3883 +            }
 27.3884 +
 27.3885 +        }
 27.3886 +        catch (RecognitionException re) {
 27.3887 +            reportError(re);
 27.3888 +            recover(input,re);
 27.3889 +        }
 27.3890 +        finally {
 27.3891 +        }
 27.3892 +        dbg.location(222, 5);
 27.3893 +
 27.3894 +        }
 27.3895 +        finally {
 27.3896 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_alternative");
 27.3897 +            decRuleLevel();
 27.3898 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.3899 +        }
 27.3900 +
 27.3901 +        return ;
 27.3902 +    }
 27.3903 +    // $ANTLR end "rewrite_tree_alternative"
 27.3904 +
 27.3905 +
 27.3906 +    // $ANTLR start "rewrite_tree_element"
 27.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 );
 27.3908 +    public final void rewrite_tree_element() throws RecognitionException {
 27.3909 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_element");
 27.3910 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.3911 +        incRuleLevel();
 27.3912 +        dbg.location(224, 1);
 27.3913 +
 27.3914 +        try {
 27.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 )
 27.3916 +            int alt40=4;
 27.3917 +            try { dbg.enterDecision(40, decisionCanBacktrack[40]);
 27.3918 +
 27.3919 +            switch ( input.LA(1) ) {
 27.3920 +            case LABEL:
 27.3921 +            case TOKEN_REF:
 27.3922 +            case STRING_LITERAL:
 27.3923 +            case CHAR_LITERAL:
 27.3924 +            case ACTION:
 27.3925 +            case RULE_REF:
 27.3926 +                {
 27.3927 +                alt40=1;
 27.3928 +                }
 27.3929 +                break;
 27.3930 +            case TREE_BEGIN:
 27.3931 +                {
 27.3932 +                alt40=2;
 27.3933 +                }
 27.3934 +                break;
 27.3935 +            case BLOCK:
 27.3936 +                {
 27.3937 +                alt40=3;
 27.3938 +                }
 27.3939 +                break;
 27.3940 +            case OPTIONAL:
 27.3941 +            case CLOSURE:
 27.3942 +            case POSITIVE_CLOSURE:
 27.3943 +                {
 27.3944 +                alt40=4;
 27.3945 +                }
 27.3946 +                break;
 27.3947 +            default:
 27.3948 +                NoViableAltException nvae =
 27.3949 +                    new NoViableAltException("", 40, 0, input);
 27.3950 +
 27.3951 +                dbg.recognitionException(nvae);
 27.3952 +                throw nvae;
 27.3953 +            }
 27.3954 +
 27.3955 +            } finally {dbg.exitDecision(40);}
 27.3956 +
 27.3957 +            switch (alt40) {
 27.3958 +                case 1 :
 27.3959 +                    dbg.enterAlt(1);
 27.3960 +
 27.3961 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:225:4: rewrite_tree_atom
 27.3962 +                    {
 27.3963 +                    dbg.location(225,4);
 27.3964 +                    pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree_element1121);
 27.3965 +                    rewrite_tree_atom();
 27.3966 +
 27.3967 +                    state._fsp--;
 27.3968 +
 27.3969 +
 27.3970 +                    }
 27.3971 +                    break;
 27.3972 +                case 2 :
 27.3973 +                    dbg.enterAlt(2);
 27.3974 +
 27.3975 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:226:4: rewrite_tree
 27.3976 +                    {
 27.3977 +                    dbg.location(226,4);
 27.3978 +                    pushFollow(FOLLOW_rewrite_tree_in_rewrite_tree_element1126);
 27.3979 +                    rewrite_tree();
 27.3980 +
 27.3981 +                    state._fsp--;
 27.3982 +
 27.3983 +
 27.3984 +                    }
 27.3985 +                    break;
 27.3986 +                case 3 :
 27.3987 +                    dbg.enterAlt(3);
 27.3988 +
 27.3989 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:227:6: rewrite_tree_block
 27.3990 +                    {
 27.3991 +                    dbg.location(227,6);
 27.3992 +                    pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_element1133);
 27.3993 +                    rewrite_tree_block();
 27.3994 +
 27.3995 +                    state._fsp--;
 27.3996 +
 27.3997 +
 27.3998 +                    }
 27.3999 +                    break;
 27.4000 +                case 4 :
 27.4001 +                    dbg.enterAlt(4);
 27.4002 +
 27.4003 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:228:6: rewrite_tree_ebnf
 27.4004 +                    {
 27.4005 +                    dbg.location(228,6);
 27.4006 +                    pushFollow(FOLLOW_rewrite_tree_ebnf_in_rewrite_tree_element1140);
 27.4007 +                    rewrite_tree_ebnf();
 27.4008 +
 27.4009 +                    state._fsp--;
 27.4010 +
 27.4011 +
 27.4012 +                    }
 27.4013 +                    break;
 27.4014 +
 27.4015 +            }
 27.4016 +        }
 27.4017 +        catch (RecognitionException re) {
 27.4018 +            reportError(re);
 27.4019 +            recover(input,re);
 27.4020 +        }
 27.4021 +        finally {
 27.4022 +        }
 27.4023 +        dbg.location(229, 2);
 27.4024 +
 27.4025 +        }
 27.4026 +        finally {
 27.4027 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_element");
 27.4028 +            decRuleLevel();
 27.4029 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4030 +        }
 27.4031 +
 27.4032 +        return ;
 27.4033 +    }
 27.4034 +    // $ANTLR end "rewrite_tree_element"
 27.4035 +
 27.4036 +
 27.4037 +    // $ANTLR start "rewrite_tree_atom"
 27.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 );
 27.4039 +    public final void rewrite_tree_atom() throws RecognitionException {
 27.4040 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_atom");
 27.4041 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4042 +        incRuleLevel();
 27.4043 +        dbg.location(231, 1);
 27.4044 +
 27.4045 +        try {
 27.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 )
 27.4047 +            int alt41=7;
 27.4048 +            try { dbg.enterDecision(41, decisionCanBacktrack[41]);
 27.4049 +
 27.4050 +            switch ( input.LA(1) ) {
 27.4051 +            case CHAR_LITERAL:
 27.4052 +                {
 27.4053 +                alt41=1;
 27.4054 +                }
 27.4055 +                break;
 27.4056 +            case TOKEN_REF:
 27.4057 +                {
 27.4058 +                int LA41_2 = input.LA(2);
 27.4059 +
 27.4060 +                if ( (LA41_2==DOWN) ) {
 27.4061 +                    alt41=3;
 27.4062 +                }
 27.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) ) {
 27.4064 +                    alt41=2;
 27.4065 +                }
 27.4066 +                else {
 27.4067 +                    NoViableAltException nvae =
 27.4068 +                        new NoViableAltException("", 41, 2, input);
 27.4069 +
 27.4070 +                    dbg.recognitionException(nvae);
 27.4071 +                    throw nvae;
 27.4072 +                }
 27.4073 +                }
 27.4074 +                break;
 27.4075 +            case RULE_REF:
 27.4076 +                {
 27.4077 +                alt41=4;
 27.4078 +                }
 27.4079 +                break;
 27.4080 +            case STRING_LITERAL:
 27.4081 +                {
 27.4082 +                alt41=5;
 27.4083 +                }
 27.4084 +                break;
 27.4085 +            case LABEL:
 27.4086 +                {
 27.4087 +                alt41=6;
 27.4088 +                }
 27.4089 +                break;
 27.4090 +            case ACTION:
 27.4091 +                {
 27.4092 +                alt41=7;
 27.4093 +                }
 27.4094 +                break;
 27.4095 +            default:
 27.4096 +                NoViableAltException nvae =
 27.4097 +                    new NoViableAltException("", 41, 0, input);
 27.4098 +
 27.4099 +                dbg.recognitionException(nvae);
 27.4100 +                throw nvae;
 27.4101 +            }
 27.4102 +
 27.4103 +            } finally {dbg.exitDecision(41);}
 27.4104 +
 27.4105 +            switch (alt41) {
 27.4106 +                case 1 :
 27.4107 +                    dbg.enterAlt(1);
 27.4108 +
 27.4109 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:232:9: CHAR_LITERAL
 27.4110 +                    {
 27.4111 +                    dbg.location(232,9);
 27.4112 +                    match(input,CHAR_LITERAL,FOLLOW_CHAR_LITERAL_in_rewrite_tree_atom1156); 
 27.4113 +
 27.4114 +                    }
 27.4115 +                    break;
 27.4116 +                case 2 :
 27.4117 +                    dbg.enterAlt(2);
 27.4118 +
 27.4119 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:233:6: TOKEN_REF
 27.4120 +                    {
 27.4121 +                    dbg.location(233,6);
 27.4122 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1163); 
 27.4123 +
 27.4124 +                    }
 27.4125 +                    break;
 27.4126 +                case 3 :
 27.4127 +                    dbg.enterAlt(3);
 27.4128 +
 27.4129 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:234:6: ^( TOKEN_REF ARG_ACTION )
 27.4130 +                    {
 27.4131 +                    dbg.location(234,6);
 27.4132 +                    dbg.location(234,8);
 27.4133 +                    match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewrite_tree_atom1171); 
 27.4134 +
 27.4135 +                    match(input, Token.DOWN, null); 
 27.4136 +                    dbg.location(234,18);
 27.4137 +                    match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewrite_tree_atom1173); 
 27.4138 +
 27.4139 +                    match(input, Token.UP, null); 
 27.4140 +
 27.4141 +                    }
 27.4142 +                    break;
 27.4143 +                case 4 :
 27.4144 +                    dbg.enterAlt(4);
 27.4145 +
 27.4146 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:235:9: RULE_REF
 27.4147 +                    {
 27.4148 +                    dbg.location(235,9);
 27.4149 +                    match(input,RULE_REF,FOLLOW_RULE_REF_in_rewrite_tree_atom1185); 
 27.4150 +
 27.4151 +                    }
 27.4152 +                    break;
 27.4153 +                case 5 :
 27.4154 +                    dbg.enterAlt(5);
 27.4155 +
 27.4156 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:236:6: STRING_LITERAL
 27.4157 +                    {
 27.4158 +                    dbg.location(236,6);
 27.4159 +                    match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewrite_tree_atom1192); 
 27.4160 +
 27.4161 +                    }
 27.4162 +                    break;
 27.4163 +                case 6 :
 27.4164 +                    dbg.enterAlt(6);
 27.4165 +
 27.4166 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:237:6: LABEL
 27.4167 +                    {
 27.4168 +                    dbg.location(237,6);
 27.4169 +                    match(input,LABEL,FOLLOW_LABEL_in_rewrite_tree_atom1199); 
 27.4170 +
 27.4171 +                    }
 27.4172 +                    break;
 27.4173 +                case 7 :
 27.4174 +                    dbg.enterAlt(7);
 27.4175 +
 27.4176 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:238:4: ACTION
 27.4177 +                    {
 27.4178 +                    dbg.location(238,4);
 27.4179 +                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_tree_atom1204); 
 27.4180 +
 27.4181 +                    }
 27.4182 +                    break;
 27.4183 +
 27.4184 +            }
 27.4185 +        }
 27.4186 +        catch (RecognitionException re) {
 27.4187 +            reportError(re);
 27.4188 +            recover(input,re);
 27.4189 +        }
 27.4190 +        finally {
 27.4191 +        }
 27.4192 +        dbg.location(239, 2);
 27.4193 +
 27.4194 +        }
 27.4195 +        finally {
 27.4196 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_atom");
 27.4197 +            decRuleLevel();
 27.4198 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4199 +        }
 27.4200 +
 27.4201 +        return ;
 27.4202 +    }
 27.4203 +    // $ANTLR end "rewrite_tree_atom"
 27.4204 +
 27.4205 +
 27.4206 +    // $ANTLR start "rewrite_tree_ebnf"
 27.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 ) ;
 27.4208 +    public final void rewrite_tree_ebnf() throws RecognitionException {
 27.4209 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree_ebnf");
 27.4210 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4211 +        incRuleLevel();
 27.4212 +        dbg.location(241, 1);
 27.4213 +
 27.4214 +        try {
 27.4215 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:242:2: ( ^( ebnfSuffix rewrite_tree_block ) )
 27.4216 +            dbg.enterAlt(1);
 27.4217 +
 27.4218 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:242:4: ^( ebnfSuffix rewrite_tree_block )
 27.4219 +            {
 27.4220 +            dbg.location(242,4);
 27.4221 +            dbg.location(242,6);
 27.4222 +            pushFollow(FOLLOW_ebnfSuffix_in_rewrite_tree_ebnf1216);
 27.4223 +            ebnfSuffix();
 27.4224 +
 27.4225 +            state._fsp--;
 27.4226 +
 27.4227 +
 27.4228 +            match(input, Token.DOWN, null); 
 27.4229 +            dbg.location(242,17);
 27.4230 +            pushFollow(FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1218);
 27.4231 +            rewrite_tree_block();
 27.4232 +
 27.4233 +            state._fsp--;
 27.4234 +
 27.4235 +
 27.4236 +            match(input, Token.UP, null); 
 27.4237 +
 27.4238 +            }
 27.4239 +
 27.4240 +        }
 27.4241 +        catch (RecognitionException re) {
 27.4242 +            reportError(re);
 27.4243 +            recover(input,re);
 27.4244 +        }
 27.4245 +        finally {
 27.4246 +        }
 27.4247 +        dbg.location(243, 2);
 27.4248 +
 27.4249 +        }
 27.4250 +        finally {
 27.4251 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree_ebnf");
 27.4252 +            decRuleLevel();
 27.4253 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4254 +        }
 27.4255 +
 27.4256 +        return ;
 27.4257 +    }
 27.4258 +    // $ANTLR end "rewrite_tree_ebnf"
 27.4259 +
 27.4260 +
 27.4261 +    // $ANTLR start "rewrite_tree"
 27.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 )* ) ;
 27.4263 +    public final void rewrite_tree() throws RecognitionException {
 27.4264 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_tree");
 27.4265 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4266 +        incRuleLevel();
 27.4267 +        dbg.location(245, 1);
 27.4268 +
 27.4269 +        try {
 27.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 )* ) )
 27.4271 +            dbg.enterAlt(1);
 27.4272 +
 27.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 )* )
 27.4274 +            {
 27.4275 +            dbg.location(246,4);
 27.4276 +            dbg.location(246,6);
 27.4277 +            match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewrite_tree1232); 
 27.4278 +
 27.4279 +            match(input, Token.DOWN, null); 
 27.4280 +            dbg.location(246,17);
 27.4281 +            pushFollow(FOLLOW_rewrite_tree_atom_in_rewrite_tree1234);
 27.4282 +            rewrite_tree_atom();
 27.4283 +
 27.4284 +            state._fsp--;
 27.4285 +
 27.4286 +            dbg.location(246,35);
 27.4287 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:35: ( rewrite_tree_element )*
 27.4288 +            try { dbg.enterSubRule(42);
 27.4289 +
 27.4290 +            loop42:
 27.4291 +            do {
 27.4292 +                int alt42=2;
 27.4293 +                try { dbg.enterDecision(42, decisionCanBacktrack[42]);
 27.4294 +
 27.4295 +                int LA42_0 = input.LA(1);
 27.4296 +
 27.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) ) {
 27.4298 +                    alt42=1;
 27.4299 +                }
 27.4300 +
 27.4301 +
 27.4302 +                } finally {dbg.exitDecision(42);}
 27.4303 +
 27.4304 +                switch (alt42) {
 27.4305 +            	case 1 :
 27.4306 +            	    dbg.enterAlt(1);
 27.4307 +
 27.4308 +            	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:246:35: rewrite_tree_element
 27.4309 +            	    {
 27.4310 +            	    dbg.location(246,35);
 27.4311 +            	    pushFollow(FOLLOW_rewrite_tree_element_in_rewrite_tree1236);
 27.4312 +            	    rewrite_tree_element();
 27.4313 +
 27.4314 +            	    state._fsp--;
 27.4315 +
 27.4316 +
 27.4317 +            	    }
 27.4318 +            	    break;
 27.4319 +
 27.4320 +            	default :
 27.4321 +            	    break loop42;
 27.4322 +                }
 27.4323 +            } while (true);
 27.4324 +            } finally {dbg.exitSubRule(42);}
 27.4325 +
 27.4326 +
 27.4327 +            match(input, Token.UP, null); 
 27.4328 +
 27.4329 +            }
 27.4330 +
 27.4331 +        }
 27.4332 +        catch (RecognitionException re) {
 27.4333 +            reportError(re);
 27.4334 +            recover(input,re);
 27.4335 +        }
 27.4336 +        finally {
 27.4337 +        }
 27.4338 +        dbg.location(247, 2);
 27.4339 +
 27.4340 +        }
 27.4341 +        finally {
 27.4342 +            dbg.exitRule(getGrammarFileName(), "rewrite_tree");
 27.4343 +            decRuleLevel();
 27.4344 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4345 +        }
 27.4346 +
 27.4347 +        return ;
 27.4348 +    }
 27.4349 +    // $ANTLR end "rewrite_tree"
 27.4350 +
 27.4351 +
 27.4352 +    // $ANTLR start "rewrite_template"
 27.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 );
 27.4354 +    public final void rewrite_template() throws RecognitionException {
 27.4355 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template");
 27.4356 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4357 +        incRuleLevel();
 27.4358 +        dbg.location(249, 1);
 27.4359 +
 27.4360 +        try {
 27.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 )
 27.4362 +            int alt43=4;
 27.4363 +            try { dbg.enterDecision(43, decisionCanBacktrack[43]);
 27.4364 +
 27.4365 +            try {
 27.4366 +                isCyclicDecision = true;
 27.4367 +                alt43 = dfa43.predict(input);
 27.4368 +            }
 27.4369 +            catch (NoViableAltException nvae) {
 27.4370 +                dbg.recognitionException(nvae);
 27.4371 +                throw nvae;
 27.4372 +            }
 27.4373 +            } finally {dbg.exitDecision(43);}
 27.4374 +
 27.4375 +            switch (alt43) {
 27.4376 +                case 1 :
 27.4377 +                    dbg.enterAlt(1);
 27.4378 +
 27.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 ) )
 27.4380 +                    {
 27.4381 +                    dbg.location(250,6);
 27.4382 +                    dbg.location(250,9);
 27.4383 +                    match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template1254); 
 27.4384 +
 27.4385 +                    match(input, Token.DOWN, null); 
 27.4386 +                    dbg.location(250,18);
 27.4387 +                    match(input,ID,FOLLOW_ID_in_rewrite_template1256); 
 27.4388 +                    dbg.location(250,21);
 27.4389 +                    pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template1258);
 27.4390 +                    rewrite_template_args();
 27.4391 +
 27.4392 +                    state._fsp--;
 27.4393 +
 27.4394 +                    dbg.location(251,6);
 27.4395 +                    if ( (input.LA(1)>=DOUBLE_QUOTE_STRING_LITERAL && input.LA(1)<=DOUBLE_ANGLE_STRING_LITERAL) ) {
 27.4396 +                        input.consume();
 27.4397 +                        state.errorRecovery=false;
 27.4398 +                    }
 27.4399 +                    else {
 27.4400 +                        MismatchedSetException mse = new MismatchedSetException(null,input);
 27.4401 +                        dbg.recognitionException(mse);
 27.4402 +                        throw mse;
 27.4403 +                    }
 27.4404 +
 27.4405 +
 27.4406 +                    match(input, Token.UP, null); 
 27.4407 +
 27.4408 +                    }
 27.4409 +                    break;
 27.4410 +                case 2 :
 27.4411 +                    dbg.enterAlt(2);
 27.4412 +
 27.4413 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:253:4: rewrite_template_ref
 27.4414 +                    {
 27.4415 +                    dbg.location(253,4);
 27.4416 +                    pushFollow(FOLLOW_rewrite_template_ref_in_rewrite_template1281);
 27.4417 +                    rewrite_template_ref();
 27.4418 +
 27.4419 +                    state._fsp--;
 27.4420 +
 27.4421 +
 27.4422 +                    }
 27.4423 +                    break;
 27.4424 +                case 3 :
 27.4425 +                    dbg.enterAlt(3);
 27.4426 +
 27.4427 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:254:4: rewrite_indirect_template_head
 27.4428 +                    {
 27.4429 +                    dbg.location(254,4);
 27.4430 +                    pushFollow(FOLLOW_rewrite_indirect_template_head_in_rewrite_template1286);
 27.4431 +                    rewrite_indirect_template_head();
 27.4432 +
 27.4433 +                    state._fsp--;
 27.4434 +
 27.4435 +
 27.4436 +                    }
 27.4437 +                    break;
 27.4438 +                case 4 :
 27.4439 +                    dbg.enterAlt(4);
 27.4440 +
 27.4441 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:255:4: ACTION
 27.4442 +                    {
 27.4443 +                    dbg.location(255,4);
 27.4444 +                    match(input,ACTION,FOLLOW_ACTION_in_rewrite_template1291); 
 27.4445 +
 27.4446 +                    }
 27.4447 +                    break;
 27.4448 +
 27.4449 +            }
 27.4450 +        }
 27.4451 +        catch (RecognitionException re) {
 27.4452 +            reportError(re);
 27.4453 +            recover(input,re);
 27.4454 +        }
 27.4455 +        finally {
 27.4456 +        }
 27.4457 +        dbg.location(256, 2);
 27.4458 +
 27.4459 +        }
 27.4460 +        finally {
 27.4461 +            dbg.exitRule(getGrammarFileName(), "rewrite_template");
 27.4462 +            decRuleLevel();
 27.4463 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4464 +        }
 27.4465 +
 27.4466 +        return ;
 27.4467 +    }
 27.4468 +    // $ANTLR end "rewrite_template"
 27.4469 +
 27.4470 +
 27.4471 +    // $ANTLR start "rewrite_template_ref"
 27.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 ) ;
 27.4473 +    public final void rewrite_template_ref() throws RecognitionException {
 27.4474 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_ref");
 27.4475 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4476 +        incRuleLevel();
 27.4477 +        dbg.location(258, 1);
 27.4478 +
 27.4479 +        try {
 27.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 ) )
 27.4481 +            dbg.enterAlt(1);
 27.4482 +
 27.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 )
 27.4484 +            {
 27.4485 +            dbg.location(260,4);
 27.4486 +            dbg.location(260,6);
 27.4487 +            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template_ref1305); 
 27.4488 +
 27.4489 +            match(input, Token.DOWN, null); 
 27.4490 +            dbg.location(260,15);
 27.4491 +            match(input,ID,FOLLOW_ID_in_rewrite_template_ref1307); 
 27.4492 +            dbg.location(260,18);
 27.4493 +            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template_ref1309);
 27.4494 +            rewrite_template_args();
 27.4495 +
 27.4496 +            state._fsp--;
 27.4497 +
 27.4498 +
 27.4499 +            match(input, Token.UP, null); 
 27.4500 +
 27.4501 +            }
 27.4502 +
 27.4503 +        }
 27.4504 +        catch (RecognitionException re) {
 27.4505 +            reportError(re);
 27.4506 +            recover(input,re);
 27.4507 +        }
 27.4508 +        finally {
 27.4509 +        }
 27.4510 +        dbg.location(261, 2);
 27.4511 +
 27.4512 +        }
 27.4513 +        finally {
 27.4514 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_ref");
 27.4515 +            decRuleLevel();
 27.4516 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4517 +        }
 27.4518 +
 27.4519 +        return ;
 27.4520 +    }
 27.4521 +    // $ANTLR end "rewrite_template_ref"
 27.4522 +
 27.4523 +
 27.4524 +    // $ANTLR start "rewrite_indirect_template_head"
 27.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 ) ;
 27.4526 +    public final void rewrite_indirect_template_head() throws RecognitionException {
 27.4527 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_indirect_template_head");
 27.4528 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4529 +        incRuleLevel();
 27.4530 +        dbg.location(263, 1);
 27.4531 +
 27.4532 +        try {
 27.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 ) )
 27.4534 +            dbg.enterAlt(1);
 27.4535 +
 27.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 )
 27.4537 +            {
 27.4538 +            dbg.location(265,4);
 27.4539 +            dbg.location(265,6);
 27.4540 +            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_indirect_template_head1324); 
 27.4541 +
 27.4542 +            match(input, Token.DOWN, null); 
 27.4543 +            dbg.location(265,15);
 27.4544 +            match(input,ACTION,FOLLOW_ACTION_in_rewrite_indirect_template_head1326); 
 27.4545 +            dbg.location(265,22);
 27.4546 +            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_indirect_template_head1328);
 27.4547 +            rewrite_template_args();
 27.4548 +
 27.4549 +            state._fsp--;
 27.4550 +
 27.4551 +
 27.4552 +            match(input, Token.UP, null); 
 27.4553 +
 27.4554 +            }
 27.4555 +
 27.4556 +        }
 27.4557 +        catch (RecognitionException re) {
 27.4558 +            reportError(re);
 27.4559 +            recover(input,re);
 27.4560 +        }
 27.4561 +        finally {
 27.4562 +        }
 27.4563 +        dbg.location(266, 2);
 27.4564 +
 27.4565 +        }
 27.4566 +        finally {
 27.4567 +            dbg.exitRule(getGrammarFileName(), "rewrite_indirect_template_head");
 27.4568 +            decRuleLevel();
 27.4569 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4570 +        }
 27.4571 +
 27.4572 +        return ;
 27.4573 +    }
 27.4574 +    // $ANTLR end "rewrite_indirect_template_head"
 27.4575 +
 27.4576 +
 27.4577 +    // $ANTLR start "rewrite_template_args"
 27.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 );
 27.4579 +    public final void rewrite_template_args() throws RecognitionException {
 27.4580 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_args");
 27.4581 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4582 +        incRuleLevel();
 27.4583 +        dbg.location(268, 1);
 27.4584 +
 27.4585 +        try {
 27.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 )
 27.4587 +            int alt45=2;
 27.4588 +            try { dbg.enterDecision(45, decisionCanBacktrack[45]);
 27.4589 +
 27.4590 +            int LA45_0 = input.LA(1);
 27.4591 +
 27.4592 +            if ( (LA45_0==ARGLIST) ) {
 27.4593 +                int LA45_1 = input.LA(2);
 27.4594 +
 27.4595 +                if ( (LA45_1==DOWN) ) {
 27.4596 +                    alt45=1;
 27.4597 +                }
 27.4598 +                else if ( (LA45_1==UP||(LA45_1>=DOUBLE_QUOTE_STRING_LITERAL && LA45_1<=DOUBLE_ANGLE_STRING_LITERAL)) ) {
 27.4599 +                    alt45=2;
 27.4600 +                }
 27.4601 +                else {
 27.4602 +                    NoViableAltException nvae =
 27.4603 +                        new NoViableAltException("", 45, 1, input);
 27.4604 +
 27.4605 +                    dbg.recognitionException(nvae);
 27.4606 +                    throw nvae;
 27.4607 +                }
 27.4608 +            }
 27.4609 +            else {
 27.4610 +                NoViableAltException nvae =
 27.4611 +                    new NoViableAltException("", 45, 0, input);
 27.4612 +
 27.4613 +                dbg.recognitionException(nvae);
 27.4614 +                throw nvae;
 27.4615 +            }
 27.4616 +            } finally {dbg.exitDecision(45);}
 27.4617 +
 27.4618 +            switch (alt45) {
 27.4619 +                case 1 :
 27.4620 +                    dbg.enterAlt(1);
 27.4621 +
 27.4622 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:4: ^( ARGLIST ( rewrite_template_arg )+ )
 27.4623 +                    {
 27.4624 +                    dbg.location(269,4);
 27.4625 +                    dbg.location(269,6);
 27.4626 +                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1341); 
 27.4627 +
 27.4628 +                    match(input, Token.DOWN, null); 
 27.4629 +                    dbg.location(269,14);
 27.4630 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:14: ( rewrite_template_arg )+
 27.4631 +                    int cnt44=0;
 27.4632 +                    try { dbg.enterSubRule(44);
 27.4633 +
 27.4634 +                    loop44:
 27.4635 +                    do {
 27.4636 +                        int alt44=2;
 27.4637 +                        try { dbg.enterDecision(44, decisionCanBacktrack[44]);
 27.4638 +
 27.4639 +                        int LA44_0 = input.LA(1);
 27.4640 +
 27.4641 +                        if ( (LA44_0==ARG) ) {
 27.4642 +                            alt44=1;
 27.4643 +                        }
 27.4644 +
 27.4645 +
 27.4646 +                        } finally {dbg.exitDecision(44);}
 27.4647 +
 27.4648 +                        switch (alt44) {
 27.4649 +                    	case 1 :
 27.4650 +                    	    dbg.enterAlt(1);
 27.4651 +
 27.4652 +                    	    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:269:14: rewrite_template_arg
 27.4653 +                    	    {
 27.4654 +                    	    dbg.location(269,14);
 27.4655 +                    	    pushFollow(FOLLOW_rewrite_template_arg_in_rewrite_template_args1343);
 27.4656 +                    	    rewrite_template_arg();
 27.4657 +
 27.4658 +                    	    state._fsp--;
 27.4659 +
 27.4660 +
 27.4661 +                    	    }
 27.4662 +                    	    break;
 27.4663 +
 27.4664 +                    	default :
 27.4665 +                    	    if ( cnt44 >= 1 ) break loop44;
 27.4666 +                                EarlyExitException eee =
 27.4667 +                                    new EarlyExitException(44, input);
 27.4668 +                                dbg.recognitionException(eee);
 27.4669 +
 27.4670 +                                throw eee;
 27.4671 +                        }
 27.4672 +                        cnt44++;
 27.4673 +                    } while (true);
 27.4674 +                    } finally {dbg.exitSubRule(44);}
 27.4675 +
 27.4676 +
 27.4677 +                    match(input, Token.UP, null); 
 27.4678 +
 27.4679 +                    }
 27.4680 +                    break;
 27.4681 +                case 2 :
 27.4682 +                    dbg.enterAlt(2);
 27.4683 +
 27.4684 +                    // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:270:4: ARGLIST
 27.4685 +                    {
 27.4686 +                    dbg.location(270,4);
 27.4687 +                    match(input,ARGLIST,FOLLOW_ARGLIST_in_rewrite_template_args1350); 
 27.4688 +
 27.4689 +                    }
 27.4690 +                    break;
 27.4691 +
 27.4692 +            }
 27.4693 +        }
 27.4694 +        catch (RecognitionException re) {
 27.4695 +            reportError(re);
 27.4696 +            recover(input,re);
 27.4697 +        }
 27.4698 +        finally {
 27.4699 +        }
 27.4700 +        dbg.location(271, 2);
 27.4701 +
 27.4702 +        }
 27.4703 +        finally {
 27.4704 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_args");
 27.4705 +            decRuleLevel();
 27.4706 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4707 +        }
 27.4708 +
 27.4709 +        return ;
 27.4710 +    }
 27.4711 +    // $ANTLR end "rewrite_template_args"
 27.4712 +
 27.4713 +
 27.4714 +    // $ANTLR start "rewrite_template_arg"
 27.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 ) ;
 27.4716 +    public final void rewrite_template_arg() throws RecognitionException {
 27.4717 +        try { dbg.enterRule(getGrammarFileName(), "rewrite_template_arg");
 27.4718 +        if ( getRuleLevel()==0 ) {dbg.commence();}
 27.4719 +        incRuleLevel();
 27.4720 +        dbg.location(273, 1);
 27.4721 +
 27.4722 +        try {
 27.4723 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:274:2: ( ^( ARG ID ACTION ) )
 27.4724 +            dbg.enterAlt(1);
 27.4725 +
 27.4726 +            // /Volumes/Mercurial/web-main/contrib/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/ANTLRv3Tree.g:274:6: ^( ARG ID ACTION )
 27.4727 +            {
 27.4728 +            dbg.location(274,6);
 27.4729 +            dbg.location(274,8);
 27.4730 +            match(input,ARG,FOLLOW_ARG_in_rewrite_template_arg1364); 
 27.4731 +
 27.4732 +            match(input, Token.DOWN, null); 
 27.4733 +            dbg.location(274,12);
 27.4734 +            match(input,ID,FOLLOW_ID_in_rewrite_template_arg1366); 
 27.4735 +            dbg.location(274,15);
 27.4736 +            match(input,ACTION,FOLLOW_ACTION_in_rewrite_template_arg1368); 
 27.4737 +
 27.4738 +            match(input, Token.UP, null); 
 27.4739 +
 27.4740 +            }
 27.4741 +
 27.4742 +        }
 27.4743 +        catch (RecognitionException re) {
 27.4744 +            reportError(re);
 27.4745 +            recover(input,re);
 27.4746 +        }
 27.4747 +        finally {
 27.4748 +        }
 27.4749 +        dbg.location(275, 2);
 27.4750 +
 27.4751 +        }
 27.4752 +        finally {
 27.4753 +            dbg.exitRule(getGrammarFileName(), "rewrite_template_arg");
 27.4754 +            decRuleLevel();
 27.4755 +            if ( getRuleLevel()==0 ) {dbg.terminate();}
 27.4756 +        }
 27.4757 +
 27.4758 +        return ;
 27.4759 +    }
 27.4760 +    // $ANTLR end "rewrite_template_arg"
 27.4761 +
 27.4762 +    // Delegated rules
 27.4763 +
 27.4764 +
 27.4765 +    protected DFA30 dfa30 = new DFA30(this);
 27.4766 +    protected DFA43 dfa43 = new DFA43(this);
 27.4767 +    static final String DFA30_eotS =
 27.4768 +        "\14\uffff";
 27.4769 +    static final String DFA30_eofS =
 27.4770 +        "\14\uffff";
 27.4771 +    static final String DFA30_minS =
 27.4772 +        "\1\10\1\2\6\uffff\1\24\1\10\2\uffff";
 27.4773 +    static final String DFA30_maxS =
 27.4774 +        "\1\134\1\2\6\uffff\1\24\1\134\2\uffff";
 27.4775 +    static final String DFA30_acceptS =
 27.4776 +        "\2\uffff\1\3\1\4\1\5\1\6\1\7\1\10\2\uffff\1\1\1\2";
 27.4777 +    static final String DFA30_specialS =
 27.4778 +        "\14\uffff}>";
 27.4779 +    static final String[] DFA30_transitionS = {
 27.4780 +            "\5\3\1\uffff\1\2\21\uffff\1\5\1\6\1\3\2\uffff\1\7\2\2\2\uffff"+
 27.4781 +            "\3\2\1\4\3\uffff\1\2\25\uffff\1\1\17\uffff\1\1\1\uffff\1\2\2"+
 27.4782 +            "\uffff\1\2",
 27.4783 +            "\1\10",
 27.4784 +            "",
 27.4785 +            "",
 27.4786 +            "",
 27.4787 +            "",
 27.4788 +            "",
 27.4789 +            "",
 27.4790 +            "\1\11",
 27.4791 +            "\1\12\5\uffff\1\13\27\uffff\2\13\2\uffff\3\13\4\uffff\1\13"+
 27.4792 +            "\47\uffff\1\13\2\uffff\1\13",
 27.4793 +            "",
 27.4794 +            ""
 27.4795 +    };
 27.4796 +
 27.4797 +    static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
 27.4798 +    static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
 27.4799 +    static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
 27.4800 +    static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
 27.4801 +    static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
 27.4802 +    static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
 27.4803 +    static final short[][] DFA30_transition;
 27.4804 +
 27.4805 +    static {
 27.4806 +        int numStates = DFA30_transitionS.length;
 27.4807 +        DFA30_transition = new short[numStates][];
 27.4808 +        for (int i=0; i<numStates; i++) {
 27.4809 +            DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
 27.4810 +        }
 27.4811 +    }
 27.4812 +
 27.4813 +    class DFA30 extends DFA {
 27.4814 +
 27.4815 +        public DFA30(BaseRecognizer recognizer) {
 27.4816 +            this.recognizer = recognizer;
 27.4817 +            this.decisionNumber = 30;
 27.4818 +            this.eot = DFA30_eot;
 27.4819 +            this.eof = DFA30_eof;
 27.4820 +            this.min = DFA30_min;
 27.4821 +            this.max = DFA30_max;
 27.4822 +            this.accept = DFA30_accept;
 27.4823 +            this.special = DFA30_special;
 27.4824 +            this.transition = DFA30_transition;
 27.4825 +        }
 27.4826 +        public String getDescription() {
 27.4827 +            return "143:1: elementNoOptionSpec : ( ^( ( '=' | '+=' ) ID block ) | ^( ( '=' | '+=' ) ID atom ) | atom | ebnf | ACTION | SEMPRED | GATED_SEMPRED | treeSpec );";
 27.4828 +        }
 27.4829 +        public void error(NoViableAltException nvae) {
 27.4830 +            dbg.recognitionException(nvae);
 27.4831 +        }
 27.4832 +    }
 27.4833 +    static final String DFA43_eotS =
 27.4834 +        "\20\uffff";
 27.4835 +    static final String DFA43_eofS =
 27.4836 +        "\20\uffff";
 27.4837 +    static final String DFA43_minS =
 27.4838 +        "\1\36\1\2\1\uffff\1\24\1\26\1\uffff\1\2\1\25\2\uffff\1\2\1\24\1"+
 27.4839 +        "\55\3\3";
 27.4840 +    static final String DFA43_maxS =
 27.4841 +        "\1\55\1\2\1\uffff\1\55\1\26\1\uffff\1\63\1\25\2\uffff\1\2\1\24\1"+
 27.4842 +        "\55\1\3\1\25\1\63";
 27.4843 +    static final String DFA43_acceptS =
 27.4844 +        "\2\uffff\1\4\2\uffff\1\3\2\uffff\1\1\1\2\6\uffff";
 27.4845 +    static final String DFA43_specialS =
 27.4846 +        "\20\uffff}>";
 27.4847 +    static final String[] DFA43_transitionS = {
 27.4848 +            "\1\1\16\uffff\1\2",
 27.4849 +            "\1\3",
 27.4850 +            "",
 27.4851 +            "\1\4\30\uffff\1\5",
 27.4852 +            "\1\6",
 27.4853 +            "",
 27.4854 +            "\1\7\1\11\56\uffff\2\10",
 27.4855 +            "\1\12",
 27.4856 +            "",
 27.4857 +            "",
 27.4858 +            "\1\13",
 27.4859 +            "\1\14",
 27.4860 +            "\1\15",
 27.4861 +            "\1\16",
 27.4862 +            "\1\17\21\uffff\1\12",
 27.4863 +            "\1\11\56\uffff\2\10"
 27.4864 +    };
 27.4865 +
 27.4866 +    static final short[] DFA43_eot = DFA.unpackEncodedString(DFA43_eotS);
 27.4867 +    static final short[] DFA43_eof = DFA.unpackEncodedString(DFA43_eofS);
 27.4868 +    static final char[] DFA43_min = DFA.unpackEncodedStringToUnsignedChars(DFA43_minS);
 27.4869 +    static final char[] DFA43_max = DFA.unpackEncodedStringToUnsignedChars(DFA43_maxS);
 27.4870 +    static final short[] DFA43_accept = DFA.unpackEncodedString(DFA43_acceptS);
 27.4871 +    static final short[] DFA43_special = DFA.unpackEncodedString(DFA43_specialS);
 27.4872 +    static final short[][] DFA43_transition;
 27.4873 +
 27.4874 +    static {
 27.4875 +        int numStates = DFA43_transitionS.length;
 27.4876 +        DFA43_transition = new short[numStates][];
 27.4877 +        for (int i=0; i<numStates; i++) {
 27.4878 +            DFA43_transition[i] = DFA.unpackEncodedString(DFA43_transitionS[i]);
 27.4879 +        }
 27.4880 +    }
 27.4881 +
 27.4882 +    class DFA43 extends DFA {
 27.4883 +
 27.4884 +        public DFA43(BaseRecognizer recognizer) {
 27.4885 +            this.recognizer = recognizer;
 27.4886 +            this.decisionNumber = 43;
 27.4887 +            this.eot = DFA43_eot;
 27.4888 +            this.eof = DFA43_eof;
 27.4889 +            this.min = DFA43_min;
 27.4890 +            this.max = DFA43_max;
 27.4891 +            this.accept = DFA43_accept;
 27.4892 +            this.special = DFA43_special;
 27.4893 +            this.transition = DFA43_transition;
 27.4894 +        }
 27.4895 +        public String getDescription() {
 27.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 );";
 27.4897 +        }
 27.4898 +        public void error(NoViableAltException nvae) {
 27.4899 +            dbg.recognitionException(nvae);
 27.4900 +        }
 27.4901 +    }
 27.4902 + 
 27.4903 +
 27.4904 +    public static final BitSet FOLLOW_grammarType_in_grammarDef52 = new BitSet(new long[]{0x0000000000000004L});
 27.4905 +    public static final BitSet FOLLOW_ID_in_grammarDef54 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4906 +    public static final BitSet FOLLOW_DOC_COMMENT_in_grammarDef56 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4907 +    public static final BitSet FOLLOW_optionsSpec_in_grammarDef59 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4908 +    public static final BitSet FOLLOW_tokensSpec_in_grammarDef62 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4909 +    public static final BitSet FOLLOW_attrScope_in_grammarDef65 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4910 +    public static final BitSet FOLLOW_action_in_grammarDef68 = new BitSet(new long[]{0x0000420080000090L,0x0000000000000100L});
 27.4911 +    public static final BitSet FOLLOW_rule_in_grammarDef71 = new BitSet(new long[]{0x0000420080000098L,0x0000000000000100L});
 27.4912 +    public static final BitSet FOLLOW_set_in_grammarType0 = new BitSet(new long[]{0x0000000000000002L});
 27.4913 +    public static final BitSet FOLLOW_TOKENS_in_tokensSpec127 = new BitSet(new long[]{0x0000000000000004L});
 27.4914 +    public static final BitSet FOLLOW_tokenSpec_in_tokensSpec129 = new BitSet(new long[]{0x0000040000000008L,0x0000000000000080L});
 27.4915 +    public static final BitSet FOLLOW_71_in_tokenSpec143 = new BitSet(new long[]{0x0000000000000004L});
 27.4916 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec145 = new BitSet(new long[]{0x0000080000000000L});
 27.4917 +    public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec147 = new BitSet(new long[]{0x0000000000000008L});
 27.4918 +    public static final BitSet FOLLOW_71_in_tokenSpec154 = new BitSet(new long[]{0x0000000000000004L});
 27.4919 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec156 = new BitSet(new long[]{0x0000100000000000L});
 27.4920 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_tokenSpec158 = new BitSet(new long[]{0x0000000000000008L});
 27.4921 +    public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec164 = new BitSet(new long[]{0x0000000000000002L});
 27.4922 +    public static final BitSet FOLLOW_SCOPE_in_attrScope176 = new BitSet(new long[]{0x0000000000000004L});
 27.4923 +    public static final BitSet FOLLOW_ID_in_attrScope178 = new BitSet(new long[]{0x0000200000000000L});
 27.4924 +    public static final BitSet FOLLOW_ACTION_in_attrScope180 = new BitSet(new long[]{0x0000000000000008L});
 27.4925 +    public static final BitSet FOLLOW_72_in_action193 = new BitSet(new long[]{0x0000000000000004L});
 27.4926 +    public static final BitSet FOLLOW_ID_in_action195 = new BitSet(new long[]{0x0000000000100000L});
 27.4927 +    public static final BitSet FOLLOW_ID_in_action197 = new BitSet(new long[]{0x0000200000000000L});
 27.4928 +    public static final BitSet FOLLOW_ACTION_in_action199 = new BitSet(new long[]{0x0000000000000008L});
 27.4929 +    public static final BitSet FOLLOW_72_in_action206 = new BitSet(new long[]{0x0000000000000004L});
 27.4930 +    public static final BitSet FOLLOW_ID_in_action208 = new BitSet(new long[]{0x0000200000000000L});
 27.4931 +    public static final BitSet FOLLOW_ACTION_in_action210 = new BitSet(new long[]{0x0000000000000008L});
 27.4932 +    public static final BitSet FOLLOW_OPTIONS_in_optionsSpec223 = new BitSet(new long[]{0x0000000000000004L});
 27.4933 +    public static final BitSet FOLLOW_option_in_optionsSpec225 = new BitSet(new long[]{0x0000000000000008L,0x0000000000000080L});
 27.4934 +    public static final BitSet FOLLOW_71_in_option244 = new BitSet(new long[]{0x0000000000000004L});
 27.4935 +    public static final BitSet FOLLOW_ID_in_option246 = new BitSet(new long[]{0x0000980000100000L});
 27.4936 +    public static final BitSet FOLLOW_optionValue_in_option248 = new BitSet(new long[]{0x0000000000000008L});
 27.4937 +    public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L});
 27.4938 +    public static final BitSet FOLLOW_RULE_in_rule314 = new BitSet(new long[]{0x0000000000000004L});
 27.4939 +    public static final BitSet FOLLOW_ID_in_rule316 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 27.4940 +    public static final BitSet FOLLOW_modifier_in_rule318 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 27.4941 +    public static final BitSet FOLLOW_ARG_in_rule323 = new BitSet(new long[]{0x0000000000000004L});
 27.4942 +    public static final BitSet FOLLOW_ARG_ACTION_in_rule325 = new BitSet(new long[]{0x0000000000000008L});
 27.4943 +    public static final BitSet FOLLOW_RET_in_rule332 = new BitSet(new long[]{0x0000000000000004L});
 27.4944 +    public static final BitSet FOLLOW_ARG_ACTION_in_rule334 = new BitSet(new long[]{0x0000000000000008L});
 27.4945 +    public static final BitSet FOLLOW_optionsSpec_in_rule347 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 27.4946 +    public static final BitSet FOLLOW_ruleScopeSpec_in_rule350 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 27.4947 +    public static final BitSet FOLLOW_ruleAction_in_rule353 = new BitSet(new long[]{0x0000401080A00100L,0x0000000000003900L});
 27.4948 +    public static final BitSet FOLLOW_altList_in_rule364 = new BitSet(new long[]{0x0000000000020000L,0x0000000000600000L});
 27.4949 +    public static final BitSet FOLLOW_exceptionGroup_in_rule374 = new BitSet(new long[]{0x0000000000020000L});
 27.4950 +    public static final BitSet FOLLOW_EOR_in_rule377 = new BitSet(new long[]{0x0000000000000008L});
 27.4951 +    public static final BitSet FOLLOW_set_in_modifier0 = new BitSet(new long[]{0x0000000000000002L});
 27.4952 +    public static final BitSet FOLLOW_72_in_ruleAction416 = new BitSet(new long[]{0x0000000000000004L});
 27.4953 +    public static final BitSet FOLLOW_ID_in_ruleAction418 = new BitSet(new long[]{0x0000200000000000L});
 27.4954 +    public static final BitSet FOLLOW_ACTION_in_ruleAction420 = new BitSet(new long[]{0x0000000000000008L});
 27.4955 +    public static final BitSet FOLLOW_80_in_throwsSpec433 = new BitSet(new long[]{0x0000000000000004L});
 27.4956 +    public static final BitSet FOLLOW_ID_in_throwsSpec435 = new BitSet(new long[]{0x0000000000100008L});
 27.4957 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec449 = new BitSet(new long[]{0x0000000000000004L});
 27.4958 +    public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec451 = new BitSet(new long[]{0x0000000000000008L});
 27.4959 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec458 = new BitSet(new long[]{0x0000000000000004L});
 27.4960 +    public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec460 = new BitSet(new long[]{0x0000000000100000L});
 27.4961 +    public static final BitSet FOLLOW_ID_in_ruleScopeSpec462 = new BitSet(new long[]{0x0000000000100008L});
 27.4962 +    public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec470 = new BitSet(new long[]{0x0000000000000004L});
 27.4963 +    public static final BitSet FOLLOW_ID_in_ruleScopeSpec472 = new BitSet(new long[]{0x0000000000100008L});
 27.4964 +    public static final BitSet FOLLOW_BLOCK_in_block492 = new BitSet(new long[]{0x0000000000000004L});
 27.4965 +    public static final BitSet FOLLOW_optionsSpec_in_block494 = new BitSet(new long[]{0x0000000000010000L});
 27.4966 +    public static final BitSet FOLLOW_alternative_in_block498 = new BitSet(new long[]{0x0000010000050000L});
 27.4967 +    public static final BitSet FOLLOW_rewrite_in_block500 = new BitSet(new long[]{0x0000000000050000L});
 27.4968 +    public static final BitSet FOLLOW_EOB_in_block504 = new BitSet(new long[]{0x0000000000000008L});
 27.4969 +    public static final BitSet FOLLOW_BLOCK_in_altList527 = new BitSet(new long[]{0x0000000000000004L});
 27.4970 +    public static final BitSet FOLLOW_alternative_in_altList530 = new BitSet(new long[]{0x0000010000050000L});
 27.4971 +    public static final BitSet FOLLOW_rewrite_in_altList532 = new BitSet(new long[]{0x0000000000050000L});
 27.4972 +    public static final BitSet FOLLOW_EOB_in_altList536 = new BitSet(new long[]{0x0000000000000008L});
 27.4973 +    public static final BitSet FOLLOW_ALT_in_alternative558 = new BitSet(new long[]{0x0000000000000004L});
 27.4974 +    public static final BitSet FOLLOW_element_in_alternative560 = new BitSet(new long[]{0x00023CE700085F00L,0x0000000012800080L});
 27.4975 +    public static final BitSet FOLLOW_EOA_in_alternative563 = new BitSet(new long[]{0x0000000000000008L});
 27.4976 +    public static final BitSet FOLLOW_ALT_in_alternative575 = new BitSet(new long[]{0x0000000000000004L});
 27.4977 +    public static final BitSet FOLLOW_EPSILON_in_alternative577 = new BitSet(new long[]{0x0000000000080000L});
 27.4978 +    public static final BitSet FOLLOW_EOA_in_alternative579 = new BitSet(new long[]{0x0000000000000008L});
 27.4979 +    public static final BitSet FOLLOW_exceptionHandler_in_exceptionGroup594 = new BitSet(new long[]{0x0000000000000002L,0x0000000000600000L});
 27.4980 +    public static final BitSet FOLLOW_finallyClause_in_exceptionGroup597 = new BitSet(new long[]{0x0000000000000002L});
 27.4981 +    public static final BitSet FOLLOW_finallyClause_in_exceptionGroup603 = new BitSet(new long[]{0x0000000000000002L});
 27.4982 +    public static final BitSet FOLLOW_85_in_exceptionHandler624 = new BitSet(new long[]{0x0000000000000004L});
 27.4983 +    public static final BitSet FOLLOW_ARG_ACTION_in_exceptionHandler626 = new BitSet(new long[]{0x0000200000000000L});
 27.4984 +    public static final BitSet FOLLOW_ACTION_in_exceptionHandler628 = new BitSet(new long[]{0x0000000000000008L});
 27.4985 +    public static final BitSet FOLLOW_86_in_finallyClause650 = new BitSet(new long[]{0x0000000000000004L});
 27.4986 +    public static final BitSet FOLLOW_ACTION_in_finallyClause652 = new BitSet(new long[]{0x0000000000000008L});
 27.4987 +    public static final BitSet FOLLOW_elementNoOptionSpec_in_element667 = new BitSet(new long[]{0x0000000000000002L});
 27.4988 +    public static final BitSet FOLLOW_set_in_elementNoOptionSpec679 = new BitSet(new long[]{0x0000000000000004L});
 27.4989 +    public static final BitSet FOLLOW_ID_in_elementNoOptionSpec685 = new BitSet(new long[]{0x0000000400001F00L});
 27.4990 +    public static final BitSet FOLLOW_block_in_elementNoOptionSpec687 = new BitSet(new long[]{0x0000000000000008L});
 27.4991 +    public static final BitSet FOLLOW_set_in_elementNoOptionSpec694 = new BitSet(new long[]{0x0000000000000004L});
 27.4992 +    public static final BitSet FOLLOW_ID_in_elementNoOptionSpec700 = new BitSet(new long[]{0x00021CC000004000L,0x0000000012000000L});
 27.4993 +    public static final BitSet FOLLOW_atom_in_elementNoOptionSpec702 = new BitSet(new long[]{0x0000000000000008L});
 27.4994 +    public static final BitSet FOLLOW_atom_in_elementNoOptionSpec708 = new BitSet(new long[]{0x0000000000000002L});
 27.4995 +    public static final BitSet FOLLOW_ebnf_in_elementNoOptionSpec713 = new BitSet(new long[]{0x0000000000000002L});
 27.4996 +    public static final BitSet FOLLOW_ACTION_in_elementNoOptionSpec720 = new BitSet(new long[]{0x0000000000000002L});
 27.4997 +    public static final BitSet FOLLOW_SEMPRED_in_elementNoOptionSpec727 = new BitSet(new long[]{0x0000000000000002L});
 27.4998 +    public static final BitSet FOLLOW_GATED_SEMPRED_in_elementNoOptionSpec732 = new BitSet(new long[]{0x0000000000000002L});
 27.4999 +    public static final BitSet FOLLOW_treeSpec_in_elementNoOptionSpec739 = new BitSet(new long[]{0x0000000000000002L});
 27.5000 +    public static final BitSet FOLLOW_set_in_atom751 = new BitSet(new long[]{0x0000000000000004L});
 27.5001 +    public static final BitSet FOLLOW_atom_in_atom757 = new BitSet(new long[]{0x0000000000000008L});
 27.5002 +    public static final BitSet FOLLOW_range_in_atom763 = new BitSet(new long[]{0x0000000000000002L});
 27.5003 +    public static final BitSet FOLLOW_notSet_in_atom768 = new BitSet(new long[]{0x0000000000000002L});
 27.5004 +    public static final BitSet FOLLOW_RULE_REF_in_atom777 = new BitSet(new long[]{0x0000000000000004L});
 27.5005 +    public static final BitSet FOLLOW_ARG_ACTION_in_atom779 = new BitSet(new long[]{0x0000000000000008L});
 27.5006 +    public static final BitSet FOLLOW_RULE_REF_in_atom788 = new BitSet(new long[]{0x0000000000000002L});
 27.5007 +    public static final BitSet FOLLOW_terminal_in_atom798 = new BitSet(new long[]{0x0000000000000002L});
 27.5008 +    public static final BitSet FOLLOW_89_in_notSet813 = new BitSet(new long[]{0x0000000000000004L});
 27.5009 +    public static final BitSet FOLLOW_notTerminal_in_notSet815 = new BitSet(new long[]{0x0000000000000008L});
 27.5010 +    public static final BitSet FOLLOW_89_in_notSet822 = new BitSet(new long[]{0x0000000000000004L});
 27.5011 +    public static final BitSet FOLLOW_block_in_notSet824 = new BitSet(new long[]{0x0000000000000008L});
 27.5012 +    public static final BitSet FOLLOW_TREE_BEGIN_in_treeSpec837 = new BitSet(new long[]{0x0000000000000004L});
 27.5013 +    public static final BitSet FOLLOW_element_in_treeSpec839 = new BitSet(new long[]{0x00023CE700085F08L,0x0000000012800080L});
 27.5014 +    public static final BitSet FOLLOW_SYNPRED_in_ebnf855 = new BitSet(new long[]{0x0000000000000004L});
 27.5015 +    public static final BitSet FOLLOW_block_in_ebnf857 = new BitSet(new long[]{0x0000000000000008L});
 27.5016 +    public static final BitSet FOLLOW_SYN_SEMPRED_in_ebnf863 = new BitSet(new long[]{0x0000000000000002L});
 27.5017 +    public static final BitSet FOLLOW_ebnfSuffix_in_ebnf869 = new BitSet(new long[]{0x0000000000000004L});
 27.5018 +    public static final BitSet FOLLOW_block_in_ebnf871 = new BitSet(new long[]{0x0000000000000008L});
 27.5019 +    public static final BitSet FOLLOW_block_in_ebnf877 = new BitSet(new long[]{0x0000000000000002L});
 27.5020 +    public static final BitSet FOLLOW_CHAR_RANGE_in_range889 = new BitSet(new long[]{0x0000000000000004L});
 27.5021 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_range891 = new BitSet(new long[]{0x0000100000000000L});
 27.5022 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_range893 = new BitSet(new long[]{0x0000000000000008L});
 27.5023 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_terminal910 = new BitSet(new long[]{0x0000000000000002L});
 27.5024 +    public static final BitSet FOLLOW_TOKEN_REF_in_terminal918 = new BitSet(new long[]{0x0000000000000002L});
 27.5025 +    public static final BitSet FOLLOW_STRING_LITERAL_in_terminal926 = new BitSet(new long[]{0x0000000000000002L});
 27.5026 +    public static final BitSet FOLLOW_TOKEN_REF_in_terminal935 = new BitSet(new long[]{0x0000000000000004L});
 27.5027 +    public static final BitSet FOLLOW_ARG_ACTION_in_terminal937 = new BitSet(new long[]{0x0000000000000008L});
 27.5028 +    public static final BitSet FOLLOW_92_in_terminal946 = new BitSet(new long[]{0x0000000000000002L});
 27.5029 +    public static final BitSet FOLLOW_set_in_notTerminal0 = new BitSet(new long[]{0x0000000000000002L});
 27.5030 +    public static final BitSet FOLLOW_set_in_ebnfSuffix0 = new BitSet(new long[]{0x0000000000000002L});
 27.5031 +    public static final BitSet FOLLOW_REWRITE_in_rewrite1012 = new BitSet(new long[]{0x0000000000000004L});
 27.5032 +    public static final BitSet FOLLOW_SEMPRED_in_rewrite1014 = new BitSet(new long[]{0x0000200040010000L});
 27.5033 +    public static final BitSet FOLLOW_rewrite_alternative_in_rewrite1016 = new BitSet(new long[]{0x0000000000000008L});
 27.5034 +    public static final BitSet FOLLOW_REWRITE_in_rewrite1022 = new BitSet(new long[]{0x0000000000000004L});
 27.5035 +    public static final BitSet FOLLOW_rewrite_alternative_in_rewrite1024 = new BitSet(new long[]{0x0000000000000008L});
 27.5036 +    public static final BitSet FOLLOW_rewrite_template_in_rewrite_alternative1039 = new BitSet(new long[]{0x0000000000000002L});
 27.5037 +    public static final BitSet FOLLOW_rewrite_tree_alternative_in_rewrite_alternative1044 = new BitSet(new long[]{0x0000000000000002L});
 27.5038 +    public static final BitSet FOLLOW_ALT_in_rewrite_alternative1055 = new BitSet(new long[]{0x0000000000000004L});
 27.5039 +    public static final BitSet FOLLOW_EPSILON_in_rewrite_alternative1057 = new BitSet(new long[]{0x0000000000080000L});
 27.5040 +    public static final BitSet FOLLOW_EOA_in_rewrite_alternative1059 = new BitSet(new long[]{0x0000000000000008L});
 27.5041 +    public static final BitSet FOLLOW_BLOCK_in_rewrite_tree_block1078 = new BitSet(new long[]{0x0000000000000004L});
 27.5042 +    public static final BitSet FOLLOW_rewrite_tree_alternative_in_rewrite_tree_block1080 = new BitSet(new long[]{0x0000000000040000L});
 27.5043 +    public static final BitSet FOLLOW_EOB_in_rewrite_tree_block1082 = new BitSet(new long[]{0x0000000000000008L});
 27.5044 +    public static final BitSet FOLLOW_ALT_in_rewrite_tree_alternative1101 = new BitSet(new long[]{0x0000000000000004L});
 27.5045 +    public static final BitSet FOLLOW_rewrite_tree_element_in_rewrite_tree_alternative1103 = new BitSet(new long[]{0x00023C2020080F00L});
 27.5046 +    public static final BitSet FOLLOW_EOA_in_rewrite_tree_alternative1106 = new BitSet(new long[]{0x0000000000000008L});
 27.5047 +    public static final BitSet FOLLOW_rewrite_tree_atom_in_rewrite_tree_element1121 = new BitSet(new long[]{0x0000000000000002L});
 27.5048 +    public static final BitSet FOLLOW_rewrite_tree_in_rewrite_tree_element1126 = new BitSet(new long[]{0x0000000000000002L});
 27.5049 +    public static final BitSet FOLLOW_rewrite_tree_block_in_rewrite_tree_element1133 = new BitSet(new long[]{0x0000000000000002L});
 27.5050 +    public static final BitSet FOLLOW_rewrite_tree_ebnf_in_rewrite_tree_element1140 = new BitSet(new long[]{0x0000000000000002L});
 27.5051 +    public static final BitSet FOLLOW_CHAR_LITERAL_in_rewrite_tree_atom1156 = new BitSet(new long[]{0x0000000000000002L});
 27.5052 +    public static final BitSet FOLLOW_TOKEN_REF_in_rewrite_tree_atom1163 = new BitSet(new long[]{0x0000000000000002L});
 27.5053 +    public static final BitSet FOLLOW_TOKEN_REF_in_rewrite_tree_atom1171 = new BitSet(new long[]{0x0000000000000004L});
 27.5054 +    public static final BitSet FOLLOW_ARG_ACTION_in_rewrite_tree_atom1173 = new BitSet(new long[]{0x0000000000000008L});
 27.5055 +    public static final BitSet FOLLOW_RULE_REF_in_rewrite_tree_atom1185 = new BitSet(new long[]{0x0000000000000002L});
 27.5056 +    public static final BitSet FOLLOW_STRING_LITERAL_in_rewrite_tree_atom1192 = new BitSet(new long[]{0x0000000000000002L});
 27.5057 +    public static final BitSet FOLLOW_LABEL_in_rewrite_tree_atom1199 = new BitSet(new long[]{0x0000000000000002L});
 27.5058 +    public static final BitSet FOLLOW_ACTION_in_rewrite_tree_atom1204 = new BitSet(new long[]{0x0000000000000002L});
 27.5059 +    public static final BitSet FOLLOW_ebnfSuffix_in_rewrite_tree_ebnf1216 = new BitSet(new long[]{0x0000000000000004L});
 27.5060 +    public static final BitSet FOLLOW_rewrite_tree_block_in_rewrite_tree_ebnf1218 = new BitSet(new long[]{0x0000000000000008L});
 27.5061 +    public static final BitSet FOLLOW_TREE_BEGIN_in_rewrite_tree1232 = new BitSet(new long[]{0x0000000000000004L});
 27.5062 +    public static final BitSet FOLLOW_rewrite_tree_atom_in_rewrite_tree1234 = new BitSet(new long[]{0x00023C2020080F08L});
 27.5063 +    public static final BitSet FOLLOW_rewrite_tree_element_in_rewrite_tree1236 = new BitSet(new long[]{0x00023C2020080F08L});
 27.5064 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_template1254 = new BitSet(new long[]{0x0000000000000004L});
 27.5065 +    public static final BitSet FOLLOW_ID_in_rewrite_template1256 = new BitSet(new long[]{0x0000000000400000L});
 27.5066 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_template1258 = new BitSet(new long[]{0x000C000000000000L});
 27.5067 +    public static final BitSet FOLLOW_set_in_rewrite_template1265 = new BitSet(new long[]{0x0000000000000008L});
 27.5068 +    public static final BitSet FOLLOW_rewrite_template_ref_in_rewrite_template1281 = new BitSet(new long[]{0x0000000000000002L});
 27.5069 +    public static final BitSet FOLLOW_rewrite_indirect_template_head_in_rewrite_template1286 = new BitSet(new long[]{0x0000000000000002L});
 27.5070 +    public static final BitSet FOLLOW_ACTION_in_rewrite_template1291 = new BitSet(new long[]{0x0000000000000002L});
 27.5071 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_template_ref1305 = new BitSet(new long[]{0x0000000000000004L});
 27.5072 +    public static final BitSet FOLLOW_ID_in_rewrite_template_ref1307 = new BitSet(new long[]{0x0000000000400000L});
 27.5073 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_template_ref1309 = new BitSet(new long[]{0x0000000000000008L});
 27.5074 +    public static final BitSet FOLLOW_TEMPLATE_in_rewrite_indirect_template_head1324 = new BitSet(new long[]{0x0000000000000004L});
 27.5075 +    public static final BitSet FOLLOW_ACTION_in_rewrite_indirect_template_head1326 = new BitSet(new long[]{0x0000000000400000L});
 27.5076 +    public static final BitSet FOLLOW_rewrite_template_args_in_rewrite_indirect_template_head1328 = new BitSet(new long[]{0x0000000000000008L});
 27.5077 +    public static final BitSet FOLLOW_ARGLIST_in_rewrite_template_args1341 = new BitSet(new long[]{0x0000000000000004L});
 27.5078 +    public static final BitSet FOLLOW_rewrite_template_arg_in_rewrite_template_args1343 = new BitSet(new long[]{0x0000000000200008L});
 27.5079 +    public static final BitSet FOLLOW_ARGLIST_in_rewrite_template_args1350 = new BitSet(new long[]{0x0000000000000002L});
 27.5080 +    public static final BitSet FOLLOW_ARG_in_rewrite_template_arg1364 = new BitSet(new long[]{0x0000000000000004L});
 27.5081 +    public static final BitSet FOLLOW_ID_in_rewrite_template_arg1366 = new BitSet(new long[]{0x0000200000000000L});
 27.5082 +    public static final BitSet FOLLOW_ACTION_in_rewrite_template_arg1368 = new BitSet(new long[]{0x0000000000000008L});
 27.5083 +
 27.5084 +}
 27.5085 \ No newline at end of file
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/o.n.antlr.editor/src/org/netbeans/modules/antlr/editor/gen/ANTLRv3Tree.tokens	Mon Jan 14 15:49:47 2013 +0100
    28.3 @@ -0,0 +1,126 @@
    28.4 +T__65=65
    28.5 +T__66=66
    28.6 +T__67=67
    28.7 +T__68=68
    28.8 +T__69=69
    28.9 +T__70=70
   28.10 +T__71=71
   28.11 +T__72=72
   28.12 +T__73=73
   28.13 +T__74=74
   28.14 +T__75=75
   28.15 +T__76=76
   28.16 +T__77=77
   28.17 +T__78=78
   28.18 +T__79=79
   28.19 +T__80=80
   28.20 +T__81=81
   28.21 +T__82=82
   28.22 +T__83=83
   28.23 +T__84=84
   28.24 +T__85=85
   28.25 +T__86=86
   28.26 +T__87=87
   28.27 +T__88=88
   28.28 +T__89=89
   28.29 +T__90=90
   28.30 +T__91=91
   28.31 +T__92=92
   28.32 +T__93=93
   28.33 +DOC_COMMENT=4
   28.34 +PARSER=5
   28.35 +LEXER=6
   28.36 +RULE=7
   28.37 +BLOCK=8
   28.38 +OPTIONAL=9
   28.39 +CLOSURE=10
   28.40 +POSITIVE_CLOSURE=11
   28.41 +SYNPRED=12
   28.42 +RANGE=13
   28.43 +CHAR_RANGE=14
   28.44 +EPSILON=15
   28.45 +ALT=16
   28.46 +EOR=17
   28.47 +EOB=18
   28.48 +EOA=19
   28.49 +ID=20
   28.50 +ARG=21
   28.51 +ARGLIST=22
   28.52 +RET=23
   28.53 +LEXER_GRAMMAR=24
   28.54 +PARSER_GRAMMAR=25
   28.55 +TREE_GRAMMAR=26
   28.56 +COMBINED_GRAMMAR=27
   28.57 +INITACTION=28
   28.58 +LABEL=29
   28.59 +TEMPLATE=30
   28.60 +SCOPE=31
   28.61 +SEMPRED=32
   28.62 +GATED_SEMPRED=33
   28.63 +SYN_SEMPRED=34
   28.64 +BACKTRACK_SEMPRED=35
   28.65 +FRAGMENT=36
   28.66 +TREE_BEGIN=37
   28.67 +ROOT=38
   28.68 +BANG=39
   28.69 +REWRITE=40
   28.70 +TOKENS=41
   28.71 +TOKEN_REF=42
   28.72 +STRING_LITERAL=43
   28.73 +CHAR_LITERAL=44
   28.74 +ACTION=45
   28.75 +OPTIONS=46
   28.76 +INT=47
   28.77 +ARG_ACTION=48
   28.78 +RULE_REF=49
   28.79 +DOUBLE_QUOTE_STRING_LITERAL=50
   28.80 +DOUBLE_ANGLE_STRING_LITERAL=51
   28.81 +SRC=52
   28.82 +SL_COMMENT=53
   28.83 +ML_COMMENT=54
   28.84 +LITERAL_CHAR=55
   28.85 +ESC=56
   28.86 +XDIGIT=57
   28.87 +NESTED_ARG_ACTION=58
   28.88 +ACTION_STRING_LITERAL=59
   28.89 +ACTION_CHAR_LITERAL=60
   28.90 +NESTED_ACTION=61
   28.91 +ACTION_ESC=62
   28.92 +WS_LOOP=63
   28.93 +WS=64
   28.94 +'scope'=31
   28.95 +'fragment'=36
   28.96 +'^('=37
   28.97 +'^'=38
   28.98 +'!'=39
   28.99 +'..'=13
  28.100 +'->'=40
  28.101 +'lexer'=65
  28.102 +'parser'=66
  28.103 +'tree'=67
  28.104 +'grammar'=68
  28.105 +';'=69
  28.106 +'}'=70
  28.107 +'='=71
  28.108 +'@'=72
  28.109 +'::'=73
  28.110 +'*'=74
  28.111 +'protected'=75
  28.112 +'public'=76
  28.113 +'private'=77
  28.114 +'returns'=78
  28.115 +':'=79
  28.116 +'throws'=80
  28.117 +','=81
  28.118 +'('=82
  28.119 +'|'=83
  28.120 +')'=84
  28.121 +'catch'=85
  28.122 +'finally'=86
  28.123 +'+='=87
  28.124 +'=>'=88
  28.125 +'~'=89
  28.126 +'?'=90
  28.127 +'+'=91
  28.128 +'.'=92
  28.129 +'$'=93
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/o.n.antlr.editor/test/unit/src/org/netbeans/modules/antlr/editor/NbAntlrParserTest.java	Mon Jan 14 15:49:47 2013 +0100
    29.3 @@ -0,0 +1,77 @@
    29.4 +/*
    29.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    29.6 + *
    29.7 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
    29.8 + *
    29.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   29.10 + * Other names may be trademarks of their respective owners.
   29.11 + *
   29.12 + * The contents of this file are subject to the terms of either the GNU
   29.13 + * General Public License Version 2 only ("GPL") or the Common
   29.14 + * Development and Distribution License("CDDL") (collectively, the
   29.15 + * "License"). You may not use this file except in compliance with the
   29.16 + * License. You can obtain a copy of the License at
   29.17 + * http://www.netbeans.org/cddl-gplv2.html
   29.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   29.19 + * specific language governing permissions and limitations under the
   29.20 + * License.  When distributing the software, include this License Header
   29.21 + * Notice in each file and include the License file at
   29.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   29.23 + * particular file as subject to the "Classpath" exception as provided
   29.24 + * by Oracle in the GPL Version 2 section of the License file that
   29.25 + * accompanied this code. If applicable, add the following below the
   29.26 + * License Header, with the fields enclosed by brackets [] replaced by
   29.27 + * your own identifying information:
   29.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   29.29 + *
   29.30 + * If you wish your version of this file to be governed by only the CDDL
   29.31 + * or only the GPL Version 2, indicate your decision by adding
   29.32 + * "[Contributor] elects to include this software in this distribution
   29.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   29.34 + * single choice of license, a recipient has the option to distribute
   29.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   29.36 + * to extend the choice of license to its licensees as provided above.
   29.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   29.38 + * Version 2 license, then the option applies only if the new code is
   29.39 + * made subject to such option by the copyright holder.
   29.40 + *
   29.41 + * Contributor(s):
   29.42 + *
   29.43 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
   29.44 + */
   29.45 +package org.netbeans.modules.antlr.editor;
   29.46 +
   29.47 +import org.netbeans.modules.parsing.api.Snapshot;
   29.48 +import org.netbeans.modules.parsing.api.Source;
   29.49 +import org.netbeans.modules.parsing.spi.ParseException;
   29.50 +import org.openide.filesystems.FileObject;
   29.51 +
   29.52 +/**
   29.53 + *
   29.54 + * @author marekfukala
   29.55 + */
   29.56 +public class NbAntlrParserTest extends AntlrTestBase {
   29.57 +
   29.58 +    public NbAntlrParserTest(String testName) {
   29.59 +        super(testName);
   29.60 +    }
   29.61 +
   29.62 +    public void testParserBasic() throws ParseException {
   29.63 +        FileObject testFile = getTestFile("testfiles/ANTLRv3.g");
   29.64 +
   29.65 +        Source s = Source.create(testFile);
   29.66 +        Snapshot snap = s.createSnapshot();
   29.67 +        NbAntlrParser parser = new NbAntlrParser();
   29.68 +        parser.parse(snap, null, null);
   29.69 +        
   29.70 +        NbAntlrParserResult result = (NbAntlrParserResult)parser.getResult(null);
   29.71 +        assertNotNull(result);
   29.72 +        
   29.73 +        Node parseTree = result.getParseTree();
   29.74 +        assertNotNull(parseTree);
   29.75 +        
   29.76 +        NodeUtil.dumpTree(parseTree);
   29.77 +       
   29.78 +    }
   29.79 +    
   29.80 +}