internal void AddLexCategory(LexSpan nLoc, LexSpan vLoc)
        {
            // string name = aast.scanner.buffer.GetString(nVal.startIndex, nVal.endIndex + 1);
            string name = aast.scanner.Buffer.GetString(nLoc.startIndex, nLoc.endIndex);
            string verb = aast.scanner.Buffer.GetString(vLoc.startIndex, vLoc.endIndex);

            if (!aast.AddLexCategory(name, verb, vLoc))
            {
                handler.ListError(nLoc, 52, name);
            }
            // handler.AddError("Error: name " + name + " already defined", nLoc);
        }
 internal void AddCharSetPredicates()
 {
     for (int i = 0; i < nameList.Count; i++)
     {
         string  s = nameList[i];
         LexSpan l = nameLocs[i];
         aast.AddLexCatPredicate(s, l);
     }
     // And now clear the nameList
     nameList.Clear();
     nameLocs.Clear();
 }
 /// <summary>
 /// This method adds newly defined start condition names to the
 /// table of start conditions.
 /// </summary>
 /// <param name="isExcl">True iff the start condition is exclusive</param>
 internal void AddNames(bool isExcl)
 {
     for (int i = 0; i < nameList.Count; i++)
     {
         string  s = nameList[i];
         LexSpan l = nameLocs[i];
         if (Char.IsDigit(s[0]))
         {
             handler.ListError(l, 72, s);
         }
         else if (!aast.AddStartState(isExcl, s))
         {
             handler.ListError(l, 50, s);
         }
     }
     // And now clear the nameList
     nameList.Clear();
     nameLocs.Clear();
 }
 public ScanObj(int t, int val, LexSpan loc)
 {
     this.token = t; this.yylval = val; this.yylloc = loc;
 }
 internal void AddName(LexSpan l)
 {
     nameLocs.Add(l);
     nameList.Add(aast.scanner.Buffer.GetString(l.startIndex, l.endIndex));
 }
Exemple #6
0
 internal void AddError(string msg, LexSpan spn)
 {
     this.AddError(new Error(3, msg, spn, false)); errNum++;
 }
Exemple #7
0
        internal void ListError(LexSpan spn, int num)
        {
            string message;

            switch (num)
            {
            case 54: message = "Invalid character range: lower bound > upper bound"; break;

            case 56: message = "\"using\" is illegal, use \"%using\" instead"; break;

            case 57: message = "\"namespace\" is illegal, use \"%namespace\" instead"; break;

            case 58: message = "Type declarations impossible in this context"; break;

            case 59: message = "\"next\" action '|' cannot be used on last pattern"; break;

            case 60: message = "Unterminated block comment starts here"; break;

            case 63: message = "Invalid single-line action"; break;

            case 64: message = "This token unexpected"; break;

            case 65: message = "Invalid action"; break;

            case 66: message = "Missing comma in namelist"; break;

            case 67: message = "Invalid or empty namelist"; break;

            case 68: message = "Invalid production rule"; break;

            case 69: message = "Symbols '^' and '$' can only occur at the ends of patterns"; break;

            case 73: message = "No namespace has been defined"; break;

            case 75: message = "Context must have fixed right length or fixed left length"; break;

            case 77: message = "Unknown LEX tag name"; break;

            case 78: message = "Expected space here"; break;

            case 79: message = "Illegal character in this context"; break;

            case 80: message = "Expected end-of-line here"; break;

            case 81: message = "Invalid character range, no upper bound character"; break;

            case 82: message = "Invalid class character: '-' must be \\escaped"; break;

            case 89: message = "Empty semantic action, must be at least a comment"; break;

            case 90: message = "\"%%\" marker must start at beginning of line"; break;

            case 91: message = "Version of gplexx.frame is not recent enough"; break;

            case 92: message = "Non unicode scanners only allow single-byte codepages"; break;

            case 93: message = "Non unicode scanners cannot use /codepage:guess"; break;

            case 94: message = "This assembly could not be found"; break;

            case 95: message = "This assembly could not be loaded"; break;

            case 98: message = "Only \"public\" or \"internal\" allowed here"; break;

            case 100: message = "Context operator cannot be used with right anchor '$'"; break;

            case 101: message = "Extra characters at end of regular expression"; break;

            case 102: message = "Literal string terminated by end of line"; break;

            // Warnings ...

            case 110: message = "Code between rules, ignored"; break;

            case 112: message = "/babel option is unsafe without /unicode option"; break;

            case 115: message = "This pattern matches \"\", and might loop"; break;

            case 116: message = "This pattern is never matched"; break;

            case 118: message = "This constructed set is empty"; break;

            default:  message = "Error " + Convert.ToString(num, CultureInfo.InvariantCulture); break;
            }
            this.AddError(new Error(num, message, spn, num >= Error.minWrn));
            if (num < Error.minWrn)
            {
                errNum++;
            }
            else
            {
                wrnNum++;
            }
        }
