示例#1
0
 private void ReadSignAsID()
 {
     SymbolQueue.Enqueue(character);
     while (true)
     {
         if ('a' <= (char)Reader.Peek() && 'z' >= (char)Reader.Peek() || 'A' <= (char)Reader.Peek() && 'Z' >= (char)Reader.Peek())
         {
             SymbolQueue.Enqueue((char)Reader.Peek());
         }
         else if ('0' <= (char)Reader.Peek() && '9' >= (char)Reader.Peek())
         {
             SymbolQueue.Enqueue((char)Reader.Peek());
         }
         else
         {
             LexicalLabel label = GetLexicalLabel(new string(SymbolQueue.ToArray()));
             if (LexicalLabel.PL0_ID == label)
             {
                 VocabularyUnitNext = new IdentifierVocabularyUnit(label, new string(SymbolQueue.ToArray()), Line);
             }
             else
             {
                 VocabularyUnitNext = new GeneralVocabularyUnit(label, Line);
             }
             SymbolQueue.Clear();
             return;
         }
         character = (char)Reader.Read();
     }
 }
示例#2
0
 public UnsignedNumberVocabularyUnit(LexicalLabel lexicalLabel, uint number, long line) : base(lexicalLabel, line)
 {
     Number = number;
 }
示例#3
0
 public IdentifierVocabularyUnit(LexicalLabel lexicalLabel, string id, long line) : base(lexicalLabel, line)
 {
     Identifier = id;
 }
示例#4
0
 public GeneralVocabularyUnit(LexicalLabel lexicalLabel, long line)
 {
     LexicalLabel = lexicalLabel;
     Line         = line;
 }