예제 #1
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public DerivedPred(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var derivedDef     = new NonTerminal("Derived predicate definition", typeof(TransientAstNode));
            var derivedDefBase = new NonTerminal("Derived predicate definition", typeof(DomainDerivedPredAstNode));

            var predicateSkeleton     = new NonTerminal("Derived predicate skeleton", typeof(TransientAstNode));
            var predicateSkeletonBase = new NonTerminal("Derived predicate skeleton", typeof(PredicateSkeletonAstNode));

            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var gd        = new Gd(p);
            var typedList = new TypedList(p);

            // RULES

            derivedDef.Rule     = p.ToTerm("(") + derivedDefBase + ")";
            derivedDefBase.Rule = p.ToTerm(":derived") + predicateSkeleton + gd;

            predicateSkeleton.Rule     = p.ToTerm("(") + predicateSkeletonBase + ")";
            predicateSkeletonBase.Rule = predicateIdentifier + typedList;

            p.MarkTransient(derivedDef, predicateSkeleton);

            Rule = (bForm == BForm.BASE) ? derivedDefBase : derivedDef;
        }
예제 #2
0
        public async ValueTask <string> LoginAsync(BForm form, string username, string password, string callback)
        {
            if (form != null)
            {
                await form.SubmitAsync("/api/login?callback=" + callback);

                return(string.Empty);
            }
            var identityUser = await FindUserByNameAsync(username);

            if (identityUser == null)
            {
                return("用户名或密码错误,登录失败");
            }
            var result = await SignInManager.PasswordSignInAsync(identityUser, password, false, false);

            if (!result.Succeeded)
            {
                if (result.IsLockedOut)
                {
                    return("当前用户被锁定");
                }
                if (result.IsNotAllowed)
                {
                    return("当前用户不允许登录");
                }
                if (result.RequiresTwoFactor)
                {
                    return("当前用户需要两步验证");
                }
                return("用户名或密码错误,登录失败");
            }
            return(string.Empty);
        }
예제 #3
0
        /// <summary>
        /// Constructs the function term rule from the specified parameters.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        /// <param name="identifierType">Identifier type.</param>
        /// <returns>Function term grammar rule.</returns>
        public static NonTerminal ConstructFunctionTermRule(MasterGrammar p, BForm bForm, IdentifierType identifierType)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var functionTerm      = new NonTerminal("Functional term", typeof(TransientAstNode));
            var functionTermBase  = new NonTerminal("Functional term base", typeof(FunctionTermAstNode));
            var functionArguments = new NonTerminal("Functional term arguments", typeof(TransientAstNode));

            var argTerm           = new NonTerminal("Term", typeof(TransientAstNode));
            var argTermIdentifier = new NonTerminal("Identifier term", typeof(IdentifierTermAstNode));

            var functionIdentifier   = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);
            var varOrConstIdentifier = new IdentifierTerminal("Variable or constant identifier", identifierType);

            // RULES

            functionTerm.Rule      = p.ToTerm("(") + functionTermBase + ")";
            functionTermBase.Rule  = functionIdentifier + functionArguments;
            functionArguments.Rule = p.MakeStarRule(functionArguments, argTerm);

            argTerm.Rule           = argTermIdentifier | functionTerm;
            argTermIdentifier.Rule = varOrConstIdentifier;

            p.MarkTransient(functionTerm, argTerm);

            return((bForm == BForm.BASE) ? functionTermBase : functionTerm);
        }
