Ejemplo n.º 1
0
 public DMASTProcStatementForRange(DMASTProcStatement initializer, DMASTIdentifier variable, DMASTExpression rangeStart, DMASTExpression rangeEnd, DMASTExpression step, DMASTProcBlockInner body) : base(initializer, body)
 {
     Variable   = variable;
     RangeStart = rangeStart;
     RangeEnd   = rangeEnd;
     Step       = step;
 }
Ejemplo n.º 2
0
        public void VisitIdentifier(DMASTIdentifier identifier)
        {
            var name = identifier.Identifier;

            switch (name)
            {
            case "src":
                Result = new Expressions.Src(identifier.Location, _dmObject.Path);
                break;

            case "usr":
                Result = new Expressions.Usr(identifier.Location);
                break;

            case "args":
                Result = new Expressions.Args(identifier.Location);
                break;

            default:
            {
                DMProc.LocalVariable localVar = _proc?.GetLocalVariable(name);
                if (localVar != null && _scopeMode == "normal")
                {
                    Result = new Expressions.Local(identifier.Location, localVar);
                    return;
                }

                int?procGlobalId = _proc?.GetGlobalVariableId(name);
                if (procGlobalId != null)
                {
                    Result = new Expressions.GlobalField(identifier.Location, DMObjectTree.Globals[procGlobalId.Value].Type, procGlobalId.Value);
                    return;
                }

                var field = _dmObject?.GetVariable(name);
                if (field != null && _scopeMode == "normal")
                {
                    Result = new Expressions.Field(identifier.Location, field);
                    return;
                }

                int?globalId = _dmObject?.GetGlobalVariableId(name);
                if (globalId != null)
                {
                    Result = new Expressions.GlobalField(identifier.Location, DMObjectTree.Globals[globalId.Value].Type, globalId.Value);
                    return;
                }

                throw new CompileErrorException(identifier.Location, $"Unknown identifier \"{name}\"");
            }
            }
        }
Ejemplo n.º 3
0
 public DMASTProcStatementForList(DMASTProcStatement initializer, DMASTIdentifier variable, DMASTExpression list, DMASTProcBlockInner body) : base(initializer, body)
 {
     Variable = variable;
     List     = list;
 }
Ejemplo n.º 4
0
 public DMASTProcStatementGoto(DMASTIdentifier label)
 {
     Label = label;
 }
Ejemplo n.º 5
0
 public DMASTNewIdentifier(DMASTIdentifier identifier, DMASTCallParameter[] parameters)
 {
     Identifier = identifier;
     Parameters = parameters;
 }