public NodeMatcher(NodePattern n, SemanticGraph sg, Alignment alignment, SemanticGraph sg_align, bool hyp, IndexedWord node, IDictionary <string, IndexedWord> namesToNodes, IDictionary <string, string> namesToRelations, VariableStrings variableStrings
                    , bool ignoreCase)
     : base(sg, alignment, sg_align, hyp, node, namesToNodes, namesToRelations, variableStrings)
 {
     // universal: childMatcher is null if and only if
     // myNode.child == null OR resetChild has never been called
     myNode          = n;
     this.ignoreCase = ignoreCase;
     ResetChildIter();
 }
        /// <exception cref="Edu.Stanford.Nlp.Semgraph.Semgrex.ParseException"/>
        public NodePattern Description(GraphRelation r)
        {
            Token name    = null;
            bool  link    = false;
            bool  isRoot  = false;
            bool  isEmpty = false;
            Token attr    = null;
            Token value   = null;
            IDictionary <string, string> attributes = Generics.NewHashMap();
            NodePattern pat;

            Jj_consume_token(23);
            switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
            {
            case SemgrexParserConstantsConstants.Identifier:
            {
                attr = Jj_consume_token(SemgrexParserConstantsConstants.Identifier);
                Jj_consume_token(12);
                switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
                {
                case SemgrexParserConstantsConstants.Identifier:
                {
                    value = Jj_consume_token(SemgrexParserConstantsConstants.Identifier);
                    break;
                }

                case SemgrexParserConstantsConstants.Regex:
                {
                    value = Jj_consume_token(SemgrexParserConstantsConstants.Regex);
                    break;
                }

                default:
                {
                    jj_la1[22] = jj_gen;
                    Jj_consume_token(-1);
                    throw new ParseException();
                }
                }
                if (attr != null && value != null)
                {
                    attributes[attr.image] = value.image;
                }
                while (true)
                {
                    switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
                    {
                    case 24:
                    {
                        break;
                    }

                    default:
                    {
                        jj_la1[23] = jj_gen;
                        goto label_6_break;
                    }
                    }
                    Jj_consume_token(24);
                    attr = Jj_consume_token(SemgrexParserConstantsConstants.Identifier);
                    Jj_consume_token(12);
                    switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
                    {
                    case SemgrexParserConstantsConstants.Identifier:
                    {
                        value = Jj_consume_token(SemgrexParserConstantsConstants.Identifier);
                        break;
                    }

                    case SemgrexParserConstantsConstants.Regex:
                    {
                        value = Jj_consume_token(SemgrexParserConstantsConstants.Regex);
                        break;
                    }

                    default:
                    {
                        jj_la1[24] = jj_gen;
                        Jj_consume_token(-1);
                        throw new ParseException();
                    }
                    }
                    if (attr != null && value != null)
                    {
                        attributes[attr.image] = value.image;
                    }
                    label_6_continue :;
                }
                label_6_break :;
                Jj_consume_token(25);
                break;
            }

            case SemgrexParserConstantsConstants.Root:
            {
                attr = Jj_consume_token(SemgrexParserConstantsConstants.Root);
                Jj_consume_token(25);
                isRoot = true;
                break;
            }

            case SemgrexParserConstantsConstants.Empty:
            {
                attr = Jj_consume_token(SemgrexParserConstantsConstants.Empty);
                Jj_consume_token(25);
                isEmpty = true;
                break;
            }

            case 25:
            {
                Jj_consume_token(25);
                break;
            }

            default:
            {
                jj_la1[25] = jj_gen;
                Jj_consume_token(-1);
                throw new ParseException();
            }
            }
            switch ((jj_ntk == -1) ? Jj_ntk() : jj_ntk)
            {
            case 22:
            {
                Jj_consume_token(22);
                link = true;
                name = Jj_consume_token(SemgrexParserConstantsConstants.Identifier);
                string nodeName = name.image;
                if (underNegation)
                {
                    if (!knownVariables.Contains(nodeName))
                    {
                        {
                            if (true)
                            {
                                throw new ParseException("Cannot add new variable names under negation.  Node '" + nodeName + "' not seen before");
                            }
                        }
                    }
                }
                else
                {
                    knownVariables.Add(nodeName);
                }
                break;
            }

            default:
            {
                jj_la1[26] = jj_gen;
                break;
            }
            }
            pat = new NodePattern(r, underNodeNegation, attributes, isRoot, isEmpty, name != null ? name.image : null);
            if (link)
            {
                pat.MakeLink();
            }
            {
                if (true)
                {
                    return(pat);
                }
            }
            throw new Exception("Missing return statement in function");
        }