예제 #4
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public TimedEffect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var timedEffect     = new NonTerminal("Timed effect", typeof(TransientAstNode));
            var timedEffectBase = new NonTerminal("Timed effect base", typeof(TransientAstNode));

            var atTimedEffectBase     = new NonTerminal("AT expression (timed effect)", typeof(AtTimedEffectAstNode));
            var assignTimedEffectBase = new NonTerminal("Assign expression (timed effect)", typeof(AssignTimedEffectAstNode));

            var timeSpecifier       = new NonTerminal("Time specifier", typeof(TransientAstNode));
            var timedCondEffect     = new NonTerminal("Timed cond-Effect", typeof(TransientAstNode));
            var timedCondEffectBase = new NonTerminal("Timed Cond-Effect base", typeof(TransientAstNode));

            var andTimedPEffectsBase = new NonTerminal("AND expression (timed p-effects)", typeof(AndPEffectsAstNode));
            var timedPEffectStarList = new NonTerminal("Timed p-effects star-list", typeof(TransientAstNode));

            var assignTimedEffectOp       = new NonTerminal("Assign expression operator (timed effect)", typeof(TransientAstNode));
            var assignTimedEffectFuncHead = new NonTerminal("Assign expression function head (timed effect)", typeof(TransientAstNode));
            var assignFuncIdentifier      = new NonTerminal("Function identifier for ASSIGN operation", typeof(FunctionTermAstNode));

            var functionIdentifier = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var assignFunctionTerm = new FunctionTerm(p);
            var numericExprT       = new NumericExprT(p);
            var timedPEffect       = new PEffectT(p, BForm.FULL);
            var timedPEffectBase   = new PEffectT(p, BForm.BASE);

            // RULES

            // timed effect
            timedEffect.Rule     = p.ToTerm("(") + timedEffectBase + ")";
            timedEffectBase.Rule = atTimedEffectBase | assignTimedEffectBase;

            atTimedEffectBase.Rule = p.ToTerm("at") + timeSpecifier + timedCondEffect;
            timeSpecifier.Rule     = p.ToTerm("start") | p.ToTerm("end");

            // timed cond-effect ("cond-effect" with assign operation being extended with the use of "f-exp-da")
            timedCondEffect.Rule     = p.ToTerm("(") + timedCondEffectBase + ")";
            timedCondEffectBase.Rule = timedPEffectBase | andTimedPEffectsBase;

            andTimedPEffectsBase.Rule = p.ToTerm("and") + timedPEffectStarList;
            timedPEffectStarList.Rule = p.MakeStarRule(timedPEffectStarList, timedPEffect);

            // timed p-effect
            timedPEffect.Rule = p.ToTerm("(") + timedPEffectBase + ")";

            assignTimedEffectBase.Rule     = assignTimedEffectOp + assignTimedEffectFuncHead + numericExprT;
            assignTimedEffectOp.Rule       = p.ToTerm("increase") | "decrease";
            assignTimedEffectFuncHead.Rule = assignFuncIdentifier | assignFunctionTerm;
            assignFuncIdentifier.Rule      = functionIdentifier;

            p.MarkTransient(timedEffect, timedEffectBase, timedCondEffect, timedCondEffectBase, assignTimedEffectFuncHead);

            Rule = (bForm == BForm.BASE) ? timedEffectBase : timedEffect;
        }
예제 #5
0
        /// <summary>
        /// Constructor of the base grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Form specification.</param>
        /// <param name="subExpression">Sub-expression specification.</param>
        protected BaseGrammarNode(MasterGrammar p, BForm bForm = BForm.FULL, NonTerminal subExpression = null) : base("Base grammar node", typeof(TransientAstNode))
        {
            P             = p;
            BForm         = bForm;
            SubExpression = subExpression;

            p.MarkTransient(this);
            Rule = null;
        }
예제 #6
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public Effect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var effect     = new NonTerminal("Effect", typeof(TransientAstNode));
            var effectBase = new NonTerminal("Effect base", typeof(TransientAstNode));

            var andCEffectsBase = new NonTerminal("AND expression (c-effects)", typeof(AndCEffectsAstNode));
            var cEffectStarList = new NonTerminal("C-effects list", typeof(TransientAstNode));

            var cEffect     = new NonTerminal("C-effect", typeof(TransientAstNode));
            var cEffectBase = new NonTerminal("C-effect base", typeof(TransientAstNode));

            var forallCEffectBase = new NonTerminal("FORALL expression (c-effect)", typeof(ForallCEffectAstNode));
            var whenCEffectBase   = new NonTerminal("WHEN expression (c-effect)", typeof(WhenCEffectAstNode));

            var condEffect     = new NonTerminal("Cond-Effect", typeof(TransientAstNode));
            var condEffectBase = new NonTerminal("Cond-Effect base", typeof(TransientAstNode));

            var andPEffectsBase = new NonTerminal("AND expression (p-effects)", typeof(AndPEffectsAstNode));
            var pEffectStarList = new NonTerminal("P-effects star-list", typeof(TransientAstNode));

            // USED SUB-TREES

            var typedList   = new TypedList(p);
            var gd          = new Gd(p);
            var pEffect     = new PEffect(p, BForm.FULL);
            var pEffectBase = new PEffect(p, BForm.BASE);

            // RULES

            // (general) effect - c-effect or a list of c-effects
            effect.Rule     = p.ToTerm("(") + effectBase + ")";
            effectBase.Rule = cEffectBase | andCEffectsBase;

            andCEffectsBase.Rule = p.ToTerm("and") + cEffectStarList;
            cEffectStarList.Rule = p.MakeStarRule(cEffectStarList, cEffect);

            // c-effect (allowing conditional effects)
            cEffect.Rule     = p.ToTerm("(") + cEffectBase + ")";
            cEffectBase.Rule = forallCEffectBase | whenCEffectBase | pEffectBase;

            forallCEffectBase.Rule = p.ToTerm("forall") + "(" + typedList + ")" + effect;
            whenCEffectBase.Rule   = p.ToTerm("when") + gd + condEffect;

            // cond-effect (not allowing inner conditional effects)
            condEffect.Rule     = p.ToTerm("(") + condEffectBase + ")";
            condEffectBase.Rule = pEffectBase | andPEffectsBase;

            andPEffectsBase.Rule = p.ToTerm("and") + pEffectStarList;
            pEffectStarList.Rule = p.MakeStarRule(pEffectStarList, pEffect);

            p.MarkTransient(effect, effectBase, cEffect, cEffectBase, condEffect, condEffectBase);

            Rule = (bForm == BForm.BASE) ? effectBase : effect;
        }