Exemple #8
0
        void ListError(LexSpan spn, int num, string key, char lh, char rh)
        {
            string prefix, suffix, message;

            switch (num)
            {
            case   1: prefix = "Parser error"; suffix = "";
                break;

            case  50: prefix = "Start state"; suffix = "already defined";
                break;

            case  51: prefix = "Start state"; suffix = "undefined";
                break;

            case  52: prefix = "Lexical category"; suffix = "already defined";
                break;

            case  53: prefix = "Expected character"; suffix = "";
                break;

            case 55: prefix = "Unknown lexical category"; suffix = "";
                break;

            case 61: prefix = "Missing matching construct"; suffix = "";
                break;

            case 62: prefix = "Unexpected symbol, skipping to "; suffix = "";
                break;

            case 70: prefix = "Illegal character escape "; suffix = "";
                break;

            case 71: prefix = "Lexical category must be a character class "; suffix = "";
                break;

            case 72: prefix = "Illegal name for start condition "; suffix = "";
                break;

            case 74: prefix = "Unrecognized \"%option\" command "; suffix = "";
                break;

            case 76: prefix = "Unknown character predicate"; suffix = "";
                break;

            case 83: prefix = "Cannot set /unicode option inconsistently"; suffix = "";
                break;

            case 84: prefix = "Inconsistent \"%option\" command "; suffix = "";
                break;

            case 85: prefix = "Unicode literal too large:"; suffix = "use %option unicode";
                break;

            case 86: prefix = "Illegal octal character escape "; suffix = "";
                break;

            case 87: prefix = "Illegal hexadecimal character escape "; suffix = "";
                break;

            case 88: prefix = "Illegal unicode character escape "; suffix = "";
                break;

            case 96: prefix = "Class"; suffix = "not found in assembly";
                break;

            case 97: prefix = "Method"; suffix = "not found in class";
                break;

            case 99: prefix = "Illegal escape sequence"; suffix = "";
                break;

            case 103: prefix = "Expected character with property"; suffix = "";
                break;

            // Warnings ...

            case 111: prefix = "This char"; suffix = "does not need escape in character class";
                break;

            case 113: prefix = "Special case:"; suffix = "included as set class member";
                break;

            case 114: prefix = "No upper bound to range,"; suffix = "included as set class members";
                break;

            case 116: prefix = "This pattern always overridden by"; suffix = ""; break;

            case 117: prefix = "This pattern always overrides"; suffix = ""; break;

            case 121: prefix = "char class"; suffix = ""; break;

            default: prefix = "Error " + Convert.ToString(num, CultureInfo.InvariantCulture); suffix = "";
                break;
            }
            // message = prefix + " <" + key + "> " + suffix;
            message = String.Format(CultureInfo.InvariantCulture, "{0} {1}{2}{3} {4}", prefix, lh, key, rh, suffix);
            this.AddError(new Error(num, message, spn, num >= Error.minWrn));
            if (num < Error.minWrn)
            {
                errNum++;
            }
            else
            {
                wrnNum++;
            }
        }
Exemple #9
0
 internal void ListError(LexSpan spn, int num, string key)
 {
     ListError(spn, num, key, '<', '>');
 }
Exemple #10
0
 /// <summary>
 /// Add this error to the error buffer.
 /// </summary>
 /// <param name="spn">The span to which the error is attached</param>
 /// <param name="num">The error number</param>
 /// <param name="key">The featured string</param>
 internal void ListError(LexSpan spn, int num, string key, char quote)
 {
     ListError(spn, num, key, quote, quote);
 }