123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- MODULE FoxCSharpScanner;
- IMPORT Streams, Strings, Diagnostics, Commands, StringPool, D := Debugging, Basic := FoxBasic, FoxScanner;
- CONST
- Trace = FALSE;
- MaxIdentifierLength* = FoxScanner.MaxIdentifierLength;
- MaxHexDigits* = FoxScanner.MaxHexDigits;
- MaxHugeHexDigits* = FoxScanner.MaxHugeHexDigits;
- MaxRealExponent* = FoxScanner.MaxRealExponent;
- MaxLongrealExponent* = FoxScanner.MaxLongrealExponent;
- EOT* = 0X;
- LF* = 0AX;
- CR* = 0DX;
- TAB* = 9X;
- None* = 0;
- Exclamation* = 1;
- ExclamationEqual* = 2;
- Percent* = 3;
- PercentEqual* = 4;
- And* = 5;
- AndEqual* = 6;
- AndAnd* = 7;
- LeftParenthesis* = 8;
- RightParenthesis* = 9;
- Times* = 10;
- TimesEqual* = 11;
- Plus* = 12;
- PlusEqual* = 13;
- PlusPlus* = 14;
- Comma* = 15;
- Minus* = 16;
- MinusEqual* = 17;
- MinusMinus* = 18;
- Period* = 19;
- Slash* = 20;
- SlashEqual* = 21;
- Colon* = 22;
- Semicolon* = 23;
- Less* = 24;
- LessEqual* = 25;
- LeftShift* = 26;
- LeftShiftEqual* = 27;
- Equal* = 28;
- EqualEqual* = 29;
- Greater* = 30;
- GreaterEqual* = 31;
- RightShift* = 32;
- RightShiftEqual* = 33;
- LeftBracket* = 34;
- RightBracket* = 35;
- Arrow* = 36;
- ArrowEqual* = 37;
- LeftBrace* = 38;
- Bar* = 39;
- BarEqual* = 40;
- BarBar* = 41;
- RightBrace* = 42;
- Tilde* = 43;
- As* = 44;
- Base* = 45;
- Bool* = 46;
- Break* = 47;
- Case* = 48;
- Char* = 49;
- Class* = 50;
- Const* = 51;
- Default* = 52;
- Delegate* = 53;
- Do* = 54;
- Double* = 55;
- Else* = 56;
- False* = 57;
- Float* = 58;
- For* = 59;
- If* = 60;
- Import* = 61;
- Int* = 62;
- Internal* = 63;
- Is* = 64;
- Long* = 65;
- Module* = 66;
- New* = 67;
- Null* = 68;
- Object* = 69;
- Public* = 70;
- Readonly* = 71;
- Ref* = 72;
- Return* = 73;
- Sbyte* = 74;
- Short* = 75;
- String* = 76;
- Struct* = 77;
- Switch* = 78;
- This* = 79;
- True* = 80;
- Void* = 81;
- While* = 82;
- Identifier* = 83;
- IntegerLiteral* = 84;
- RealLiteral* = 85;
- CharacterLiteral* = 86;
- StringLiteral* = 87;
- Comment* = 88;
- Cell* = 89;
- Cellnet* = 90;
- In* = 91;
- Out* = 92;
- Select* = 93;
- Question* = 94;
- QuestionQuestion* = 95;
- EndOfText* = 96;
- IntNumber* = 1;
- LongNumber* = 2;
- FloatNumber* = 3;
- DoubleNumber* = 4;
- SingleQuote = 27X;
- DoubleQuote* = 22X;
- Backslash = 5CX;
- TYPE
- StringType* = FoxScanner.StringType;
- IdentifierType* = FoxScanner.IdentifierType;
- IdentifierString* = FoxScanner.IdentifierString;
- Keyword* = FoxScanner.Keyword;
- KeywordTable* = FoxScanner.KeywordTable;
- Token* = LONGINT;
- Position* = Basic.Position;
- Symbol* = RECORD
- position*: Position;
- token*: Token;
- identifier*: IdentifierType;
- identifierString*: IdentifierString;
- string*: StringType;
- stringLength*: LONGINT;
- numberType*: FoxScanner.SubType;
- integer*: LONGINT;
- hugeint*: HUGEINT;
- character*: CHAR;
- real*: LONGREAL;
- END;
- StringMaker* = FoxScanner.StringMaker;
- Scanner* = OBJECT
- VAR
- source-: StringType;
- reader: Streams.Reader;
- diagnostics: Diagnostics.Diagnostics;
- ch: CHAR;
- position-: Position;
- error-: BOOLEAN;
- stringWriter: Streams.Writer;
- stringMaker: StringMaker;
- PROCEDURE ^ & InitializeScanner*(CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics);
- PROCEDURE ^ ErrorS(CONST msg: ARRAY OF CHAR);
- PROCEDURE ^ Error(code: INTEGER);
- PROCEDURE ^ GetNextCharacter;
- PROCEDURE ^ IsNewlineCharacter(ch: CHAR): BOOLEAN;
- PROCEDURE ^ GetEscapeSequence(VAR esc: CHAR);
- PROCEDURE ^ GetCharacter(VAR symbol: Symbol);
- PROCEDURE ^ GetString(VAR symbol: Symbol);
- PROCEDURE ^ GetIdentifier(VAR symbol: Symbol);
- PROCEDURE ^ GetNumber(VAR symbol: Symbol; frac: BOOLEAN): Token;
- PROCEDURE ^ ReadSingleLineComment(VAR symbol: Symbol);
- PROCEDURE ^ ReadDelimitedComment(VAR symbol: Symbol);
- PROCEDURE ^ SkipBlanks;
- PROCEDURE ^ GetNextSymbol*(VAR symbol: Symbol): BOOLEAN;
- PROCEDURE ^ ResetError*;
- PROCEDURE ^ ResetErrorDiagnostics*(VAR diagnostics: Diagnostics.Diagnostics);
- END Scanner;
- VAR
- reservedCharacter: ARRAY 256 OF BOOLEAN;
- tokens-: ARRAY (EndOfText + 1) OF Keyword;
- keywords: KeywordTable;
- PROCEDURE ^ NewScanner*(CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics): Scanner;
- PROCEDURE ^ SymbolToString*(CONST symbol: Symbol; VAR str: ARRAY OF CHAR);
- PROCEDURE ^ OutSymbol*(w: Streams.Writer; CONST symbol: Symbol);
- PROCEDURE ^ InitReservedCharacters;
- PROCEDURE ^ GetKeyword*(token: LONGINT; VAR identifier: IdentifierType);
- PROCEDURE ^ InitTokens;
- PROCEDURE ^ InitKeywords;
- PROCEDURE ^ ReportKeywords*(context: Commands.Context);
- BEGIN
- END FoxCSharpScanner.
|