Пример #1
0
        private Expresion ParseBoolean()
        {
            Expresion resultado = new LiteralBoolean(bool.Parse(lexer.tokenActual.Valor.ToLower()));

            lexer.Aceptar();
            return(resultado);
        }
Пример #2
0
 public override void VisitChildren(AstVisitor visitor)
 {
     if (HasExpression)
     {
         Expression.Accept(visitor);
     }
     LiteralBoolean?.Accept(visitor);
     LiteralNumeric?.Accept(visitor);
     LiteralString?.Accept(visitor);
     VariableReference?.Accept(visitor);
     FunctionReference?.Accept(visitor);
     FieldReference?.Accept(visitor);
 }
Пример #3
0
    void DoMyWindow(int windowID)
    {
        const int                 kPropertyNameColumnWidth = 150;
        const int                 kValueColumnWidth        = 50;
        const int                 kBoxHeight = 100;
        const int                 kBoxWidth  = kPropertyNameColumnWidth + kValueColumnWidth + 30;
        Environment               env        = mascaret.getEnvironment();
        InstanceSpecification     instance   = env.getInstance(this.entityName);
        Dictionary <string, Slot> ss         = instance.Slots;

        // Wrap everything in the designated GUI Area
        GUILayout.BeginArea(new Rect(15, 17, kBoxWidth, kBoxHeight));
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, "", GUILayout.Width(kBoxWidth), GUILayout.Height(kBoxHeight));
        GUILayout.BeginVertical();
        int xx = 0;

        foreach (KeyValuePair <string, Slot> s in ss)
        {
            string propertyName = s.Value.DefiningProperty.name;
            //values[xx] = "";

            string type = s.Value.DefiningProperty.Type.name;

            PrintSingleton.Instance.log(propertyName + " is " + type);
            if (type == "real" || type == "string" || type == "integer" || type == "boolean")
            {
                if (type == "real")
                {
                    LiteralReal r = (LiteralReal)(s.Value.getValue());
                    double      v = r.RValue;
                    if (first)
                    {
                        values[xx] = v.ToString();
                    }
                }
                else if (type == "string")
                {
                    LiteralString st = (LiteralString)(s.Value.getValue());
                    string        v  = st.SValue;
                    if (first)
                    {
                        values[xx] = v;
                    }
                }
                else if (type == "integer")
                {
                    LiteralInteger i = (LiteralInteger)(s.Value.getValue());
                    int            v = i.IValue;
                    if (first)
                    {
                        values[xx] = v.ToString();
                    }
                }
                else if (type == "boolean")
                {
                    LiteralBoolean b = (LiteralBoolean)(s.Value.getValue());
                    bool           v = b.BValue;
                    if (first)
                    {
                        values[xx] = v.ToString();
                    }
                }

                GUILayout.BeginHorizontal();
                GUILayout.Label(propertyName, GUILayout.Width(kPropertyNameColumnWidth));
                values[xx] = GUILayout.TextField(values[xx], 25, GUILayout.Width(kValueColumnWidth));
                if (type == "real")
                {
                    s.Value.addValue(new LiteralReal(values[xx]));
                }
                xx++;
                GUILayout.EndHorizontal();
            }
        }
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.EndArea();

        GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        first = false;
    }
Пример #4
0
        public static void Rule(Value lhs, LiteralBoolean literal)
        {
            CodeValueBoolean codeValueBoolean = new CodeValueBoolean(bool.Parse(literal.Text));

            lhs.CodeTerm = codeValueBoolean;
        }
Пример #5
0
 public virtual void Visit(LiteralBoolean node)
 {
 }
Пример #6
0
        public static void Rule(Value lhs, LiteralBoolean literal)
        {
            CodeValueBoolean codeValueBoolean = new CodeValueBoolean(bool.Parse(literal.Text));

            lhs.CodeTerm = codeValueBoolean;
        }
Пример #7
0
 public void Visit(LiteralBoolean node)
 {
 }