// Path: src/main/java/org/idpf/epubcheck/util/css/CssExceptions.java
// public enum CssErrorCode
// {
//   SCANNER_ILLEGAL_SYNTAX(SCANNER_TOKEN_SYNTAX),         //a general error code, below refines
//   SCANNER_ILLEGAL_CHAR(SCANNER_TOKEN_SYNTAX + ".char"),
//   SCANNER_ILLEGAL_FIRSTCHAR(SCANNER_TOKEN_SYNTAX + ".firstChar"),
//   SCANNER_MALFORMED_ESCAPE(SCANNER_TOKEN_SYNTAX + ".escape"),
//   SCANNER_ILLEGAL_URANGE(SCANNER_TOKEN_SYNTAX + ".urange"),
//   SCANNER_PREMATURE_EOF(SCANNER + ".prematureEOF"),
// 
//   GRAMMAR_PREMATURE_EOF(GRAMMAR + ".prematureEOF"),
//   GRAMMAR_UNEXPECTED_TOKEN(GRAMMAR_TOKEN + ".unexpected"),
//   GRAMMAR_EXPECTING_TOKEN(GRAMMAR_TOKEN + ".expecting"),
//   GRAMMAR_INVALID_SELECTOR(GRAMMAR + ".invalidSelector"),;
// 
//   final String value;
// 
//   CssErrorCode(String value)
//   {
//     this.value = value;
//   }
// 
//   @Override
//   public String toString()
//   {
//     return MoreObjects.toStringHelper(this.getClass()).addValue(value).toString();
//   }
// 
// }
// 
// Path: src/main/java/org/idpf/epubcheck/util/css/CssExceptions.java
// public static abstract class CssException extends Exception
// {
//   final CssErrorCode errorCode;
//   final CssLocation location;
//   final Optional<CssToken> token;
// 
//   CssException(final CssToken token, final CssErrorCode errorCode, final CssLocation location,
//       final Locale locale, final Object... arguments)
//   {
//     super(Messages.getInstance(locale, CssExceptions.class).get(errorCode.value, arguments));
//     this.errorCode = checkNotNull(errorCode);
//     this.location = checkNotNull(location);
//     this.token = token == null ? absent : Optional.of(token);
//   }
// 
//   CssException(final CssErrorCode errorCode, final CssLocation location, final Locale locale,
//       final Object... arguments)
//   {
//     this(null, errorCode, location, locale, arguments);
//   }
// 
//   public CssErrorCode getErrorCode()
//   {
//     return errorCode;
//   }
// 
//   public CssLocation getLocation()
//   {
//     return location;
//   }
// 
//   @Override
//   public String toString()
//   {
//     return MoreObjects.toStringHelper(this.getClass()).add("errorCode", errorCode)
//         .add("location", location.toString()).toString();
//   }
// 
//   @Override
//   public boolean equals(Object obj)
//   {
//     if (obj instanceof CssException)
//     {
//       CssException exc = (CssException) obj;
//       if (exc.errorCode.equals(this.errorCode) && exc.location.equals(this.location))
//       {
//         return true;
//       }
//     }
//     return false;
//   }
// 
//   private static final long serialVersionUID = -4635263495562931206L;
// }


