~ubuntu-branches/ubuntu/feisty/monodevelop/feisty

« back to all changes in this revision

Viewing changes to Core/src/NRefactory/Project/Src/Parser/Frames/Parser.frame

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-18 00:51:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060818005123-5iit07y0j7wjg55f
Tags: 0.11+svn20060818-0ubuntu1
* New SVN snapshot
  + Works with Gtk# 2.9.0
* debian/control:
  + Updated Build-Depends
* debian/patches/use_nunit2.2.dpatch,
  debian/patches/use_real_libs.dpatch:
  + Updated
* debian/patches/versioncontrol_buildfix.dpatch:
  + Fix build failure in the version control addin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Parser.frame file for NRefactory.
 
3
 */
 
4
using System;
 
5
using System.Reflection;
 
6
 
 
7
-->namespace
 
8
 
 
9
-->tokens
 
10
 
 
11
internal class Parser : AbstractParser
 
12
{
 
13
-->constants
 
14
        const  bool   T            = true;
 
15
        const  bool   x            = false;
 
16
        
 
17
-->declarations
 
18
 
 
19
/*
 
20
-->pragmas
 
21
*/
 
22
 
 
23
-->productions
 
24
        public Parser(ILexer lexer) : base(lexer)
 
25
        {
 
26
        }
 
27
        
 
28
        public override void Parse()
 
29
        {
 
30
-->parseRoot
 
31
        }
 
32
        
 
33
        protected void ExpectWeak(int n, int follow)
 
34
        {
 
35
                if (lexer.LookAhead.kind == n) {
 
36
                        lexer.NextToken();
 
37
                } else {
 
38
                        SynErr(n);
 
39
                        while (!StartOf(follow)) {
 
40
                                lexer.NextToken();
 
41
                        }
 
42
                }
 
43
        }
 
44
        
 
45
        protected bool WeakSeparator(int n, int syFol, int repFol)
 
46
        {
 
47
                bool[] s = new bool[maxT + 1];
 
48
                
 
49
                if (lexer.LookAhead.kind == n) {
 
50
                        lexer.NextToken();
 
51
                        return true;
 
52
                } else if (StartOf(repFol)) {
 
53
                        return false;
 
54
                } else {
 
55
                        for (int i = 0; i <= maxT; i++) {
 
56
                                s[i] = set[syFol, i] || set[repFol, i] || set[0, i];
 
57
                        }
 
58
                        SynErr(n);
 
59
                        while (!s[lexer.LookAhead.kind]) {
 
60
                                lexer.NextToken();
 
61
                        }
 
62
                        return StartOf(syFol);
 
63
                }
 
64
        }
 
65
        
 
66
        protected override void SynErr(int line, int col, int errorNumber)
 
67
        {
 
68
                errors.count++; 
 
69
                string s;
 
70
                switch (errorNumber) {
 
71
-->errors
 
72
                        default: s = "error " + errorNumber; break;
 
73
                }
 
74
                errors.Error(line, col, s);
 
75
        }
 
76
        
 
77
        protected bool StartOf(int s)
 
78
        {
 
79
                return set[s, lexer.LookAhead.kind];
 
80
        }
 
81
        
 
82
        static bool[,] set = {
 
83
-->initialization
 
84
        };
 
85
} // end Parser
 
86
 
 
87
$$$