public ObjSymbolInfo(IdToken idToken, SimpleToken filenameToken, Expr countExpr, bool needsVarSpace) : base(idToken) { this.filenameToken = filenameToken; this.countExpr = countExpr; this.needsVarSpace = needsVarSpace; }
public void AssertUndefined(IdToken idToken) { if (Lookup(idToken) != null) throw new ParseException(idToken.Text + " is already defined", idToken); }
public DatLabelEntry(int alignment, IdToken labelToken, bool standalone) { this.alignment = alignment; this.labelToken = labelToken; this.standalone = standalone; }
public void AddObjSymbol(IdToken idToken, SimpleToken filenameToken, Expr countExpr, bool needsVarSpace) { AssertUndefined(idToken); ObjSymbolInfo objSymbolInfo = new ObjSymbolInfo(idToken, filenameToken, countExpr, needsVarSpace); AddSymbolInfo(objSymbolInfo); objList.Add(objSymbolInfo); }
public void AddVarSymbol(IdToken idToken, SizeToken sizeToken, ArrayList countExprList) { AssertUndefined(idToken); VarSymbolInfo varSymbolInfo = new VarSymbolInfo(idToken, sizeToken, countExprList); AddSymbolInfo(varSymbolInfo); switch (sizeToken.Text.ToUpper()) { case "BYTE": byteVarList.Add(varSymbolInfo); break; case "WORD": wordVarList.Add(varSymbolInfo); break; case "LONG": longVarList.Add(varSymbolInfo); break; } }
public ConSymbolInfo(IdToken idToken, Expr e) : base(idToken) { this.e = e; }
public override bool Std(out Stmt s) { s = null; ArrayList localNameList = new ArrayList(); ArrayList localCountList = new ArrayList(); // I *should* make a name/countExpr structure, but I'm too lazy, // so for now I'll keep name and count expressions in parallel arraylists. localNameList.Add(null); // placeholder for result variable localCountList.Add(null); // and its count expression. if (this.Column != 0) throw new ParseException("PUB/PRI must be in 1st column", this); Tokenizer.Advance(); // past "PUB" or "PRI" SimpleToken token = Tokenizer.GetToken(); IdToken methodName = token as IdToken; if (methodName == null) throw new ParseException("Expected method name", token); int nParams = 0; if (Tokenizer.Current.Text == "(") // Parse parameter list. { Tokenizer.Advance("("); while (true) { IdToken paramToken = Tokenizer.Current as IdToken; if (paramToken == null) throw new ParseException("Expected parameter name", Tokenizer.Current); Tokenizer.Advance(); localNameList.Add(paramToken); localCountList.Add(null); ++nParams; if (Tokenizer.Current.Text != ",") break; Tokenizer.Advance(","); } Tokenizer.Advance(")"); } if (Tokenizer.Current.Text == ":") // Parse result variable. { Tokenizer.Advance(":"); Token t = Tokenizer.GetToken(); IdToken resultToken = t as IdToken; if (resultToken == null) { if (t.Text.ToUpper() == "RESULT") resultToken = new IdToken(t); else throw new ParseException("Expected result variable", t); } localNameList[0] = resultToken; } if (Tokenizer.Current.Text == "|") // Parse local variables. { Tokenizer.Advance("|"); while (true) { IdToken localToken = Tokenizer.GetToken() as IdToken; if (localToken == null) throw new ParseException("Expected local variable name", Tokenizer.Current); localNameList.Add(localToken); if (Tokenizer.Current.Text == "[") { Tokenizer.Advance("["); localCountList.Add(ParseExpression(Tokenizer, 13)); Tokenizer.Advance("]"); } else { localCountList.Add(null); } if (Tokenizer.Current.Text != ",") break; Tokenizer.Advance(","); } } int endLineNumber = Tokenizer.Current.LineNumber; Tokenizer.Advance("(eol)"); ArrayList statementList = ParseStatements(Tokenizer, -1); SymbolTable.AddMethod(methodName, isPub, nParams, localNameList, localCountList, statementList, endLineNumber); return true; }
public void AddDatSymbol(IdToken idToken, int alignment, int dp, int cogAddress4) { AssertUndefined(idToken); DatSymbolInfo dsi = new DatSymbolInfo(idToken, alignment, dp, cogAddress4); AddSymbolInfo(dsi); datList.Add(dsi); }
public void AddLocalDatSymbol(IdToken idToken, int alignment, int dp, int cogAddress4) { idToken.Text = latestLabel + idToken.Text; AddDatSymbol(idToken, alignment, dp, cogAddress4); }
public void AddConSymbol(IdToken idToken, Expr e) { AssertUndefined(idToken); ConSymbolInfo conSymbolInfo = new ConSymbolInfo(idToken, e); AddSymbolInfo(conSymbolInfo); conList.Add(conSymbolInfo); }
public void AddDatLabelEntry(int alignment, IdToken labelToken, bool standalone) { datEntryList.Add(new DatLabelEntry(alignment, labelToken, standalone)); }
public void AddBuiltInConSymbol(IdToken idToken, Expr e) { AssertUndefined(idToken); ConSymbolInfo conSymbolInfo = new ConSymbolInfo(idToken, e); AddSymbolInfo(conSymbolInfo); }
public ObjectFileSymbolInfo(IdToken idToken) : base(idToken) { }
public DatSymbolInfo(IdToken idToken, int alignment, int dp, int cogAddressX4) : base(idToken) { this.alignment = alignment; this.dp = dp; this.cogAddressX4 = cogAddressX4; }
public VarSymbolInfo(IdToken idToken, SizeToken sizeToken, ArrayList dimExprList) : base(idToken) { dimExprs = new Expr[dimExprList.Count]; for (int i = 0; i < dimExprList.Count; ++i) dimExprs[i] = (Expr)dimExprList[i]; this.size = Token.SizeSpecifier(sizeToken.Text); }
public void AddLocalVariable(IdToken idToken, int offset) { AssertUndefined(idToken); LocalSymbolInfo localSymbolInfo = new LocalSymbolInfo(idToken, offset); localSymbolTable.AddSymbolInfo(localSymbolInfo); }
int offset; // byte offset into local variable space. #endregion Fields #region Constructors public LocalSymbolInfo(IdToken idToken, int offset) : base(idToken) { this.offset = offset; }
public void AddMethod(IdToken idToken, bool isPub, int paramCount, ArrayList localNameList, ArrayList localCountList, ArrayList statementList, int endLineNumber) { AssertUndefined(idToken); MethodSymbolInfo methodSymbolInfo = new MethodSymbolInfo(idToken, isPub, paramCount, localNameList, localCountList, statementList, endLineNumber); AddSymbolInfo(methodSymbolInfo); if (isPub) pubList.Add(methodSymbolInfo); else priList.Add(methodSymbolInfo); }
public MethodSymbolInfo(IdToken idToken, bool isPub, int paramCount, ArrayList localNameList, ArrayList localCountList, ArrayList statementList, int endLineNumber) : base(idToken) { this.isPub = isPub; this.paramCount = paramCount; this.localNameList = localNameList; this.localCountList = localCountList; this.statementList = statementList; this.endLineNumber = endLineNumber; }
public AtAtAtExpr(IdToken token) : base(token) { this.token = token; }