All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.phloc.css.parser.ParserCSSCharsetDetector Maven / Gradle / Ivy

There is a newer version: 3.7.7
Show newest version
/* ParserCSSCharsetDetector.java */
/* Generated By:JJTree&JavaCC: Do not edit this line. ParserCSSCharsetDetector.java */
package com.phloc.css.parser;

public class ParserCSSCharsetDetector/*@bgen(jjtree)*/implements ParserCSSCharsetDetectorTreeConstants, ParserCSSCharsetDetectorConstants {/*@bgen(jjtree)*/
  protected JJTParserCSSCharsetDetectorState jjtree = new JJTParserCSSCharsetDetectorState();

  final public CSSNode styleSheetCharset() throws ParseException {/*@bgen(jjtree) Root */
  com.phloc.css.parser.CSSNode jjtn000 = new com.phloc.css.parser.CSSNode(JJTROOT);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      try {
        label_1:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case S:
          case CDO:
          case CDC:{
            ;
            break;
            }
          default:
            jj_la1[0] = jj_gen;
            break label_1;
          }
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case S:{
            jj_consume_token(S);
            break;
            }
          case CDO:{
            jj_consume_token(CDO);
            break;
            }
          case CDC:{
            jj_consume_token(CDC);
            break;
            }
          default:
            jj_la1[1] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
          }
        }
        jj_consume_token(CHARSET_SYM);
        label_2:
        while (true) {
          jj_consume_token(S);
          switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
          case S:{
            ;
            break;
            }
          default:
            jj_la1[2] = jj_gen;
            break label_2;
          }
        }
        switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
        case STRING1:{
          jj_consume_token(STRING1);
jjtn000.setText (token.image);
          break;
          }
        case STRING2:{
          jj_consume_token(STRING2);
jjtn000.setText (token.image);
          break;
          }
        default:
          jj_la1[3] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        jj_consume_token(SEMICOLON);
      } catch (ParseException e) {

      }
jjtree.closeNodeScope(jjtn000, true);
    jjtc000 = false;
{if ("" != null) return jjtn000;}
    } finally {
if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
    throw new Error("Missing return statement in function");
  }

  /** Generated Token Manager. */
  public ParserCSSCharsetDetectorTokenManager token_source;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private int jj_gen;
  final private int[] jj_la1 = new int[4];
  static private int[] jj_la1_0;
  static {
      jj_la1_init_0();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {0xc002,0xc002,0x2,0x3000,};
   }

  /** Constructor with user supplied CharStream. */
  public ParserCSSCharsetDetector(CharStream stream) {
    token_source = new ParserCSSCharsetDetectorTokenManager(stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 4; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(CharStream stream) {
    token_source.ReInit(stream);
    token = new Token();
    jj_ntk = -1;
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 4; i++) jj_la1[i] = -1;
  }

  /** Constructor with generated Token Manager. */
  public ParserCSSCharsetDetector(ParserCSSCharsetDetectorTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 4; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(ParserCSSCharsetDetectorTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 4; i++) jj_la1[i] = -1;
  }

  private Token jj_consume_token(int kind) throws ParseException {
    Token oldToken;
    if ((oldToken = token).next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    if (token.kind == kind) {
      jj_gen++;
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }


/** Get the next Token. */
  final public Token getNextToken() {
    if (token.next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    jj_gen++;
    return token;
  }

/** Get the specific Token. */
  final public Token getToken(int index) {
    Token t = token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  private int jj_ntk_f() {
    if ((jj_nt=token.next) == null)
      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
    else
      return (jj_ntk = jj_nt.kind);
  }

  private java.util.List jj_expentries = new java.util.ArrayList();
  private int[] jj_expentry;
  private int jj_kind = -1;

  /** Generate ParseException. */
  public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[18];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 4; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<




© 2015 - 2024 Weber Informatics LLC | Privacy Policy