예제 #7
0
 public async ValueTask<string> LogoutAsync(BForm form, string callback)
 {
     if (form != null)
     {
         await form.SubmitAsync("/api/logout?callback" + callback);
         return string.Empty;
     }
     await SignInManager.SignOutAsync();
     return string.Empty;
 }
        private async Task ResetPassword(BForm bForm)
        {
            var PasswordModel       = bForm.GetValue <PasswordModel>();
            var ResetPasswordResult = await NetService.ResetPasswordAsync(new UpdateUserPasswordDto { NewPassword = PasswordModel.Password, UserId = User.Id });

            if (ResetPasswordResult.IsSuccess)
            {
                ToastSuccess("密码重置成功,下次登录请使用新密码");
                bForm.Reset();
                return;
            }
            else
            {
                ToastError(ResetPasswordResult.Message);
            }
        }
        private async Task ResetPassword(BForm bForm)
        {
            var PasswordModel = bForm.GetValue <PasswordModel>();
            var token         = await userManager.GeneratePasswordResetTokenAsync(User);

            var result = await userManager.ResetPasswordAsync(User, token, PasswordModel.Password);

            if (result.Succeeded)
            {
                ToastSuccess("密码重置成功,下次登录请使用新密码");
                bForm.Reset();
                return;
            }
            else
            {
                ToastError(JsonConvert.SerializeObject(result.Errors));
            }
        }
