コード例 #1
0
ファイル: Scanner.cs プロジェクト: Xpitfire/CrossCompile
 void Init()
 {
     pos = -1; line = 1; col = 0; charPos = -1;
     oldEols = 0;
     NextCh();
     if (ch == 0xEF) { // check optional byte order mark for UTF-8
     NextCh(); int ch1 = ch;
     NextCh(); int ch2 = ch;
     if (ch1 != 0xBB || ch2 != 0xBF) {
         throw new FatalError(String.Format("illegal byte order mark: EF {0,2:X} {1,2:X}", ch1, ch2));
     }
     buffer = new UTF8Buffer(buffer); col = 0; charPos = -1;
     NextCh();
     }
     pt = tokens = new Token();  // first token is a dummy
 }
コード例 #2
0
ファイル: Scanner.cs プロジェクト: Xpitfire/CrossCompile
        Token NextToken()
        {
            while (ch == ' ' ||
            ch >= 9 && ch <= 10 || ch == 13
            ) NextCh();
            if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
            int apx = 0;
            int recKind = noSym;
            int recEnd = pos;
            t = new Token();
            t.pos = pos; t.col = col; t.line = line; t.charPos = charPos;
            int state;
            if (start.ContainsKey(ch)) { state = (int) start[ch]; }
            else { state = 0; }
            tlen = 0; AddCh();

            switch (state) {
            case -1: { t.kind = eofSym; break; } // NextCh already done
            case 0: {
                if (recKind != noSym) {
                    tlen = recEnd - t.pos;
                    SetScannerBehindT();
                }
                t.kind = recKind; break;
            } // NextCh already done
            case 1:
                recEnd = pos; recKind = 1;
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'Z' || ch == '_' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
                else {t.kind = 1; t.val = new String(tval, 0, tlen); CheckLiteral(); return t;}
            case 2:
                {
                    tlen -= apx;
                    SetScannerBehindT();
                    t.kind = 2; break;}
            case 3:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 4;}
                else {goto case 0;}
            case 4:
                recEnd = pos; recKind = 2;
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 4;}
                else if (ch == 'U') {AddCh(); goto case 80;}
                else if (ch == 'u') {AddCh(); goto case 81;}
                else if (ch == 'L') {AddCh(); goto case 82;}
                else if (ch == 'l') {AddCh(); goto case 83;}
                else {t.kind = 2; break;}
            case 5:
                {t.kind = 2; break;}
            case 6:
                recEnd = pos; recKind = 3;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 6;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else if (ch == 'E' || ch == 'e') {AddCh(); goto case 7;}
                else {t.kind = 3; break;}
            case 7:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
                else if (ch == '+' || ch == '-') {AddCh(); goto case 8;}
                else {goto case 0;}
            case 8:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
                else {goto case 0;}
            case 9:
                recEnd = pos; recKind = 3;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 9;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else {t.kind = 3; break;}
            case 10:
                recEnd = pos; recKind = 3;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 10;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else if (ch == 'E' || ch == 'e') {AddCh(); goto case 11;}
                else {t.kind = 3; break;}
            case 11:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 13;}
                else if (ch == '+' || ch == '-') {AddCh(); goto case 12;}
                else {goto case 0;}
            case 12:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 13;}
                else {goto case 0;}
            case 13:
                recEnd = pos; recKind = 3;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 13;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else {t.kind = 3; break;}
            case 14:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 16;}
                else if (ch == '+' || ch == '-') {AddCh(); goto case 15;}
                else {goto case 0;}
            case 15:
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 16;}
                else {goto case 0;}
            case 16:
                recEnd = pos; recKind = 3;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 16;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else {t.kind = 3; break;}
            case 17:
                {t.kind = 3; break;}
            case 18:
                if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '&' || ch >= '(' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 19;}
                else if (ch == 92) {AddCh(); goto case 84;}
                else {goto case 0;}
            case 19:
                if (ch == 39) {AddCh(); goto case 34;}
                else {goto case 0;}
            case 20:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 21;}
                else {goto case 0;}
            case 21:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 85;}
                else if (ch == 39) {AddCh(); goto case 34;}
                else {goto case 0;}
            case 22:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 23;}
                else {goto case 0;}
            case 23:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 24;}
                else {goto case 0;}
            case 24:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 25;}
                else {goto case 0;}
            case 25:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 19;}
                else {goto case 0;}
            case 26:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 27;}
                else {goto case 0;}
            case 27:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 28;}
                else {goto case 0;}
            case 28:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 29;}
                else {goto case 0;}
            case 29:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 30;}
                else {goto case 0;}
            case 30:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 31;}
                else {goto case 0;}
            case 31:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 32;}
                else {goto case 0;}
            case 32:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 33;}
                else {goto case 0;}
            case 33:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 19;}
                else {goto case 0;}
            case 34:
                {t.kind = 4; break;}
            case 35:
                if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 35;}
                else if (ch == '"') {AddCh(); goto case 51;}
                else if (ch == 92) {AddCh(); goto case 87;}
                else {goto case 0;}
            case 36:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 37;}
                else {goto case 0;}
            case 37:
                if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '/' || ch >= ':' && ch <= '@' || ch >= 'G' && ch <= '[' || ch >= ']' && ch <= '`' || ch >= 'g' && ch <= 65535) {AddCh(); goto case 35;}
                else if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 88;}
                else if (ch == '"') {AddCh(); goto case 51;}
                else if (ch == 92) {AddCh(); goto case 87;}
                else {goto case 0;}
            case 38:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 39;}
                else {goto case 0;}
            case 39:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 40;}
                else {goto case 0;}
            case 40:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 41;}
                else {goto case 0;}
            case 41:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 35;}
                else {goto case 0;}
            case 42:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 43;}
                else {goto case 0;}
            case 43:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 44;}
                else {goto case 0;}
            case 44:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 45;}
                else {goto case 0;}
            case 45:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 46;}
                else {goto case 0;}
            case 46:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 47;}
                else {goto case 0;}
            case 47:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 48;}
                else {goto case 0;}
            case 48:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 49;}
                else {goto case 0;}
            case 49:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 35;}
                else {goto case 0;}
            case 50:
                if (ch <= '!' || ch >= '#' && ch <= 65535) {AddCh(); goto case 50;}
                else if (ch == '"') {AddCh(); goto case 90;}
                else {goto case 0;}
            case 51:
                {t.kind = 5; break;}
            case 52:
                {t.kind = 41; break;}
            case 53:
                {t.kind = 42; break;}
            case 54:
                {t.kind = 43; break;}
            case 55:
                {t.kind = 47; break;}
            case 56:
                {t.kind = 49; break;}
            case 57:
                {t.kind = 50; break;}
            case 58:
                {t.kind = 51; break;}
            case 59:
                {t.kind = 52; break;}
            case 60:
                {t.kind = 53; break;}
            case 61:
                {t.kind = 55; break;}
            case 62:
                {t.kind = 58; break;}
            case 63:
                {t.kind = 62; break;}
            case 64:
                {t.kind = 63; break;}
            case 65:
                {t.kind = 64; break;}
            case 66:
                {t.kind = 65; break;}
            case 67:
                {t.kind = 66; break;}
            case 68:
                recEnd = pos; recKind = 2;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 68;}
                else if (ch == 'U') {AddCh(); goto case 76;}
                else if (ch == 'u') {AddCh(); goto case 77;}
                else if (ch == 'L') {AddCh(); goto case 78;}
                else if (ch == 'l') {AddCh(); goto case 79;}
                else if (ch == '.') {apx++; AddCh(); goto case 91;}
                else if (ch == 'E' || ch == 'e') {AddCh(); goto case 14;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else {t.kind = 2; break;}
            case 69:
                if (ch >= 'A' && ch <= 'Z' || ch == '_' || ch >= 'a' && ch <= 'z') {AddCh(); goto case 1;}
                else if (ch == '"') {AddCh(); goto case 50;}
                else {goto case 0;}
            case 70:
                recEnd = pos; recKind = 2;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 68;}
                else if (ch == 'U') {AddCh(); goto case 76;}
                else if (ch == 'u') {AddCh(); goto case 77;}
                else if (ch == 'L') {AddCh(); goto case 78;}
                else if (ch == 'l') {AddCh(); goto case 79;}
                else if (ch == '.') {apx++; AddCh(); goto case 91;}
                else if (ch == 'X' || ch == 'x') {AddCh(); goto case 3;}
                else if (ch == 'E' || ch == 'e') {AddCh(); goto case 14;}
                else if (ch == 'D' || ch == 'F' || ch == 'M' || ch == 'd' || ch == 'f' || ch == 'm') {AddCh(); goto case 17;}
                else {t.kind = 2; break;}
            case 71:
                recEnd = pos; recKind = 45;
                if (ch >= '0' && ch <= '9') {AddCh(); goto case 6;}
                else {t.kind = 45; break;}
            case 72:
                recEnd = pos; recKind = 40;
                if (ch == '=') {AddCh(); goto case 92;}
                else {t.kind = 40; break;}
            case 73:
                recEnd = pos; recKind = 48;
                if (ch == '=') {AddCh(); goto case 56;}
                else {t.kind = 48; break;}
            case 74:
                recEnd = pos; recKind = 54;
                if (ch == '=') {AddCh(); goto case 61;}
                else {t.kind = 54; break;}
            case 75:
                recEnd = pos; recKind = 59;
                if (ch == '=') {AddCh(); goto case 62;}
                else {t.kind = 59; break;}
            case 76:
                recEnd = pos; recKind = 2;
                if (ch == 'L' || ch == 'l') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 77:
                recEnd = pos; recKind = 2;
                if (ch == 'L' || ch == 'l') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 78:
                recEnd = pos; recKind = 2;
                if (ch == 'U' || ch == 'u') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 79:
                recEnd = pos; recKind = 2;
                if (ch == 'U' || ch == 'u') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 80:
                recEnd = pos; recKind = 2;
                if (ch == 'L' || ch == 'l') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 81:
                recEnd = pos; recKind = 2;
                if (ch == 'L' || ch == 'l') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 82:
                recEnd = pos; recKind = 2;
                if (ch == 'U' || ch == 'u') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 83:
                recEnd = pos; recKind = 2;
                if (ch == 'U' || ch == 'u') {AddCh(); goto case 5;}
                else {t.kind = 2; break;}
            case 84:
                if (ch == '"' || ch == 39 || ch == '0' || ch == 92 || ch >= 'a' && ch <= 'b' || ch == 'f' || ch == 'n' || ch == 'r' || ch == 't' || ch == 'v') {AddCh(); goto case 19;}
                else if (ch == 'x') {AddCh(); goto case 20;}
                else if (ch == 'u') {AddCh(); goto case 22;}
                else if (ch == 'U') {AddCh(); goto case 26;}
                else {goto case 0;}
            case 85:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 86;}
                else if (ch == 39) {AddCh(); goto case 34;}
                else {goto case 0;}
            case 86:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 19;}
                else if (ch == 39) {AddCh(); goto case 34;}
                else {goto case 0;}
            case 87:
                if (ch == '"' || ch == 39 || ch == '0' || ch == 92 || ch >= 'a' && ch <= 'b' || ch == 'f' || ch == 'n' || ch == 'r' || ch == 't' || ch == 'v') {AddCh(); goto case 35;}
                else if (ch == 'x') {AddCh(); goto case 36;}
                else if (ch == 'u') {AddCh(); goto case 38;}
                else if (ch == 'U') {AddCh(); goto case 42;}
                else {goto case 0;}
            case 88:
                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {AddCh(); goto case 89;}
                else if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '/' || ch >= ':' && ch <= '@' || ch >= 'G' && ch <= '[' || ch >= ']' && ch <= '`' || ch >= 'g' && ch <= 65535) {AddCh(); goto case 35;}
                else if (ch == '"') {AddCh(); goto case 51;}
                else if (ch == 92) {AddCh(); goto case 87;}
                else {goto case 0;}
            case 89:
                if (ch <= 9 || ch >= 11 && ch <= 12 || ch >= 14 && ch <= '!' || ch >= '#' && ch <= '[' || ch >= ']' && ch <= 65535) {AddCh(); goto case 35;}
                else if (ch == '"') {AddCh(); goto case 51;}
                else if (ch == 92) {AddCh(); goto case 87;}
                else {goto case 0;}
            case 90:
                recEnd = pos; recKind = 5;
                if (ch == '"') {AddCh(); goto case 50;}
                else {t.kind = 5; break;}
            case 91:
                if (ch <= '/' || ch >= ':' && ch <= 65535) {apx++; AddCh(); goto case 2;}
                else if (ch >= '0' && ch <= '9') {apx = 0; AddCh(); goto case 10;}
                else {goto case 0;}
            case 92:
                recEnd = pos; recKind = 46;
                if (ch == '=') {AddCh(); goto case 55;}
                else {t.kind = 46; break;}
            case 93:
                {t.kind = 71; break;}
            case 94:
                {t.kind = 72; break;}
            case 95:
                {t.kind = 73; break;}
            case 96:
                {t.kind = 74; break;}
            case 97:
                {t.kind = 75; break;}
            case 98:
                {t.kind = 76; break;}
            case 99:
                {t.kind = 77; break;}
            case 100:
                {t.kind = 78; break;}
            case 101:
                {t.kind = 79; break;}
            case 102:
                {t.kind = 80; break;}
            case 103:
                {t.kind = 81; break;}
            case 104:
                recEnd = pos; recKind = 39;
                if (ch == '=') {AddCh(); goto case 98;}
                else if (ch == '&') {AddCh(); goto case 103;}
                else {t.kind = 39; break;}
            case 105:
                recEnd = pos; recKind = 56;
                if (ch == '-') {AddCh(); goto case 54;}
                else if (ch == '=') {AddCh(); goto case 94;}
                else {t.kind = 56; break;}
            case 106:
                recEnd = pos; recKind = 44;
                if (ch == '=') {AddCh(); goto case 96;}
                else {t.kind = 44; break;}
            case 107:
                recEnd = pos; recKind = 61;
                if (ch == '+') {AddCh(); goto case 57;}
                else if (ch == '=') {AddCh(); goto case 93;}
                else {t.kind = 61; break;}
            case 108:
                recEnd = pos; recKind = 57;
                if (ch == '=') {AddCh(); goto case 97;}
                else {t.kind = 57; break;}
            case 109:
                recEnd = pos; recKind = 60;
                if (ch == '=') {AddCh(); goto case 99;}
                else if (ch == '|') {AddCh(); goto case 102;}
                else {t.kind = 60; break;}
            case 110:
                recEnd = pos; recKind = 67;
                if (ch == '=') {AddCh(); goto case 95;}
                else {t.kind = 67; break;}
            case 111:
                recEnd = pos; recKind = 68;
                if (ch == '=') {AddCh(); goto case 100;}
                else {t.kind = 68; break;}

            }
            t.val = new String(tval, 0, tlen);
            return t;
        }
