The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
ILReservedWords.cs
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
3 // Project Stadyn
4 // --------------------------------------------------------------------------
5 // File: ILReservedWords.cs
6 // Author: Daniel Zapico - daniel.zapico.rodriguez@gmail.com
7 // Description:
8 // Esta clase sirve para almacenar las palabras reservadas de un lenguaje
9 // Está un continuno crecimiento, porque lo que interesa en este momento, es que funcionen
10 // los tests.
11 // Se hará una ampliación, seguramente basada en herencia para cada plataforma,
12 // cuando se empiece a generar código para más plataformas
13 // --------------------------------------------------------------------------
14 // Create date: 21-08-2007
15 // Modification date: 21-08-2007
17 
18 using System;
19 using System.Collections.Generic;
20 using System.IO;
21 using System.Text;
22 
23 using TypeSystem;
24 
25 namespace CodeGeneration {
26 
31  static readonly string [] reservedWords = { "add", "field" };
37  public bool CheckReserved(string word) {
38  return Array.BinarySearch(reservedWords, word) == 0;
39 
40  }
48  public string MakeILComplaint(String word) {
49  return CheckReserved(word) ? "'" + word + "'" : word;
50  }
51 
52  }
53 }
bool CheckReserved(string word)
Checks wether parameter word is a reserved word
string MakeILComplaint(String word)
Receives a parameter to use en IL. If this parameter is tmpName word in IL it's surrounded by a pair ...