예제 #10
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public DurAction(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var durActionDef     = new NonTerminal("Durative action definition", typeof(TransientAstNode));
            var durActionDefBase = new NonTerminal("Durative action definition", typeof(DomainDurActionAstNode));
            var daParameters     = new NonTerminal("Durative action parameters", typeof(TransientAstNode));
            var daDuration       = new NonTerminal("Durative action duration", typeof(TransientAstNode));
            var daConditions     = new NonTerminal("Durative action conditions", typeof(TransientAstNode));
            var daEffects        = new NonTerminal("Durative action effects", typeof(TransientAstNode));

            var emptyOrDurConstr = new NonTerminal("Empty or duration-constraint", typeof(TransientAstNode));
            var emptyOrDaGd      = new NonTerminal("Empty or da-GD", typeof(TransientAstNode));
            var emptyOrDaEffect  = new NonTerminal("Empty or da-effect", typeof(TransientAstNode));
            var emptyBlock       = new NonTerminal("Empty block", typeof(TransientAstNode));

            var daName = new IdentifierTerminal("Durative action name", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var typedList      = new TypedList(p);
            var durationConstr = new DurConstr(p);
            var daGd           = new DaGd(p);
            var daEffect       = new DaEffect(p);

            // RULES

            durActionDef.Rule     = p.ToTerm("(") + durActionDefBase + ")";
            durActionDefBase.Rule = p.ToTerm(":durative-action") + daName + daParameters + daDuration + daConditions + daEffects;
            daParameters.Rule     = p.ToTerm(":parameters") + "(" + typedList + ")";
            daDuration.Rule       = p.ToTerm(":duration") + emptyOrDurConstr;
            daConditions.Rule     = p.ToTerm(":condition") + emptyOrDaGd;
            daEffects.Rule        = p.ToTerm(":effect") + emptyOrDaEffect;

            emptyOrDurConstr.Rule = emptyBlock | durationConstr;
            emptyOrDaGd.Rule      = emptyBlock | daGd;
            emptyOrDaEffect.Rule  = emptyBlock | daEffect;
            emptyBlock.Rule       = p.ToTerm("(") + p.ToTerm(")");

            p.MarkTransient(durActionDef, emptyOrDurConstr, emptyOrDaGd, emptyOrDaEffect);

            Rule = (bForm == BForm.BASE) ? durActionDefBase : durActionDef;
        }
예제 #11
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public Action(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var actionDef           = new NonTerminal("Action definition", typeof(TransientAstNode));
            var actionDefBase       = new NonTerminal("Action definition", typeof(DomainActionAstNode));
            var actionParameters    = new NonTerminal("Action parameters", typeof(TransientAstNode));
            var actionPreconditions = new NonTerminal("Action preconditions", typeof(TransientAstNode));
            var actionEffects       = new NonTerminal("Action effects", typeof(TransientAstNode));

            var emptyOrPreGd  = new NonTerminal("Empty or pre-GD", typeof(TransientAstNode));
            var emptyOrEffect = new NonTerminal("Empty or effect", typeof(TransientAstNode));
            var emptyBlock    = new NonTerminal("Empty block", typeof(TransientAstNode));

            var actionName = new IdentifierTerminal("Action name", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var typedList = new TypedList(p);
            var preGd     = new PreGd(p);
            var effect    = new Effect(p);

            // RULES

            actionDef.Rule           = p.ToTerm("(") + actionDefBase + ")";
            actionDefBase.Rule       = p.ToTerm(":action") + actionName + actionParameters + actionPreconditions + actionEffects;
            actionParameters.Rule    = p.ToTerm(":parameters") + "(" + typedList + ")";
            actionPreconditions.Rule = (p.ToTerm(":precondition") + emptyOrPreGd) | p.Empty;
            actionEffects.Rule       = (p.ToTerm(":effect") + emptyOrEffect) | p.Empty;

            emptyOrPreGd.Rule  = emptyBlock | preGd;
            emptyOrEffect.Rule = emptyBlock | effect;
            emptyBlock.Rule    = p.ToTerm("(") + p.ToTerm(")");

            p.MarkTransient(actionDef, emptyOrPreGd, emptyOrEffect);

            Rule = (bForm == BForm.BASE) ? actionDefBase : actionDef;
        }
예제 #12
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public DaEffect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var daEffect     = new NonTerminal("Da-effect", typeof(TransientAstNode));
            var daEffectBase = new NonTerminal("Da-effect base", typeof(TransientAstNode));

            var andDaEffects      = new NonTerminal("AND expression (da-effects)", typeof(AndDaEffectsAstNode));
            var daEffectsStarList = new NonTerminal("Da-effects star list", typeof(TransientAstNode));

            var forallDaEffect = new NonTerminal("FORALL expression (da-effect)", typeof(ForallDaEffectAstNode));
            var whenTimeEffect = new NonTerminal("WHEN expression (da-effect)", typeof(WhenDaEffectAstNode));

            var timedEffect = new NonTerminal("Timed-effect", typeof(TransientAstNode));

            // USED SUB-TREES

            var timedEffectBase = new TimedEffect(p, BForm.BASE);
            var typedList       = new TypedList(p);
            var daGd            = new DaGd(p);

            // RULES

            daEffect.Rule     = p.ToTerm("(") + daEffectBase + ")";
            daEffectBase.Rule = timedEffectBase | andDaEffects | forallDaEffect | whenTimeEffect;

            andDaEffects.Rule      = p.ToTerm("and") + daEffectsStarList;
            daEffectsStarList.Rule = p.MakeStarRule(daEffectsStarList, daEffect);

            forallDaEffect.Rule = p.ToTerm("forall") + "(" + typedList + ")" + daEffect;
            whenTimeEffect.Rule = p.ToTerm("when") + daGd + timedEffect;

            timedEffect.Rule = p.ToTerm("(") + timedEffectBase + ")";

            p.MarkTransient(daEffect, daEffectBase, timedEffect);

            Rule = (bForm == BForm.BASE) ? daEffectBase : daEffect;
        }
예제 #13
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public PredicateGd(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var predicate           = new NonTerminal("Predicate GD", typeof(TransientAstNode));
            var predicateBase       = new NonTerminal("Predicate GD base", typeof(PredicateGdAstNode));
            var predicateArguments  = new NonTerminal("Predicate arguments", typeof(TransientAstNode));
            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var term = new Term(p);

            // RULES

            predicate.Rule          = p.ToTerm("(") + predicateBase + ")";
            predicateBase.Rule      = predicateIdentifier + predicateArguments;
            predicateArguments.Rule = p.MakeStarRule(predicateArguments, term);

            p.MarkTransient(predicate, term);

            Rule = (bForm == BForm.BASE) ? predicateBase : predicate;
        }
예제 #14
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="numericExpression">Numeric expression type used within the numeric operation</param>
        /// <param name="bForm">Block form.</param>
        public NumericOp(MasterGrammar p, NonTerminal numericExpression, BForm bForm) : base(p, bForm, numericExpression)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var numericOp     = new NonTerminal("Numeric operation", typeof(TransientAstNode));
            var numericOpBase = new NonTerminal("Numeric operation base", typeof(TransientAstNode));

            var multiOp          = new NonTerminal("Multiary operation", typeof(NumericOpAstNode));
            var multiOperator    = new NonTerminal("Multiary operator", typeof(TransientAstNode));
            var multiOpArguments = new NonTerminal("Multiary operation arguments", typeof(TransientAstNode));

            var binaryOp          = new NonTerminal("Binary operation", typeof(NumericOpAstNode));
            var binaryUnaryOp     = new NonTerminal("Binary or unary operation", typeof(NumericOpAstNode));
            var binaryOpSecondArg = new NonTerminal("Second argument of binary operation", typeof(TransientAstNode));

            // USED SUB-TREES

            var numericExpr = SubExpression; // passed as a parameter

            // RULES

            numericOp.Rule     = p.ToTerm("(") + numericOpBase + ")";
            numericOpBase.Rule = multiOp | binaryOp | binaryUnaryOp;

            multiOp.Rule          = multiOperator + numericExpr + multiOpArguments; // at least two numeric args
            multiOperator.Rule    = p.ToTerm("*") | "+";
            multiOpArguments.Rule = p.MakePlusRule(multiOpArguments, numericExpr);

            binaryOp.Rule          = p.ToTerm("/") + numericExpr + numericExpr;       // the only binary is division
            binaryUnaryOp.Rule     = p.ToTerm("-") + numericExpr + binaryOpSecondArg; // unary/binary minus
            binaryOpSecondArg.Rule = numericExpr | p.Empty;

            p.MarkTransient(numericOp, numericOpBase, multiOperator, binaryOpSecondArg);

            Rule = (bForm == BForm.BASE) ? numericOpBase : numericOp;
        }
