コード例 #1
0
ファイル: Parser.cs プロジェクト: thisiscam/formula
        private void EndHeads(Span span)
        {
            Contract.Requires(argStack.Count > 0);
            Contract.Requires(crntRule == null);
            crntRule = new Nodes.Rule(span);
            while (argStack.Count > 0)
            {
                crntRule.AddHead(argStack.Pop(), false);
            }

            if (crntSentConf != null)
            {
                crntRule.SetConfig(crntSentConf);
                crntSentConf = null;
            }
        }
コード例 #2
0
ファイル: Parser.cs プロジェクト: thisiscam/formula
        private void AppendRule()
        {
            Contract.Requires(currentModule != null && currentModule.IsDomOrTrans);
            switch (currentModule.NodeKind)
            {
            case NodeKind.Domain:
                ((Domain)currentModule).AddRule(crntRule);
                break;

            case NodeKind.Transform:
                ((Transform)currentModule).AddRule(crntRule);
                break;

            default:
                throw new NotImplementedException();
            }

            crntRule = null;
        }
コード例 #3
0
ファイル: Parser.cs プロジェクト: thisiscam/formula
        private void ResetState()
        {
            currentModule = null;
            parseResult.ClearFlags();
            /******* State for building terms ********/
            appStack.Clear();
            argStack.Clear();
            quoteStack.Clear();
            /*****************************************/

            /******* State for building rules, contracts, and comprehensions ********/
            crntRule     = null;
            crntContract = null;
            crntBody     = null;
            /*****************************************/

            /******* State for building types and type declarations ********/
            crntTypeDeclName = null;
            crntTypeDeclSpan = default(Span);
            crntTypeDecl     = null;
            crntTypeTerm     = null;
            currentEnum      = null;
            /*****************************************/

            /******* State for ModRefs, steps, and updates ********/
            crntModRef      = null;
            crntStep        = null;
            crntUpdate      = null;
            crntModRefState = ModRefState.None;
            /*************************************/

            /******* State for sentence configs ********/
            crntSentConf = null;
            /*************************************/

            IsBuildingNext   = false;
            IsBuildingUpdate = false;
            IsBuildingCod    = false;
        }