PageRenderTime 194ms CodeModel.GetById 121ms app.highlight 64ms RepoModel.GetById 1ms app.codeStats 1ms

/bundles/plugins-trunk/XML/sidekick/css/parser/CSS3Parser.java

#
Java | 2410 lines | 2249 code | 69 blank | 92 comment | 327 complexity | 8c8ca35dbd5612f39d14638901fadf4b MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/* Generated By:JavaCC: Do not edit this line. CSS3Parser.java */
   2package sidekick.css.parser;
   3
   4import java.io.*;
   5import java.net.*;
   6import java.text.MessageFormat;
   7import java.util.*;
   8import java.util.regex.*;
   9import sidekick.util.*;
  10import org.gjt.sp.jedit.jEdit;
  11
  12
  13/**
  14 * A CSS3 parser
  15 *
  16 * @author Philippe Le Hegaret and Sijtsche Smeman
  17 * @author Dale Anson, major modifications for jEdit Sidekick
  18 * @version Revision: 1.71 (W3C version)
  19 */
  20
  21
  22public class CSS3Parser implements CSS3ParserConstants {
  23
  24    private List<ParseError> parseErrors = new ArrayList<ParseError>();
  25    private List<ParseError> parseWarnings = new ArrayList<ParseError>();
  26    private boolean proprietaryAsError = true;
  27
  28    private static char hexdigits[] = { '0' ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'a' ,'b' ,'c' ,'d' ,'e' ,'f' } ;
  29
  30    /**
  31     * The line offset is used when the css to be parsed is only part of a file,
  32     * for example when the css is the contents of a style block contained within
  33     * an html document.
  34     * @param lineOffset The line number of the first line of the css.
  35     * @param columnOffset The column number of the first character of the css.
  36     */
  37    public CSS3Parser(Reader in, int lineOffset, int columnOffset){
  38        this(in);
  39        jj_input_stream.ReInit(in,lineOffset,columnOffset);
  40    }
  41
  42    /**
  43     * Set the tab size on the input stream.  This should be set to the same
  44     * tab size as used in the buffer being parsed, otherwise, locations will
  45     * be off.    
  46     */
  47    public void setTabSize(int size) {
  48        jj_input_stream.setTabSize(size);
  49    }
  50
  51    /**
  52     * @return the current tab size used by the input stream.    
  53     */
  54    public int getTabSize() {
  55        return jj_input_stream.getTabSize(0);
  56    }
  57
  58    /**
  59     * If set to true, then a warning will be generated when proprietary
  60     * CSS markup is used.
  61     * @param b If set to true, then a warning will be generated when proprietary
  62     * CSS markup is used.
  63     */
  64    public void setProprietaryAsError(boolean b) {
  65        proprietaryAsError = b;
  66    }
  67
  68    /**
  69     * Adds a parse exception to the list of parse exceptions. It is intended
  70     * that a complete file will be parsed and accumulate the exceptions rather
  71     * than quitting on the first exception.
  72     * @param pe A parse exception to add to the list.
  73     */
  74    private void addException(ParseException pe) {
  75        Range range = getExceptionLocation( pe );
  76        parseErrors.add(new ParseError(pe.getMessage(), range));
  77        //pe.printStackTrace();
  78    }
  79
  80    private void addWarning(ParseError pe) {
  81        parseWarnings.add(pe);
  82    }
  83
  84    /**
  85     * @return The list of parse exceptions found during parsing of a file.    
  86     */
  87    public List<ParseError> getParseErrors() {
  88       //System.out.println("getParserErrors, there are " + parseErrors.size() + " errors");
  89       return parseErrors;
  90    }
  91
  92    public List<ParseError> getParseWarnings() {
  93        return parseWarnings;
  94    }
  95
  96    // regex to extract line and colun from a ParseException message
  97    // ParseException message look like: "Parse error at line 116, column 5.  Encountered: }"
  98    private Pattern pePattern = Pattern.compile( "(.*?)(\u005c\u005cd+)(.*?)(\u005c\u005cd+)(.*?)" );
  99
 100    /**
 101     * @return attempts to return a Location indicating the location of a parser
 102     * exception.  If the ParseException contains a Token reference, all is well,
 103     * otherwise, this method attempts to parse the message string for the
 104     * exception.
 105     */
 106    private Range getExceptionLocation( ParseException pe ) {
 107        Token t = pe.currentToken;
 108        if ( t != null ) {
 109            return  new Range( new Location( t.next.beginLine, t.next.beginColumn-1 ), new Location( t.next.endLine, t.next.endColumn ) );
 110        }
 111
 112        // ParseException message look like: "Parse error at line 116, column 5.  Encountered: }"
 113        try {
 114            Matcher m = pePattern.matcher( pe.getMessage() );
 115            if ( m.matches() ) {
 116                String ln = m.group( 2 );
 117                String cn = m.group( 4 );
 118                int line_number = -1;
 119                int column_number = 0;
 120                if ( ln != null )
 121                    line_number = Integer.parseInt( ln );
 122                if ( cn != null )
 123                    column_number = Integer.parseInt( cn );
 124                return line_number > -1 ? new Range( new Location( line_number - 1, column_number - 1 ), new Location( line_number - 1, column_number ) ) : null;
 125            }
 126            return new Range();
 127        } catch ( Exception e ) {
 128            //e.printStackTrace();
 129            return new Range();
 130        }
 131    }
 132
 133    public void error_skipto(int kind) {
 134       Token t = null;
 135       int i = 0;
 136       do {
 137           i++;
 138           if (i > 100) {
 139                break;
 140           }
 141           t = getNextToken();
 142       } while (t != null && t.kind != kind);
 143    }
 144
 145    /**
 146     * @param t A token to create a location from.
 147     * @return A location representing the start of the token.
 148     */
 149    public Location getStartLocation(Token t) {
 150       if (t == null)
 151           return new Location(0, 0);
 152       return new Location(t.beginLine + 1, t.beginColumn);
 153    }
 154
 155    /**
 156     * @param t A token to create a location from.
 157     * @return A location representing the end of the token.
 158     */
 159    public Location getEndLocation(Token t) {
 160       if (t == null)
 161           return new Location(0, 0);
 162       return new Location(t.endLine + 1, t.endColumn + 1);
 163    }
 164
 165    /**
 166     * Creates a CSSNode from a token using the token image as the node name
 167     * and the token start and end for node start and end locations.
 168     */
 169    public CSSNode createNode(Token t) {
 170        if (t == null) {
 171            return new CSSNode();
 172        }
 173        CSSNode node = new CSSNode(t.image);
 174        node.setStartLocation(getStartLocation(t));
 175        node.setEndLocation(getEndLocation(t));
 176        return node;
 177    }
 178
 179    /**
 180     * Simple check to verify that all arguments are not null.
 181     */
 182    public boolean notNull(Object... args) {
 183        for (Object o : args) {
 184            if (o == null) {
 185                return false;
 186            }
 187        }
 188        return true;
 189    }
 190
 191    // these property names are defined in CSS3, but are supported by at most
 192    // one browser.
 193    static final String[] invalidProperties = new String[]{
 194        "alignment-adjust",
 195        "alignment-baseline",
 196        "backface-visibility",
 197        "baseline-shift",
 198        "bookmark-label",
 199        "bookmark-level",
 200        "bookmark-target",
 201        "border-image-outset",
 202        "border-image-repeat",
 203        "border-image-slice",
 204        "border-image-source",
 205        "border-image-width",
 206        "box-decoration-break",
 207        "box-flex-group",
 208        "box-lines",
 209        "color-profile",
 210        "column-fill",
 211        "crop",
 212        "dominant-baseline",
 213        "drop-initial-after-adjust",
 214        "drop-initial-after-align",
 215        "drop-initial-before-adjust",
 216        "drop-initial-before-align",
 217        "drop-initial-size",
 218        "drop-initial-value",
 219        "fit",
 220        "fit-position",
 221        "float-offset",
 222        "font-stretch",
 223        "font-size-adjust",
 224        "grid-columns",
 225        "grid-rows",
 226        "hanging-punctuation",
 227        "hyphenate-after",
 228        "hyphenate-before",
 229        "hyphenate-characters",
 230        "hyphenate-lines",
 231        "hyphenate-resource",
 232        "hyphens",
 233        "icon",
 234        "image-orientation",
 235        "image-resolution",
 236        "inline-box-align",
 237        "line-stacking",
 238        "line-stacking-ruby",
 239        "line-stacking-shift",
 240        "line-stacking-strategy",
 241        "mark",
 242        "mark-after",
 243        "mark-before",
 244        "marks",
 245        "marquee-direction",
 246        "marquee-play-count",
 247        "marquee-speed",
 248        "marquee-style",
 249        "move-to",
 250        "nav-down",
 251        "nav-index",
 252        "nav-left",
 253        "nav-right",
 254        "nav-up",
 255        "overflow-style",
 256        "page",
 257        "page-policy",
 258        "phonemes",
 259        "punctuation-trim",
 260        "rest",
 261        "rest-after",
 262        "rest-before",
 263        "rotation",
 264        "rotation-point",
 265        "ruby-align",
 266        "ruby-overhang",
 267        "ruby-position",
 268        "ruby-span",
 269        "size",
 270        "string-set",
 271        "target",
 272        "target-name",
 273        "target-new",
 274        "target-position",
 275        "text-align-last",
 276        "text-emphasis",
 277        "text-height",
 278        "text-outline",
 279        "text-wrap",
 280        "voice-balance",
 281        "voice-duration",
 282        "voice-pitch",
 283        "voice-pitch-range",
 284        "voice-rate",
 285        "voice-stress",
 286        "voice-volume"};
 287
 288    public boolean isUnsupported(String propertyName) {
 289        return unsupportedPropertyNames.contains(propertyName);
 290    }
 291
 292    public final static HashSet<String> unsupportedPropertyNames;
 293    static {
 294        unsupportedPropertyNames = new HashSet<String>();
 295        for (String name : invalidProperties) {
 296            unsupportedPropertyNames.add(name);
 297        }
 298    }
 299
 300
 301    // For testing.  Usage: java CSS3Parser < inputfile
 302    public static void main(String[] args) {
 303        try {
 304            CSS3Parser parser = new CSS3Parser(System.in);
 305            parser.styleSheet();
 306        }
 307        catch(Exception e) {
 308            e.printStackTrace();
 309        }
 310    }
 311
 312//<DEFAULT, IN_COMMENT>
 313//TOKEN :
 314//{ /* avoid token manager error */
 315//   < UNKNOWN : ~[] >
 316//}
 317
 318
 319
 320/*
 321 * The grammar for CSS2 and CSS3 starts here.
 322 */
 323
 324
 325/**
 326 * The main entry for the parser. The W3C version called this method "parserUnit".
 327 * I changed the name so it matches up with the older CSS2 parser.
 328 *
 329 * @exception ParseException exception during the parse
 330 */
 331  final public CSSNode styleSheet() throws ParseException {
 332    CSSNode rootNode = new CSSNode("style");
 333    CSSNode firstNode = null;
 334    CSSNode childNode = null;
 335    List<CSSNode> children = null;
 336    try {
 337      label_1:
 338      while (true) {
 339        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 340        case HTMLSTARTTAG:
 341        case HTMLENDTAG:
 342          ;
 343          break;
 344        default:
 345          jj_la1[0] = jj_gen;
 346          break label_1;
 347        }
 348        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 349        case HTMLSTARTTAG:
 350          jj_consume_token(HTMLSTARTTAG);
 351          break;
 352        case HTMLENDTAG:
 353          jj_consume_token(HTMLENDTAG);
 354          break;
 355        default:
 356          jj_la1[1] = jj_gen;
 357          jj_consume_token(-1);
 358          throw new ParseException();
 359        }
 360                addException ( new ParseException (jEdit.getProperty("sidekick.css.parser.CSS3Parser.dont-html")));
 361      }
 362      label_2:
 363      while (true) {
 364        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 365        case CHARSET_SYM:
 366          ;
 367          break;
 368        default:
 369          jj_la1[2] = jj_gen;
 370          break label_2;
 371        }
 372        childNode = charset();
 373                if (childNode != null) {
 374                    rootNode.addChild(childNode);
 375                    if (firstNode == null) {
 376                        firstNode = childNode;
 377                        rootNode.setStartLocation(firstNode.getStartLocation());
 378                    }
 379                }
 380      }
 381      label_3:
 382      while (true) {
 383        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 384        case S:
 385        case CDO:
 386        case CDC:
 387          ;
 388          break;
 389        default:
 390          jj_la1[3] = jj_gen;
 391          break label_3;
 392        }
 393        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 394        case S:
 395          jj_consume_token(S);
 396          break;
 397        case CDO:
 398          jj_consume_token(CDO);
 399          break;
 400        case CDC:
 401          jj_consume_token(CDC);
 402          break;
 403        default:
 404          jj_la1[4] = jj_gen;
 405          jj_consume_token(-1);
 406          throw new ParseException();
 407        }
 408      }
 409      label_4:
 410      while (true) {
 411        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 412        case IMPORT_SYM:
 413          ;
 414          break;
 415        default:
 416          jj_la1[5] = jj_gen;
 417          break label_4;
 418        }
 419        childNode = importDeclaration();
 420                if (childNode != null) {
 421                    rootNode.addChild(childNode);
 422                    if (firstNode == null) {
 423                        firstNode = childNode;
 424                        rootNode.setStartLocation(firstNode.getStartLocation());
 425                    }
 426                }
 427        ignoreStatement();
 428      }
 429      label_5:
 430      while (true) {
 431        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 432        case NAMESPACE_SYM:
 433          ;
 434          break;
 435        default:
 436          jj_la1[6] = jj_gen;
 437          break label_5;
 438        }
 439        childNode = namespaceDeclaration();
 440                if (childNode != null) {
 441                    rootNode.addChild(childNode);
 442                    if (firstNode == null) {
 443                        firstNode = childNode;
 444                        rootNode.setStartLocation(firstNode.getStartLocation());
 445                    }
 446                }
 447        ignoreStatement();
 448      }
 449      children = afterImportDeclaration();
 450            if (children != null && children.size() > 0) {
 451                rootNode.setEndLocation(children.get(children.size() - 1).getEndLocation());
 452                rootNode.addChildren(children);
 453            }
 454      jj_consume_token(0);
 455    } catch (TokenMgrError err) {
 456        addException ( new ParseException ("Unrecognized token, " + err.getMessage()));
 457    }
 458        {if (true) return rootNode;}
 459    throw new Error("Missing return statement in function");
 460  }
 461
 462  final public CSSNode charset() throws ParseException {
 463    Token start = null;
 464    Token middle = null;
 465    Token end = null;
 466    CSSNode node = null;
 467    try {
 468      start = jj_consume_token(CHARSET_SYM);
 469      label_6:
 470      while (true) {
 471        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 472        case S:
 473          ;
 474          break;
 475        default:
 476          jj_la1[7] = jj_gen;
 477          break label_6;
 478        }
 479        jj_consume_token(S);
 480
 481      }
 482      middle = jj_consume_token(STRING);
 483      label_7:
 484      while (true) {
 485        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 486        case S:
 487          ;
 488          break;
 489        default:
 490          jj_la1[8] = jj_gen;
 491          break label_7;
 492        }
 493        jj_consume_token(S);
 494      }
 495      end = jj_consume_token(SEMICOLON);
 496
 497    } catch (ParseException e) {
 498        addException(e);
 499        error_skipto(RBRACE);
 500        {if (true) return null;}
 501    }
 502        if (notNull(start, middle, end)) {
 503            String name = start.image + " " + middle.image;
 504            node = new CSSNode(name);
 505            node.setStartLocation(getStartLocation(start));
 506            node.setEndLocation(getEndLocation(end));
 507        }
 508        {if (true) return node;}
 509    throw new Error("Missing return statement in function");
 510  }
 511
 512  final public List<CSSNode> afterImportDeclaration() throws ParseException {
 513    CSSNode node = null;
 514    List<CSSNode> list = new ArrayList<CSSNode>();
 515    String skip = null;
 516    try {
 517      label_8:
 518      while (true) {
 519        ;
 520        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 521        case IDENT:
 522        case HASHIDENT:
 523        case HASH:
 524        case LBRACKET:
 525        case ANY:
 526        case COLON:
 527        case LENGTH:
 528        case EMS:
 529        case EXS:
 530        case ANGLE:
 531        case TIME:
 532        case FREQ:
 533        case RESOLUTION:
 534        case DIMEN:
 535        case PSEUDOELEMENT_SYM:
 536        case CLASS:
 537        case FUNCTIONNOT:
 538        case 98:
 539          node = ruleSet();
 540                                if (node != null) list.add(node);
 541          break;
 542        case MEDIA_SYM:
 543          node = media();
 544                              if (node != null) list.add(node);
 545          break;
 546        case PAGE_SYM:
 547          node = page();
 548                             if (node != null) list.add(node);
 549          break;
 550        case FONT_FACE_SYM:
 551          node = fontFace();
 552                                 if (node != null) list.add(node);
 553          break;
 554        case PREF_SYM:
 555          node = preference();
 556                                   if (node != null) list.add(node);
 557          break;
 558        case COLOR_PROFILE:
 559          node = colorprofile();
 560                                     if (node != null) list.add(node);
 561          break;
 562        case PHONETIC_ALPHABET_SYM:
 563          node = phoneticAlphabet();
 564                                         if (node != null) list.add(node);
 565          break;
 566        default:
 567          jj_la1[9] = jj_gen;
 568          skip = skipStatement();
 569                  if (skip == null || skip.length() == 0) {
 570                    {if (true) return list;}
 571                  }
 572        }
 573        ignoreStatement();
 574      }
 575    } catch (ParseException e) {
 576        addException(e);
 577        error_skipto(RBRACE);
 578        {if (true) return null;}
 579    }
 580        {if (true) return list;}
 581    throw new Error("Missing return statement in function");
 582  }
 583
 584  final public void ignoreStatement() throws ParseException {
 585    label_9:
 586    while (true) {
 587      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 588      case CDO:
 589      case CDC:
 590      case ATKEYWORD:
 591        ;
 592        break;
 593      default:
 594        jj_la1[10] = jj_gen;
 595        break label_9;
 596      }
 597      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 598      case CDO:
 599        jj_consume_token(CDO);
 600        break;
 601      case CDC:
 602        jj_consume_token(CDC);
 603        break;
 604      case ATKEYWORD:
 605        atRuleDeclaration();
 606        break;
 607      default:
 608        jj_la1[11] = jj_gen;
 609        jj_consume_token(-1);
 610        throw new ParseException();
 611      }
 612      label_10:
 613      while (true) {
 614        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 615        case S:
 616          ;
 617          break;
 618        default:
 619          jj_la1[12] = jj_gen;
 620          break label_10;
 621        }
 622        jj_consume_token(S);
 623      }
 624    }
 625
 626  }
 627
 628  final public CSSNode namespaceDeclaration() throws ParseException {
 629    CSSNode node = null;
 630    Token start = null;
 631    Token ident = null;
 632    Token uri = null;
 633    Token end = null;
 634    try {
 635      start = jj_consume_token(NAMESPACE_SYM);
 636      label_11:
 637      while (true) {
 638        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 639        case S:
 640          ;
 641          break;
 642        default:
 643          jj_la1[13] = jj_gen;
 644          break label_11;
 645        }
 646        jj_consume_token(S);
 647      }
 648      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 649      case IDENT:
 650        ident = jj_consume_token(IDENT);
 651        label_12:
 652        while (true) {
 653          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 654          case S:
 655            ;
 656            break;
 657          default:
 658            jj_la1[14] = jj_gen;
 659            break label_12;
 660          }
 661          jj_consume_token(S);
 662        }
 663        break;
 664      default:
 665        jj_la1[15] = jj_gen;
 666        ;
 667      }
 668      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 669      case STRING:
 670        uri = jj_consume_token(STRING);
 671        break;
 672      case URL:
 673        uri = jj_consume_token(URL);
 674        break;
 675      default:
 676        jj_la1[16] = jj_gen;
 677        jj_consume_token(-1);
 678        throw new ParseException();
 679      }
 680      label_13:
 681      while (true) {
 682        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 683        case S:
 684          ;
 685          break;
 686        default:
 687          jj_la1[17] = jj_gen;
 688          break label_13;
 689        }
 690        jj_consume_token(S);
 691      }
 692      end = jj_consume_token(SEMICOLON);
 693      label_14:
 694      while (true) {
 695        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 696        case S:
 697          ;
 698          break;
 699        default:
 700          jj_la1[18] = jj_gen;
 701          break label_14;
 702        }
 703        jj_consume_token(S);
 704      }
 705    } catch (ParseException e) {
 706        addException(e);
 707        error_skipto(SEMICOLON);
 708        {if (true) return null;}
 709    }
 710        if (notNull(start, uri, end)) {
 711            String name = start.image + " " + (ident != null ? ident.image : "") + uri.image;
 712            node = new CSSNode(name);
 713            node.setStartLocation(getStartLocation(start));
 714            node.setEndLocation(getEndLocation(end));
 715        }
 716        {if (true) return node;}
 717    throw new Error("Missing return statement in function");
 718  }
 719
 720/**
 721 * The import statement
 722 *
 723 * @exception ParseException exception during the parse
 724 */
 725  final public CSSNode importDeclaration() throws ParseException {
 726    Token start = null;
 727    CSSNode medium = null;
 728    List<CSSNode> mediumList = new ArrayList<CSSNode>();
 729    Token uri = null;
 730    Token end = null;
 731    CSSNode node = null;
 732    try {
 733      start = jj_consume_token(IMPORT_SYM);
 734      label_15:
 735      while (true) {
 736        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 737        case S:
 738          ;
 739          break;
 740        default:
 741          jj_la1[19] = jj_gen;
 742          break label_15;
 743        }
 744        jj_consume_token(S);
 745      }
 746      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 747      case STRING:
 748        uri = jj_consume_token(STRING);
 749        break;
 750      case URL:
 751        uri = jj_consume_token(URL);
 752        break;
 753      default:
 754        jj_la1[20] = jj_gen;
 755        jj_consume_token(-1);
 756        throw new ParseException();
 757      }
 758      label_16:
 759      while (true) {
 760        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 761        case S:
 762          ;
 763          break;
 764        default:
 765          jj_la1[21] = jj_gen;
 766          break label_16;
 767        }
 768        jj_consume_token(S);
 769      }
 770      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 771      case IDENT:
 772        medium = medium();
 773                             if (medium != null) mediumList.add(medium);
 774        label_17:
 775        while (true) {
 776          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 777          case COMMA:
 778            ;
 779            break;
 780          default:
 781            jj_la1[22] = jj_gen;
 782            break label_17;
 783          }
 784          jj_consume_token(COMMA);
 785          label_18:
 786          while (true) {
 787            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 788            case S:
 789              ;
 790              break;
 791            default:
 792              jj_la1[23] = jj_gen;
 793              break label_18;
 794            }
 795            jj_consume_token(S);
 796          }
 797          medium = medium();
 798                                 if (medium != null) mediumList.add(medium);
 799        }
 800        break;
 801      default:
 802        jj_la1[24] = jj_gen;
 803        ;
 804      }
 805      end = jj_consume_token(SEMICOLON);
 806      label_19:
 807      while (true) {
 808        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 809        case S:
 810          ;
 811          break;
 812        default:
 813          jj_la1[25] = jj_gen;
 814          break label_19;
 815        }
 816        jj_consume_token(S);
 817      }
 818    } catch (ParseException e) {
 819        addException(e);
 820        error_skipto(SEMICOLON);
 821        {if (true) return null;}
 822    }
 823        if (notNull(start, end)) {
 824            StringBuilder sb = new StringBuilder();
 825            for (CSSNode m : mediumList) {
 826                sb.append(m).append(',');
 827            }
 828            String mediumNames = sb.substring(0, Math.max(0, sb.length() - 1));   // trims the trailing comma
 829            String name = start.image + (uri != null ? " " + uri.image : "") + (mediumNames.length() > 0 ? " " + mediumNames : "");
 830            node = new CSSNode(name);
 831            node.setStartLocation(getStartLocation(start));
 832            node.setEndLocation(getEndLocation(end));
 833        }
 834        {if (true) return node;}
 835    throw new Error("Missing return statement in function");
 836  }
 837
 838  final public CSSNode media() throws ParseException {
 839    Token start = null;
 840    Token mr = null;
 841    CSSNode medium = null;
 842    List<CSSNode> mlist = new ArrayList<CSSNode>();
 843    CSSNode mdecl = null;
 844    List<CSSNode> mdeclList = new ArrayList<CSSNode>();
 845    CSSNode ruleset = null;
 846    Token end = null;
 847    try {
 848      start = jj_consume_token(MEDIA_SYM);
 849      label_20:
 850      while (true) {
 851        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 852        case S:
 853          ;
 854          break;
 855        default:
 856          jj_la1[26] = jj_gen;
 857          break label_20;
 858        }
 859        jj_consume_token(S);
 860      }
 861      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 862      case MEDIARESTRICTOR:
 863        mr = jj_consume_token(MEDIARESTRICTOR);
 864        label_21:
 865        while (true) {
 866          jj_consume_token(S);
 867          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 868          case S:
 869            ;
 870            break;
 871          default:
 872            jj_la1[27] = jj_gen;
 873            break label_21;
 874          }
 875        }
 876        break;
 877      default:
 878        jj_la1[28] = jj_gen;
 879        ;
 880      }
 881      // </CSS3>
 882      
 883              medium = medium();
 884                         if (medium != null) mlist.add(medium);
 885      label_22:
 886      while (true) {
 887        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 888        case COMMA:
 889          ;
 890          break;
 891        default:
 892          jj_la1[29] = jj_gen;
 893          break label_22;
 894        }
 895        jj_consume_token(COMMA);
 896        label_23:
 897        while (true) {
 898          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 899          case S:
 900            ;
 901            break;
 902          default:
 903            jj_la1[30] = jj_gen;
 904            break label_23;
 905          }
 906          jj_consume_token(S);
 907        }
 908        medium = medium();
 909                             if (medium != null) mlist.add(medium);
 910      }
 911      label_24:
 912      while (true) {
 913        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 914        case AND:
 915          ;
 916          break;
 917        default:
 918          jj_la1[31] = jj_gen;
 919          break label_24;
 920        }
 921        jj_consume_token(AND);
 922        label_25:
 923        while (true) {
 924          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 925          case S:
 926            ;
 927            break;
 928          default:
 929            jj_la1[32] = jj_gen;
 930            break label_25;
 931          }
 932          jj_consume_token(S);
 933        }
 934        jj_consume_token(LPARAN);
 935        label_26:
 936        while (true) {
 937          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 938          case S:
 939            ;
 940            break;
 941          default:
 942            jj_la1[33] = jj_gen;
 943            break label_26;
 944          }
 945          jj_consume_token(S);
 946        }
 947        mdecl = mediadeclaration();
 948                                      if(mdecl != null) mdeclList.add(mdecl);
 949        jj_consume_token(RPARAN);
 950        label_27:
 951        while (true) {
 952          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 953          case S:
 954            ;
 955            break;
 956          default:
 957            jj_la1[34] = jj_gen;
 958            break label_27;
 959          }
 960          jj_consume_token(S);
 961        }
 962      }
 963      jj_consume_token(LBRACE);
 964      label_28:
 965      while (true) {
 966        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 967        case S:
 968          ;
 969          break;
 970        default:
 971          jj_la1[35] = jj_gen;
 972          break label_28;
 973        }
 974        jj_consume_token(S);
 975      }
 976      label_29:
 977      while (true) {
 978        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
 979        case IDENT:
 980        case HASHIDENT:
 981        case HASH:
 982        case LBRACKET:
 983        case ANY:
 984        case COLON:
 985        case LENGTH:
 986        case EMS:
 987        case EXS:
 988        case ANGLE:
 989        case TIME:
 990        case FREQ:
 991        case RESOLUTION:
 992        case DIMEN:
 993        case PSEUDOELEMENT_SYM:
 994        case CLASS:
 995        case FUNCTIONNOT:
 996        case 98:
 997          ;
 998          break;
 999        default:
1000          jj_la1[36] = jj_gen;
1001          break label_29;
1002        }
1003        ruleset = ruleSet();
1004      }
1005      end = jj_consume_token(RBRACE);
1006      label_30:
1007      while (true) {
1008        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1009        case S:
1010          ;
1011          break;
1012        default:
1013          jj_la1[37] = jj_gen;
1014          break label_30;
1015        }
1016        jj_consume_token(S);
1017      }
1018    } catch (ParseException e) {
1019        addException(e);
1020        error_skipto(RBRACE);
1021        {if (true) return null;}
1022    }
1023        if (notNull(start, end)) {
1024            CSSNode node = new CSSNode(start.image);
1025            if (mr != null) {
1026                node.addChild(createNode(mr));
1027            }
1028            node.addChildren(mlist);
1029            node.addChildren(mdeclList);
1030            node.setStartLocation(getStartLocation(start));
1031            node.setEndLocation(getEndLocation(end));
1032            {if (true) return node;}
1033        }
1034        {if (true) return null;}
1035    throw new Error("Missing return statement in function");
1036  }
1037
1038  final public CSSNode medium() throws ParseException {
1039    Token t = null;
1040    t = jj_consume_token(IDENT);
1041    label_31:
1042    while (true) {
1043      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1044      case S:
1045        ;
1046        break;
1047      default:
1048        jj_la1[38] = jj_gen;
1049        break label_31;
1050      }
1051      jj_consume_token(S);
1052    }
1053        if (notNull(t)) {
1054            {if (true) return createNode(t);}
1055        }
1056        {if (true) return null;}
1057    throw new Error("Missing return statement in function");
1058  }
1059
1060  final public CSSNode unused_production_generic_syntax() throws ParseException {
1061    Token start = null;
1062    CSSNode term = null;
1063    Token end = null;
1064    try {
1065      start = jj_consume_token(LPARAN);
1066      label_32:
1067      while (true) {
1068        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1069        case S:
1070          ;
1071          break;
1072        default:
1073          jj_la1[39] = jj_gen;
1074          break label_32;
1075        }
1076        jj_consume_token(S);
1077      }
1078      term = term();
1079      end = jj_consume_token(RPARAN);
1080    } catch (ParseException e) {
1081        addException(e);
1082        error_skipto(RPARAN);
1083        {if (true) return null;}
1084    }
1085        if (notNull(start, term, end)) {
1086            CSSNode node = new CSSNode('[' + term.getName() + ']');
1087            node.addChildren(term.getChildren());
1088            node.setStartLocation(getStartLocation(start));
1089            node.setEndLocation(getEndLocation(end));
1090            {if (true) return node;}
1091        }
1092        {if (true) return null;}
1093    throw new Error("Missing return statement in function");
1094  }
1095
1096  final public CSSNode definition() throws ParseException {
1097    Token start = null;
1098    CSSNode term = null;
1099    Token end = null;
1100    try {
1101      start = jj_consume_token(LBRACKET);
1102      label_33:
1103      while (true) {
1104        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1105        case S:
1106          ;
1107          break;
1108        default:
1109          jj_la1[40] = jj_gen;
1110          break label_33;
1111        }
1112        jj_consume_token(S);
1113      }
1114      term = term();
1115      end = jj_consume_token(RBRACKET);
1116    } catch (ParseException e) {
1117        addException(e);
1118        error_skipto(RBRACKET);
1119        {if (true) return null;}
1120    }
1121        if (notNull(start, term, end)) {
1122            CSSNode node = new CSSNode('[' + term.getName() + ']');
1123            node.addChildren(term.getChildren());
1124            node.setStartLocation(getStartLocation(start));
1125            node.setEndLocation(getEndLocation(end));
1126        }
1127    throw new Error("Missing return statement in function");
1128  }
1129
1130  final public CSSNode page() throws ParseException {
1131    CSSNode node = new CSSNode();
1132    CSSNode child = null;
1133    List<CSSNode> contents = null;
1134    Token start = null;
1135    Token i = null;
1136    Token end = null;
1137    try {
1138      start = jj_consume_token(PAGE_SYM);
1139                          if (start != null) node.setName(start.image);
1140      label_34:
1141      while (true) {
1142        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1143        case S:
1144          ;
1145          break;
1146        default:
1147          jj_la1[41] = jj_gen;
1148          break label_34;
1149        }
1150        jj_consume_token(S);
1151      }
1152      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1153      case IDENT:
1154        i = jj_consume_token(IDENT);
1155                       if (i != null) node.setName(node.getName() + ' ' + i.image);
1156        label_35:
1157        while (true) {
1158          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1159          case S:
1160            ;
1161            break;
1162          default:
1163            jj_la1[42] = jj_gen;
1164            break label_35;
1165          }
1166          jj_consume_token(S);
1167        }
1168        break;
1169      default:
1170        jj_la1[43] = jj_gen;
1171        ;
1172      }
1173      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1174      case COLON:
1175        child = pseudo_page();
1176                                 if (child != null) node.addChild(child);
1177        break;
1178      default:
1179        jj_la1[44] = jj_gen;
1180        ;
1181      }
1182      jj_consume_token(LBRACE);
1183      label_36:
1184      while (true) {
1185        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1186        case S:
1187          ;
1188          break;
1189        default:
1190          jj_la1[45] = jj_gen;
1191          break label_36;
1192        }
1193        jj_consume_token(S);
1194      }
1195      contents = pageContent();
1196                                    if (contents != null) node.addChildren(contents);
1197      end = jj_consume_token(RBRACE);
1198      label_37:
1199      while (true) {
1200        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1201        case S:
1202          ;
1203          break;
1204        default:
1205          jj_la1[46] = jj_gen;
1206          break label_37;
1207        }
1208        jj_consume_token(S);
1209      }
1210    } catch (ParseException e) {
1211        addException(e);
1212        error_skipto(RBRACE);
1213        {if (true) return null;}
1214    }
1215        if (notNull(start, end)) {
1216            node.setStartLocation(getStartLocation(start));
1217            node.setEndLocation(getEndLocation(end));
1218            {if (true) return node;}
1219        }
1220        {if (true) return null;}
1221    throw new Error("Missing return statement in function");
1222  }
1223
1224  final public List<CSSNode> pageContent() throws ParseException {
1225    CSSNode node = null;
1226    List<CSSNode> list = null;
1227    try {
1228      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1229      case ATTOP:
1230      case ATRIGHT:
1231      case ATBOTTOM:
1232      case ATLEFT:
1233        node = prefAtRule();
1234        break;
1235      default:
1236        jj_la1[47] = jj_gen;
1237        list = declarations();
1238      }
1239    } catch (ParseException e) {
1240        addException(e);
1241        error_skipto(RBRACE);
1242        {if (true) return null;}
1243    }
1244        if (node != null) {
1245            list = new ArrayList<CSSNode>();
1246            list.add(node);
1247            {if (true) return list;}
1248        }
1249        else if (list != null) {
1250            {if (true) return list;}
1251        }
1252        {if (true) return null;}
1253    throw new Error("Missing return statement in function");
1254  }
1255
1256  final public CSSNode prefAtRule() throws ParseException {
1257    Token start = null;
1258    List<CSSNode> decls = null;
1259    Token end = null;
1260    try {
1261      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1262      case ATTOP:
1263        start = jj_consume_token(ATTOP);
1264        break;
1265      case ATBOTTOM:
1266        start = jj_consume_token(ATBOTTOM);
1267        break;
1268      case ATLEFT:
1269        start = jj_consume_token(ATLEFT);
1270        break;
1271      case ATRIGHT:
1272        start = jj_consume_token(ATRIGHT);
1273        break;
1274      default:
1275        jj_la1[48] = jj_gen;
1276        jj_consume_token(-1);
1277        throw new ParseException();
1278      }
1279      label_38:
1280      while (true) {
1281        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1282        case S:
1283          ;
1284          break;
1285        default:
1286          jj_la1[49] = jj_gen;
1287          break label_38;
1288        }
1289        jj_consume_token(S);
1290      }
1291      jj_consume_token(LBRACE);
1292      label_39:
1293      while (true) {
1294        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1295        case S:
1296          ;
1297          break;
1298        default:
1299          jj_la1[50] = jj_gen;
1300          break label_39;
1301        }
1302        jj_consume_token(S);
1303      }
1304      decls = declarations();
1305      end = jj_consume_token(RBRACE);
1306      label_40:
1307      while (true) {
1308        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1309        case S:
1310          ;
1311          break;
1312        default:
1313          jj_la1[51] = jj_gen;
1314          break label_40;
1315        }
1316        jj_consume_token(S);
1317      }
1318    } catch (ParseException e) {
1319        addException(e);
1320        error_skipto(RBRACE);
1321        {if (true) return null;}
1322    }
1323        if (notNull(start, decls, end)) {
1324            CSSNode node = new CSSNode(start.image);
1325            node.addChildren(decls);
1326            node.setStartLocation(getStartLocation(start));
1327            node.setEndLocation(getEndLocation(end));
1328            {if (true) return node;}
1329        }
1330        {if (true) return null;}
1331    throw new Error("Missing return statement in function");
1332  }
1333
1334  final public CSSNode pseudo_page() throws ParseException {
1335    Token start = null;
1336    Token t = null;
1337    try {
1338      start = jj_consume_token(COLON);
1339      t = jj_consume_token(IDENT);
1340      label_41:
1341      while (true) {
1342        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1343        case S:
1344          ;
1345          break;
1346        default:
1347          jj_la1[52] = jj_gen;
1348          break label_41;
1349        }
1350        jj_consume_token(S);
1351      }
1352    } catch (ParseException e) {
1353        addException(e);
1354        {if (true) return null;}
1355    }
1356        if (notNull(t)) {
1357            CSSNode node = new CSSNode(':' + t.image);
1358            node.setStartLocation(getStartLocation(start));
1359            node.setEndLocation(getEndLocation(start));
1360            {if (true) return node;}
1361        }
1362        {if (true) return null;}
1363    throw new Error("Missing return statement in function");
1364  }
1365
1366  final public CSSNode fontFace() throws ParseException {
1367    Token start = null;
1368    List<CSSNode> decls = null;
1369    Token end = null;
1370    try {
1371      start = jj_consume_token(FONT_FACE_SYM);
1372      label_42:
1373      while (true) {
1374        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1375        case S:
1376          ;
1377          break;
1378        default:
1379          jj_la1[53] = jj_gen;
1380          break label_42;
1381        }
1382        jj_consume_token(S);
1383      }
1384      jj_consume_token(LBRACE);
1385      label_43:
1386      while (true) {
1387        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1388        case S:
1389          ;
1390          break;
1391        default:
1392          jj_la1[54] = jj_gen;
1393          break label_43;
1394        }
1395        jj_consume_token(S);
1396      }
1397      decls = declarations();
1398      end = jj_consume_token(RBRACE);
1399      label_44:
1400      while (true) {
1401        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1402        case S:
1403          ;
1404          break;
1405        default:
1406          jj_la1[55] = jj_gen;
1407          break label_44;
1408        }
1409        jj_consume_token(S);
1410      }
1411    } catch (ParseException e) {
1412        addException(e);
1413        error_skipto(RBRACE);
1414        {if (true) return null;}
1415    }
1416        if (notNull(start, decls, end)) {
1417            CSSNode node = new CSSNode(start.image);
1418            node.addChildren(decls);
1419            node.setStartLocation(getStartLocation(start));
1420            node.setEndLocation(getEndLocation(end));
1421            {if (true) return node;}
1422        }
1423        {if (true) return null;}
1424    throw new Error("Missing return statement in function");
1425  }
1426
1427  final public CSSNode colorprofile() throws ParseException {
1428    Token start = null;
1429    List<CSSNode> decls = null;
1430    Token end = null;
1431    try {
1432      start = jj_consume_token(COLOR_PROFILE);
1433      label_45:
1434      while (true) {
1435        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1436        case S:
1437          ;
1438          break;
1439        default:
1440          jj_la1[56] = jj_gen;
1441          break label_45;
1442        }
1443        jj_consume_token(S);
1444      }
1445      jj_consume_token(LBRACE);
1446      label_46:
1447      while (true) {
1448        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1449        case S:
1450          ;
1451          break;
1452        default:
1453          jj_la1[57] = jj_gen;
1454          break label_46;
1455        }
1456        jj_consume_token(S);
1457      }
1458      decls = declarations();
1459      end = jj_consume_token(RBRACE);
1460      label_47:
1461      while (true) {
1462        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1463        case S:
1464          ;
1465          break;
1466        default:
1467          jj_la1[58] = jj_gen;
1468          break label_47;
1469        }
1470        jj_consume_token(S);
1471      }
1472    } catch (ParseException e) {
1473        addException(e);
1474        error_skipto(RBRACE);
1475        {if (true) return null;}
1476    }
1477        if (notNull(start, decls, end)) {
1478            CSSNode node = new CSSNode(start.image);
1479            node.addChildren(decls);
1480            node.setStartLocation(getStartLocation(start));
1481            node.setEndLocation(getEndLocation(end));
1482            {if (true) return node;}
1483        }
1484        {if (true) return null;}
1485    throw new Error("Missing return statement in function");
1486  }
1487
1488  final public CSSNode preference() throws ParseException {
1489    Token start = null;
1490    List<CSSNode> decls = null;
1491    Token end = null;
1492    try {
1493      start = jj_consume_token(PREF_SYM);
1494      label_48:
1495      while (true) {
1496        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1497        case S:
1498          ;
1499          break;
1500        default:
1501          jj_la1[59] = jj_gen;
1502          break label_48;
1503        }
1504        jj_consume_token(S);
1505      }
1506      jj_consume_token(LBRACE);
1507      label_49:
1508      while (true) {
1509        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1510        case S:
1511          ;
1512          break;
1513        default:
1514          jj_la1[60] = jj_gen;
1515          break label_49;
1516        }
1517        jj_consume_token(S);
1518      }
1519      decls = declarations();
1520      end = jj_consume_token(RBRACE);
1521      label_50:
1522      while (true) {
1523        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1524        case S:
1525          ;
1526          break;
1527        default:
1528          jj_la1[61] = jj_gen;
1529          break label_50;
1530        }
1531        jj_consume_token(S);
1532      }
1533    } catch (ParseException e) {
1534        addException(e);
1535        error_skipto(RBRACE);
1536        {if (true) return null;}
1537    }
1538        if (notNull(start, decls, end)) {
1539            CSSNode node = new CSSNode(start.image);
1540            node.addChildren(decls);
1541            node.setStartLocation(getStartLocation(start));
1542            node.setEndLocation(getEndLocation(end));
1543            {if (true) return node;}
1544        }
1545        {if (true) return null;}
1546    throw new Error("Missing return statement in function");
1547  }
1548
1549  final public CSSNode phoneticAlphabet() throws ParseException {
1550    Token start = null;
1551    Token middle = null;
1552    Token end = null;
1553    try {
1554      start = jj_consume_token(PHONETIC_ALPHABET_SYM);
1555      label_51:
1556      while (true) {
1557        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1558        case S:
1559          ;
1560          break;
1561        default:
1562          jj_la1[62] = jj_gen;
1563          break label_51;
1564        }
1565        jj_consume_token(S);
1566      }
1567      middle = jj_consume_token(STRING);
1568      label_52:
1569      while (true) {
1570        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1571        case S:
1572          ;
1573          break;
1574        default:
1575          jj_la1[63] = jj_gen;
1576          break label_52;
1577        }
1578        jj_consume_token(S);
1579      }
1580      end = jj_consume_token(SEMICOLON);
1581    } catch (ParseException e) {
1582        addException(e);
1583        error_skipto(SEMICOLON);
1584        {if (true) return null;}
1585    }
1586        if (notNull(start, middle, end)) {
1587            StringBuilder name = new StringBuilder();
1588            name.append(start.image).append(' ').append(middle.image);
1589            CSSNode node = new CSSNode(name.toString());
1590            node.setStartLocation(getStartLocation(start));
1591            node.setEndLocation(getEndLocation(end));
1592            {if (true) return node;}
1593        }
1594        {if (true) return null;}
1595    throw new Error("Missing return statement in function");
1596  }
1597
1598  final public CSSNode atRuleDeclaration() throws ParseException {
1599    Token t = null;
1600    try {
1601      t = jj_consume_token(ATKEYWORD);
1602    } catch (ParseException e) {
1603        addException(e);
1604        error_skipto(RBRACE);
1605        {if (true) return null;}
1606    }
1607        if (notNull(t)) {
1608            {if (true) return createNode(t);}
1609        }
1610        {if (true) return null;}
1611    throw new Error("Missing return statement in function");
1612  }
1613
1614  final public char operator() throws ParseException {
1615    char op = ' ';
1616    try {
1617      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1618      case COMMA:
1619      case DIV:
1620        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1621        case DIV:
1622          jj_consume_token(DIV);
1623                    op = '/';
1624          break;
1625        case COMMA:
1626          jj_consume_token(COMMA);
1627                    op = ',';
1628          break;
1629        default:
1630          jj_la1[64] = jj_gen;
1631          jj_consume_token(-1);
1632          throw new ParseException();
1633        }
1634        label_53:
1635        while (true) {
1636          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1637          case S:
1638            ;
1639            break;
1640          default:
1641            jj_la1[65] = jj_gen;
1642            break label_53;
1643          }
1644          jj_consume_token(S);
1645        }
1646        break;
1647      default:
1648        jj_la1[66] = jj_gen;
1649        ;
1650      }
1651    } catch (ParseException e) {
1652        addException(e);
1653        error_skipto(RBRACE);
1654        {if (true) return op;}
1655    }
1656        {if (true) return op;}
1657    throw new Error("Missing return statement in function");
1658  }
1659
1660  final public char combinator() throws ParseException {
1661    char connector = ' ';
1662    try {
1663      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1664      case PLUS:
1665      case GREATER:
1666      case TILDE:
1667        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1668        case PLUS:
1669          jj_consume_token(PLUS);
1670                    connector = '+' ;
1671          break;
1672        case GREATER:
1673          jj_consume_token(GREATER);
1674                    connector = '>' ;
1675          break;
1676        case TILDE:
1677          jj_consume_token(TILDE);
1678                    connector = '~' ;
1679          break;
1680        default:
1681          jj_la1[67] = jj_gen;
1682          jj_consume_token(-1);
1683          throw new ParseException();
1684        }
1685        label_54:
1686        while (true) {
1687          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1688          case S:
1689            ;
1690            break;
1691          default:
1692            jj_la1[68] = jj_gen;
1693            break label_54;
1694          }
1695          jj_consume_token(S);
1696        }
1697        break;
1698      case S:
1699        label_55:
1700        while (true) {
1701          jj_consume_token(S);
1702          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1703          case S:
1704            ;
1705            break;
1706          default:
1707            jj_la1[69] = jj_gen;
1708            break label_55;
1709          }
1710        }
1711                connector = ' ' ;
1712        break;
1713      default:
1714        jj_la1[70] = jj_gen;
1715        jj_consume_token(-1);
1716        throw new ParseException();
1717      }
1718    } catch (ParseException e) {
1719        addException(e);
1720        error_skipto(RBRACE);
1721        {if (true) return connector;}
1722    }
1723        {if (true) return connector;}
1724    throw new Error("Missing return statement in function");
1725  }
1726
1727  final public char unaryOperator() throws ParseException {
1728    char unary;
1729    try {
1730      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1731      case MINUS:
1732        jj_consume_token(MINUS);
1733            unary = '-';
1734        break;
1735      case PLUS:
1736        jj_consume_token(PLUS);
1737            unary = '+';
1738        break;
1739      default:
1740        jj_la1[71] = jj_gen;
1741        jj_consume_token(-1);
1742        throw new ParseException();
1743      }
1744    } catch (ParseException e) {
1745        addException(e);
1746        error_skipto(RBRACE);
1747        {if (true) return ' ';}
1748    }
1749        {if (true) return unary;}
1750    throw new Error("Missing return statement in function");
1751  }
1752
1753  final public CSSNode property() throws ParseException {
1754    Token t = null;
1755    try {
1756      t = jj_consume_token(IDENT);
1757      label_56:
1758      while (true) {
1759        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1760        case S:
1761          ;
1762          break;
1763        default:
1764          jj_la1[72] = jj_gen;
1765          break label_56;
1766        }
1767        jj_consume_token(S);
1768      }
1769    } catch (ParseException e) {
1770        addException(e);
1771        error_skipto(RBRACE);
1772        {if (true) return null;}
1773    }
1774        if (notNull(t)) {
1775            if (isUnsupported(t.image)) {
1776                Range range = new Range( new Location( t.next.beginLine, t.next.beginColumn-1 ), new Location( t.next.endLine, t.next.endColumn ) );
1777                addWarning(new ParseError(t.image + " is not supported by most browsers.", range));
1778            }
1779            {if (true) return createNode(t);}
1780        }
1781        {if (true) return null;}
1782    throw new Error("Missing return statement in function");
1783  }
1784
1785  final public CSSNode ruleSet() throws ParseException {
1786    CSSNode sel = null;
1787    List<CSSNode> selectors = new ArrayList<CSSNode>();
1788    List<CSSNode> decls = null;
1789    Token end = null;
1790    try {
1791      sel = selector();
1792                        if (sel != null) selectors.add(sel);
1793      label_57:
1794      while (true) {
1795        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1796        case COMMA:
1797          ;
1798          break;
1799        default:
1800          jj_la1[73] = jj_gen;
1801          break label_57;
1802        }
1803        jj_consume_token(COMMA);
1804        label_58:
1805        while (true) {
1806          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1807          case S:
1808            ;
1809            break;
1810          default:
1811            jj_la1[74] = jj_gen;
1812            break label_58;
1813          }
1814          jj_consume_token(S);
1815        }
1816        sel = selector();
1817                            if (sel != null) selectors.add(sel);
1818      }
1819      jj_consume_token(LBRACE);
1820      label_59:
1821      while (true) {
1822        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1823        case S:
1824          ;
1825          break;
1826        default:
1827          jj_la1[75] = jj_gen;
1828          break label_59;
1829        }
1830        jj_consume_token(S);
1831      }
1832      decls = declarations();
1833      end = jj_consume_token(RBRACE);
1834      label_60:
1835      while (true) {
1836        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1837        case S:
1838          ;
1839          break;
1840        default:
1841          jj_la1[76] = jj_gen;
1842          break label_60;
1843        }
1844        jj_consume_token(S);
1845      }
1846    } catch (ParseException e) {
1847        addException(e);
1848        error_skipto(RBRACE);
1849        {if (true) return null;}
1850    }
1851        if (selectors.size() > 0 && notNull(decls, end)) {
1852            StringBuilder sb = new StringBuilder();
1853            for (CSSNode s : selectors) {
1854                sb.append(s.ge

Large files files are truncated, but you can click here to view the full file