1
/*----------------------------------------------------------------------
2
Compiler Generator Coco/R,
3
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
4
extended by M. Loeberbauer & A. Woess, Univ. of Linz
5
with improvements by Pat Terry, Rhodes University
7
This program is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License as published by the
9
Free Software Foundation; either version 2, or (at your option) any
12
This program is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17
You should have received a copy of the GNU General Public License along
18
with this program; if not, write to the Free Software Foundation, Inc.,
19
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
As an exception, it is allowed to write an extension of Coco/R that is
22
used as a plugin in non-free software.
24
If not otherwise stated, any source code generated by Coco/R (other than
25
Coco/R itself) does not fall under the GNU General Public License.
26
----------------------------------------------------------------------*/
30
partial class ExpressionFinder {
36
readonly Stack<int> stateStack = new Stack<int>();
37
bool wasQualifierTokenAtStart = false;
38
bool nextTokenIsPotentialStartOfExpression = false;
39
bool readXmlIdentifier = false;
40
bool identifierExpected = false;
41
bool nextTokenIsStartOfImportsOrAccessExpression = false;
42
bool isMissingModifier = false;
43
bool isAlreadyInExpr = false;
44
bool wasNormalAttribute = false;
45
int lambdaNestingDepth = 0;
46
int activeArgument = 0;
47
List<Token> errors = new List<Token>();
49
public ExpressionFinder()
51
stateStack.Push(-1); // required so that we don't crash when leaving the root production
54
void Expect(int expectedKind, Token la)
56
if (la.kind != expectedKind) {
58
output.AppendLine("expected: " + expectedKind);
59
//Console.WriteLine("expected: " + expectedKind);
65
output.AppendLine("not expected: " + la);
66
//Console.WriteLine("not expected: " + la);
72
public void InformToken(Token la)
77
nextTokenIsPotentialStartOfExpression = false;
78
readXmlIdentifier = false;
79
nextTokenIsStartOfImportsOrAccessExpression = false;
80
wasQualifierTokenAtStart = false;
81
identifierExpected = false;
87
//Console.WriteLine("Advance");
91
public BitArray GetExpectedSet() { return GetExpectedSet(currentState); }
93
static readonly BitArray[] set = {
b'\\ No newline at end of file'