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.
100 lines
2.8 KiB
100 lines
2.8 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 |
|
|
|
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. |
|
----------------------------------------------------------------------*/ |
|
-->begin |
|
-->namespace |
|
|
|
partial class ExpressionFinder { |
|
-->constants |
|
const bool T = true; |
|
const bool x = false; |
|
|
|
-->declarations |
|
readonly Stack<int> stateStack = new Stack<int>(); |
|
bool wasQualifierTokenAtStart = false; |
|
bool nextTokenIsPotentialStartOfExpression = false; |
|
bool readXmlIdentifier = false; |
|
bool identifierExpected = false; |
|
bool nextTokenIsStartOfImportsOrAccessExpression = false; |
|
bool isMissingModifier = false; |
|
bool isAlreadyInExpr = false; |
|
bool wasNormalAttribute = false; |
|
int lambdaNestingDepth = 0; |
|
int activeArgument = 0; |
|
List<Token> errors = new List<Token>(); |
|
|
|
public ExpressionFinder() |
|
{ |
|
stateStack.Push(-1); // required so that we don't crash when leaving the root production |
|
} |
|
|
|
void Expect(int expectedKind, Token la) |
|
{ |
|
if (la.kind != expectedKind) { |
|
Error(la); |
|
output.AppendLine("expected: " + expectedKind); |
|
//Console.WriteLine("expected: " + expectedKind); |
|
} |
|
} |
|
|
|
void Error(Token la) |
|
{ |
|
output.AppendLine("not expected: " + la); |
|
//Console.WriteLine("not expected: " + la); |
|
errors.Add(la); |
|
} |
|
|
|
Token t; |
|
|
|
public void InformToken(Token la) |
|
{ |
|
-->informToken |
|
if (la != null) { |
|
t = la; |
|
nextTokenIsPotentialStartOfExpression = false; |
|
readXmlIdentifier = false; |
|
nextTokenIsStartOfImportsOrAccessExpression = false; |
|
wasQualifierTokenAtStart = false; |
|
identifierExpected = false; |
|
} |
|
} |
|
|
|
public void Advance() |
|
{ |
|
//Console.WriteLine("Advance"); |
|
InformToken(null); |
|
} |
|
|
|
public BitArray GetExpectedSet() { return GetExpectedSet(currentState); } |
|
|
|
static readonly BitArray[] set = { |
|
-->initialization |
|
}; |
|
|
|
} // end Parser |
|
|
|
|
|
$$$ |