예제 #15
0
 /// <summary>
 /// Constructor of the grammar node.
 /// </summary>
 /// <param name="p">Parent master grammar.</param>
 /// <param name="bForm">Block form.</param>
 public PEffect(MasterGrammar p, BForm bForm) : base(p, bForm)
 {
     Rule = ConstructPEffectRule(p, bForm, new ValueOrTerm(p), new NumericExpr(p));
 }
예제 #16
0
        /// <summary>
        /// Constructs the primitive effect rule from the specified parameters.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        /// <param name="valueOrTermForAssign">Value or term for an assignment.</param>
        /// <param name="numericExprForAssign">Numeric expression for an assignment.</param>
        /// <returns>Primitive effect grammar rule.</returns>
        public static NonTerminal ConstructPEffectRule(MasterGrammar p, BForm bForm, NonTerminal valueOrTermForAssign, NonTerminal numericExprForAssign)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var pEffect     = new NonTerminal("P-effect", typeof(TransientAstNode));
            var pEffectBase = new NonTerminal("P-effect base", typeof(TransientAstNode));

            var atomicFormulaPEffect     = new NonTerminal("Atomic formula (p-effect)", typeof(TransientAstNode));
            var atomicFormulaPEffectBase = new NonTerminal("Atomic formula base (p-effect)", typeof(TransientAstNode));

            var predicatePEffectBase = new NonTerminal("Predicate (p-effect)", typeof(PredicatePEffectAstNode));
            var predicateArguments   = new NonTerminal("Predicate arguments", typeof(TransientAstNode));

            var equalsOpPEffectBase = new NonTerminal("Equals-op (p-effect)", typeof(EqualsOpPEffectAstNode));
            var notPEffectBase      = new NonTerminal("NOT expression (p-effect)", typeof(NotPEffectAstNode));

            var assignPEffectBase = new NonTerminal("General assign expression (p-effect)", typeof(TransientAstNode));
            var objOrNumAssign    = new NonTerminal("Numeric or object assign operator (p-effect)", typeof(AssignPEffectAstNode));
            var onlyNumAssign     = new NonTerminal("Numeric assign operator (p-effect)", typeof(AssignPEffectAstNode));

            var numAssignOp         = new NonTerminal("Assign operation", typeof(TransientAstNode));
            var assignOpArg1        = new NonTerminal("Assign operation first argument", typeof(TransientAstNode));
            var assignOpArg2        = new NonTerminal("Assign operation second argument", typeof(TransientAstNode));
            var assignOpArg2Num     = new NonTerminal("Assign operation second numeric argument", typeof(TransientAstNode));
            var assignOpFuncIdentif = new NonTerminal("Function identifier for ASSIGN operation", typeof(FunctionTermAstNode));
            var undefinedFuncVal    = new NonTerminal("Undefined function value", typeof(UndefinedFuncValAstNode));

            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);
            var functionIdentifier  = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var valueOrTerm          = new ValueOrTerm(p);
            var predFuncTermFunction = new FunctionTerm(p);
            var term = new Term(p);

            // RULES

            pEffect.Rule     = p.ToTerm("(") + pEffectBase + ")";
            pEffectBase.Rule = atomicFormulaPEffectBase | notPEffectBase | assignPEffectBase;

            atomicFormulaPEffect.Rule     = p.ToTerm("(") + atomicFormulaPEffectBase + ")";
            atomicFormulaPEffectBase.Rule = predicatePEffectBase | equalsOpPEffectBase;

            predicatePEffectBase.Rule = predicateIdentifier + predicateArguments;
            predicateArguments.Rule   = p.MakeStarRule(predicateArguments, term);

            equalsOpPEffectBase.Rule = p.ToTerm("=") + valueOrTerm + valueOrTerm;
            notPEffectBase.Rule      = p.ToTerm("not") + atomicFormulaPEffect;

            assignPEffectBase.Rule = objOrNumAssign | onlyNumAssign;
            objOrNumAssign.Rule    = p.ToTerm("assign") + assignOpArg1 + assignOpArg2;
            onlyNumAssign.Rule     = numAssignOp + assignOpArg1 + assignOpArg2Num;

            assignOpArg1.Rule        = assignOpFuncIdentif | predFuncTermFunction;
            assignOpArg2.Rule        = undefinedFuncVal | valueOrTermForAssign;
            assignOpFuncIdentif.Rule = functionIdentifier;
            assignOpArg2Num.Rule     = numericExprForAssign;

            numAssignOp.Rule      = p.ToTerm("scale-up") | "scale-down" | "increase" | "decrease";
            undefinedFuncVal.Rule = p.ToTerm("undefined");

            p.MarkTransient(pEffect, pEffectBase, atomicFormulaPEffect, atomicFormulaPEffectBase, assignPEffectBase, assignOpArg1, assignOpArg2, assignOpArg2Num);

            return((bForm == BForm.BASE) ? pEffectBase : pEffect);
        }