コード例 #3
0
ファイル: Scanner.cs プロジェクト: Xpitfire/CrossCompile
 // make sure that peeking starts at the current scan position
 public void ResetPeek()
 {
     pt = tokens;
 }
コード例 #4
0
ファイル: Scanner.cs プロジェクト: Xpitfire/CrossCompile
 // get the next token (possibly a token already seen during peeking)
 public Token Scan()
 {
     if (tokens.next == null) {
     return NextToken();
     } else {
     pt = tokens = tokens.next;
     return tokens;
     }
 }
コード例 #5
0
ファイル: Scanner.cs プロジェクト: Xpitfire/CrossCompile
        // peek for the next token, ignore pragmas
        public Token Peek()
        {
            do {
            if (pt.next == null) {
                pt.next = NextToken();
            }
            pt = pt.next;
            } while (pt.kind > maxT); // skip pragmas

            return pt;
        }
コード例 #6
0
ファイル: Parser.cs プロジェクト: Xpitfire/CrossCompile
 /* Checks whether the next sequence of tokens is a qualident *
  * and returns the qualident string                          *
  * !!! Proceeds from current peek position !!!               */
 bool IsQualident(ref Token pt, out string qualident)
 {
     qualident = "";
     if (pt.kind == _ident) {
     qualident = pt.val;
     pt = scanner.Peek();
     while (pt.kind == _dot) {
     pt = scanner.Peek();
     if (pt.kind != _ident) return false;
     qualident += "." + pt.val;
     pt = scanner.Peek();
     }
     return true;
     } else return false;
 }
コード例 #7
0
ファイル: Parser.cs プロジェクト: Xpitfire/CrossCompile
 // skip: { "[" { "," } "]" | "*" }
 // !!! Proceeds from current peek position !!!
 bool IsPointerOrDims(ref Token pt)
 {
     for (;;) {
     if (pt.kind == _lbrack) {
     do pt = scanner.Peek();
     while (pt.kind == _comma);
     if (pt.kind != _rbrack) return false;
     } else if (pt.kind != _times) break;
     pt = scanner.Peek();
     }
     return true;
 }
コード例 #8
0
ファイル: Parser.cs プロジェクト: Xpitfire/CrossCompile
        void Get()
        {
            for (;;) {
            t = la;
            la = scanner.Scan();
            if (la.kind <= maxT) { ++errDist; break; }

            la = t;
            }
        }
コード例 #9
0
ファイル: Parser.cs プロジェクト: Xpitfire/CrossCompile
 public void Parse()
 {
     la = new Token();
     la.val = "";
     Get();
     JavaScript();
     Expect(0);
 }