import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.primitives.Ints;
import org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode;
import org.idpf.epubcheck.util.css.CssExceptions.CssException;
import org.idpf.epubcheck.util.css.CssReader.Mark;
import org.idpf.epubcheck.util.css.CssToken.CssTokenConsumer;
import org.idpf.epubcheck.util.css.CssToken.TokenBuilder;
import org.idpf.epubcheck.util.css.CssToken.Type;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.google.common.base.Preconditions.*;
import static org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode.SCANNER_ILLEGAL_CHAR;
import static org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode.SCANNER_PREMATURE_EOF;
  {
    if (debug)
    {
      checkState('@' == reader.curChar);
    }

    builder.type = Type.ATKEYWORD;
    builder.append(cur); // @
    append(NMSTART);
    append(NMCHAR);

    if (debug)
    {
      int nxt = reader.peek();
      checkState(NMCHAR.matches((char) reader.curChar));
      if (nxt > -1)
      {
        checkState(!NMCHAR.matches((char) nxt));
      }
    }
  }

  /**
   * IDENT ([-]?{nmstart}|[--]){nmchar}*
   */
  private void _ident() throws
      IOException,
      CssException
  {

// Path: src/main/java/org/idpf/epubcheck/util/css/CssExceptions.java
// public enum CssErrorCode
// {
//   SCANNER_ILLEGAL_SYNTAX(SCANNER_TOKEN_SYNTAX),         //a general error code, below refines
//   SCANNER_ILLEGAL_CHAR(SCANNER_TOKEN_SYNTAX + ".char"),
//   SCANNER_ILLEGAL_FIRSTCHAR(SCANNER_TOKEN_SYNTAX + ".firstChar"),
//   SCANNER_MALFORMED_ESCAPE(SCANNER_TOKEN_SYNTAX + ".escape"),
//   SCANNER_ILLEGAL_URANGE(SCANNER_TOKEN_SYNTAX + ".urange"),
//   SCANNER_PREMATURE_EOF(SCANNER + ".prematureEOF"),
// 
//   GRAMMAR_PREMATURE_EOF(GRAMMAR + ".prematureEOF"),
//   GRAMMAR_UNEXPECTED_TOKEN(GRAMMAR_TOKEN + ".unexpected"),
//   GRAMMAR_EXPECTING_TOKEN(GRAMMAR_TOKEN + ".expecting"),
//   GRAMMAR_INVALID_SELECTOR(GRAMMAR + ".invalidSelector"),;
// 
//   final String value;
// 
//   CssErrorCode(String value)
//   {
//     this.value = value;
//   }
// 
//   @Override
//   public String toString()
//   {
//     return MoreObjects.toStringHelper(this.getClass()).addValue(value).toString();
//   }
// 
// }
// 
// Path: src/main/java/org/idpf/epubcheck/util/css/CssExceptions.java
// public static abstract class CssException extends Exception
// {
//   final CssErrorCode errorCode;
//   final CssLocation location;
//   final Optional<CssToken> token;
// 
//   CssException(final CssToken token, final CssErrorCode errorCode, final CssLocation location,
//       final Locale locale, final Object... arguments)
//   {
//     super(Messages.getInstance(locale, CssExceptions.class).get(errorCode.value, arguments));
//     this.errorCode = checkNotNull(errorCode);
//     this.location = checkNotNull(location);
//     this.token = token == null ? absent : Optional.of(token);
//   }
// 
//   CssException(final CssErrorCode errorCode, final CssLocation location, final Locale locale,
//       final Object... arguments)
//   {
//     this(null, errorCode, location, locale, arguments);
//   }
// 
//   public CssErrorCode getErrorCode()
//   {
//     return errorCode;
//   }
// 
//   public CssLocation getLocation()
//   {
//     return location;
//   }
// 
//   @Override
//   public String toString()
//   {
//     return MoreObjects.toStringHelper(this.getClass()).add("errorCode", errorCode)
//         .add("location", location.toString()).toString();
//   }
// 
//   @Override
//   public boolean equals(Object obj)
//   {
//     if (obj instanceof CssException)
//     {
//       CssException exc = (CssException) obj;
//       if (exc.errorCode.equals(this.errorCode) && exc.location.equals(this.location))
//       {
//         return true;
//       }
//     }
//     return false;
//   }
// 
//   private static final long serialVersionUID = -4635263495562931206L;
// }


// Path: src/main/java/org/idpf/epubcheck/util/css/CssScanner.java
import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.primitives.Ints;
import org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode;
import org.idpf.epubcheck.util.css.CssExceptions.CssException;
import org.idpf.epubcheck.util.css.CssReader.Mark;
import org.idpf.epubcheck.util.css.CssToken.CssTokenConsumer;
import org.idpf.epubcheck.util.css.CssToken.TokenBuilder;
import org.idpf.epubcheck.util.css.CssToken.Type;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.google.common.base.Preconditions.*;
import static org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode.SCANNER_ILLEGAL_CHAR;
import static org.idpf.epubcheck.util.css.CssExceptions.CssErrorCode.SCANNER_PREMATURE_EOF;

  {
    if (debug)
    {
      checkState('@' == reader.curChar);
    }

    builder.type = Type.ATKEYWORD;
    builder.append(cur); // @
    append(NMSTART);
    append(NMCHAR);

    if (debug)
    {
      int nxt = reader.peek();
      checkState(NMCHAR.matches((char) reader.curChar));
      if (nxt > -1)
      {
        checkState(!NMCHAR.matches((char) nxt));
      }
    }
  }

  /**
   * IDENT ([-]?{nmstart}|[--]){nmchar}*
   */
  private void _ident() throws
      IOException,
      CssException
  {

    builder.type = Type.IDENT;