diff options
Diffstat (limited to 'Dafny/parser.frame')
-rw-r--r-- | Dafny/parser.frame | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/Dafny/parser.frame b/Dafny/parser.frame deleted file mode 100644 index de0ba1fb..00000000 --- a/Dafny/parser.frame +++ /dev/null @@ -1,103 +0,0 @@ -
-using Microsoft.Contracts;
-
-namespace Microsoft.-->namespace {
-
-public class Parser {
--->constants
- const bool T = true;
- const bool x = false;
- const int minErrDist = 2;
-
- static Token/*!*/ token; // last recognized token
- static Token/*!*/ t; // lookahead token
- static int errDist = minErrDist;
-
- -->declarations
-
- static void Error(int n) {
- if (errDist >= minErrDist) Errors.SynErr(n, t.filename, t.line, t.col);
- errDist = 0;
- }
-
- public static void SemErr(string! msg) {
- if (errDist >= minErrDist) Errors.SemErr(token.filename, token.line, token.col, msg);
- errDist = 0;
- }
-
- public static void SemErr(Token! tok, string! msg) {
- if (errDist >= minErrDist) Errors.SemErr(tok.filename, tok.line, tok.col, msg);
- errDist = 0;
- }
-
- static void Get() {
- for (;;) {
- token = t;
- t = Scanner.Scan();
- if (t.kind<=maxT) {errDist++; return;}
--->pragmas
- t = token;
- }
- }
-
- static void Expect(int n) {
- if (t.kind==n) Get(); else Error(n);
- }
-
- static bool StartOf(int s) {
- return set[s, t.kind];
- }
-
- static void ExpectWeak(int n, int follow) {
- if (t.kind == n) Get();
- else {
- Error(n);
- while (!StartOf(follow)) Get();
- }
- }
-
- static bool WeakSeparator(int n, int syFol, int repFol) {
- bool[] s = new bool[maxT+1];
- if (t.kind == n) {Get(); return true;}
- else if (StartOf(repFol)) return false;
- else {
- for (int i=0; i <= maxT; i++) {
- s[i] = set[syFol, i] || set[repFol, i] || set[0, i];
- }
- Error(n);
- while (!s[t.kind]) Get();
- return StartOf(syFol);
- }
- }
-
--->productions
-
- public static void Parse() {
- Errors.SynErr = new ErrorProc(SynErr);
- t = new Token();
- Get();
--->parseRoot
- }
-
- [Microsoft.Contracts.Verify(false)]
- static void SynErr(int n, string filename, int line, int col) {
- Errors.count++;
- System.Console.Write("{0}({1},{2}): syntax error: ", filename, line, col);
- string s;
- switch (n) {
--->errors
- default: s = "error " + n; break;
- }
- System.Console.WriteLine(s);
- }
-
- static bool[,]! set = {
--->initialization
- };
-
- [Microsoft.Contracts.Verify(false)]
- static Parser() {}
-} // end Parser
-
-} // end namespace
-$$$
\ No newline at end of file |