public void Relation(Token op, OsgItem x, OsgItem y) { throw new NotImplementedException(); }
internal void Number() { sym = Token.Number; val = 0; do { val *= 10; val += Int32.Parse(ch.ToString()); ReadChar(); } while (ch.IsNumeric()); }
internal void Ident() { id = ""; int i = 0; do { if (i < IdLen) { id += ch; i++; } ReadChar(); } while (ch.IsAlphaNum()); if (keyTable.ContainsKey(id)) sym = keyTable[id]; else sym = Token.Ident; }
internal Token Get() { while (!Eof() && (ch == ' ' || ch == '\n' || ch == '\r')) { ReadChar(); } if (Eof()) { sym = Token.Eof; } else if (ch == '&') { ReadChar(); sym = Token.And; } else if (ch == '*') { ReadChar(); sym = Token.Times; } else if (ch == '+') { ReadChar(); sym = Token.Plus; } else if (ch == '-') { ReadChar(); sym = Token.Minus; } else if (ch == '=') { ReadChar(); sym = Token.Eql; } else if (ch == '#') { ReadChar(); sym = Token.Neq; } else if (ch == '<') { ReadChar(); if (ch == '=') { ReadChar(); sym = Token.Leq; } else sym = Token.Lss; } else if (ch == '>') { ReadChar(); if (ch == '=') { sym = Token.Geq; } else sym = Token.Gtr; } else if (ch == ';') { ReadChar(); sym = Token.Semicolon; } else if (ch == ',') { ReadChar(); sym = Token.Comma; } else if (ch == ':') { ReadChar(); if (ch == '=') { ReadChar(); sym = Token.Becomes; } else sym = Token.Colon; } else if (ch == '.') { ReadChar(); sym = Token.Period; } else if (ch == '(') { ReadChar(); if (ch == '*') { Comment(); sym = Get(); } else { sym = Token.Lparen; } } else if (ch == ')') { ReadChar(); sym = Token.Rparen; } else if (ch == '[') { ReadChar(); sym = Token.Lbrak; } else if (ch == ']') { ReadChar(); sym = Token.Rbrak; } else if (ch.IsNumeric()) { Number(); } else if (ch.IsAlpha()) { Ident(); } else if (ch == '~') { ReadChar(); sym = Token.Not; } else { ReadChar(); sym = Token.Null; } return sym; }
public void EnterKW(Token token, string name) { keyTable.Add(name, token); }
private void NextToken() { sym = scanner.Get(); }