mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.2 KiB
119 lines
3.2 KiB
/*---------------------------------------------------------------------------*\ |
|
Compiler Generator Coco/R, |
|
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz |
|
extended by M. Loeberbauer & A. Woess, Univ. of Linz |
|
with improvements by Pat Terry, Rhodes University |
|
------------------------------------------------------------------------------- |
|
License |
|
This file is part of Compiler Generator Coco/R |
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
under the terms of the GNU General Public License as published by the |
|
Free Software Foundation; either version 2, or (at your option) any |
|
later version. |
|
|
|
This program is distributed in the hope that it will be useful, but |
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
for more details. |
|
|
|
You should have received a copy of the GNU General Public License along |
|
with this program; if not, write to the Free Software Foundation, Inc., |
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
|
|
As an exception, it is allowed to write an extension of Coco/R that is |
|
used as a plugin in non-free software. |
|
|
|
If not otherwise stated, any source code generated by Coco/R (other than |
|
Coco/R itself) does not fall under the GNU General Public License. |
|
|
|
About this file |
|
This is a so-called 'frame' file that contains skeleton code for |
|
generating a final Scanner/Parser code. |
|
|
|
The '-->TAG' text markers are used to delimit code chunks and typically |
|
correspond to places where additional information is added by the |
|
DFA or ParserGen code. |
|
|
|
All information prior to the first 'begin' text marker is discarded. |
|
If the grammar contains a '[copy]' .. '[/copy]' section, its contents |
|
will added instead. |
|
\*---------------------------------------------------------------------------*/ |
|
-->begin |
|
|
|
-->namespace |
|
|
|
// ---------------------------------------------------------------------------- |
|
// Parser |
|
// ---------------------------------------------------------------------------- |
|
//! A Coco/R Parser |
|
partial class VBParser |
|
{ |
|
-->constants |
|
const bool T = true; |
|
const bool x = false; |
|
const int minErrDist = 2; |
|
|
|
public Errors errors; |
|
|
|
|
|
-->declarations |
|
|
|
void Get () { |
|
lexer.NextToken(); |
|
-->pragmas |
|
} |
|
|
|
bool StartOf (int s) { |
|
return set[s].Get(la.kind); |
|
} |
|
|
|
void ExpectWeak (int n, int follow) { |
|
if (la.kind == n) Get(); |
|
else { |
|
SynErr(n); |
|
while (!StartOf(follow)) Get(); |
|
} |
|
} |
|
|
|
|
|
bool WeakSeparator(int n, int syFol, int repFol) { |
|
int kind = la.kind; |
|
if (kind == n) {Get(); return true;} |
|
else if (StartOf(repFol)) {return false;} |
|
else { |
|
SynErr(n); |
|
while (!(set[syFol].Get(kind) || set[repFol].Get(kind) || set[0].Get(kind))) { |
|
Get(); |
|
kind = la.kind; |
|
} |
|
return StartOf(syFol); |
|
} |
|
} |
|
|
|
|
|
-->productions |
|
|
|
public void ParseRoot() { |
|
-->parseRoot |
|
} |
|
|
|
static readonly BitArray[] set = { |
|
-->initialization |
|
}; |
|
|
|
void SynErr(int line, int col, int errorNumber) |
|
{ |
|
this.Errors.Error(line, col, GetMessage(errorNumber)); |
|
} |
|
|
|
string GetMessage(int errorNumber) |
|
{ |
|
switch (errorNumber) { |
|
-->errors |
|
default: return "error " + errorNumber; |
|
} |
|
} |
|
} // end Parser |
|
|
|
$$$
|
|
|