ABB.Swum.LeadingPrepositionRule.ConstructSwum C# (CSharp) Method

ConstructSwum() public method

Constructs the SWUM for the given node, using this rule.
public ConstructSwum ( ProgramElementNode node ) : void
node ABB.Swum.Nodes.ProgramElementNode The node to construct SWUM for.
return void
        public override void ConstructSwum(ProgramElementNode node)
        {
            if (node is MethodDeclarationNode)
            {
                var mdn = (MethodDeclarationNode)node;

                mdn.AssignStructuralInformation(this.Splitter, this.PosTagger);
                if (mdn.ParsedName[0].Tag != PartOfSpeechTag.Preposition)
                {
                    //this shouldn't be necessary, because prepositions should have been tagged in tagger.PreTag, which should have been called prior to this method
                    mdn.ParsedName[0].Tag = PartOfSpeechTag.Preposition;
                    Console.Error.WriteLine("LeadingPrepositionRule.ConstructSwum(): found node with untagged preposition: {0}", mdn);
                }
                if(mdn.ParsedName.Size() > 1) {
                    this.PosTagger.TagNounPhrase(mdn.ParsedName, 1, mdn.ParsedName.Size() - 1);
                }
                mdn.CreateThemeFromPhrases(mdn.Preamble, mdn.ParsedName);

                //TODO: from Emily, make name proper SecondaryArg

                string prep = mdn.ParsedName[0].Text.ToLower();
                if (prep == "to" || prep == "from")
                {
                    mdn.Action = mdn.ParsedName[0].GetNewWord("convert", PartOfSpeechTag.Verb);
                    SetDefaultUnknownArguments(mdn);
                }
                else if (prep == "on" || prep == "before" || prep == "after") //EventHandlerRule should be run first
                {
                    ParseReactiveName(mdn);
                }
                else
                {
                    SetDefaultUnknownArguments(mdn);
                }

                mdn.SwumRuleUsed = this;
            }
        }
    }