예제 #17
0
 /// <summary>
 /// Constructor of the grammar node.
 /// </summary>
 /// <param name="p">Parent master grammar.</param>
 /// <param name="bForm">Block form.</param>
 public FunctionTerm(MasterGrammar p, BForm bForm) : base(p, bForm)
 {
     Rule = ConstructFunctionTermRule(p, bForm, IdentifierType.VARIABLE_OR_CONSTANT);
 }
예제 #18
0
 public async ValueTask SubmitLoginAsync(BForm form, string callbackUri)
 {
     await form.SubmitAsync("/api/login?callback=" + callbackUri);
 }
예제 #19
0
 /// <summary>
 /// Constructor of the grammar node.
 /// </summary>
 /// <param name="p">Parent master grammar.</param>
 /// <param name="bForm">Block form.</param>
 public FunctionTermC(MasterGrammar p, BForm bForm) : base(p, bForm)
 {
     Rule = FunctionTerm.ConstructFunctionTermRule(p, bForm, IdentifierType.CONSTANT);
 }
예제 #20
0
 public ValueTask <string> LogoutAsync(BForm form, string callback)
 {
     throw new NotImplementedException();
 }
예제 #21
0
 public ValueTask <string> LoginAsync(BForm form, string username, string password, string callback)
 {
     throw new NotImplementedException();
 }