/*
 * Copyright 2015, The Querydsl Team (http://www.querydsl.com/team)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.querydsl.sql;

import static com.google.common.collect.ImmutableSet.copyOf;

import java.io.IOException;
import java.util.Set;

import com.google.common.base.Charsets;
import com.google.common.io.Resources;

/**
 * Defines reserved keywords for the supported dialects
 */
final class Keywords {

    private Keywords() { }

    private static Set<String> readLines(String path) {
        try {
            return copyOf(Resources.readLines(
                    Keywords.class.getResource("/keywords/" + path), Charsets.UTF_8));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static final Set<String> DEFAULT = readLines("default");

    public static final Set<String> CUBRID = readLines("cubrid");
    public static final Set<String> DB2 = readLines("db2");
    public static final Set<String> DERBY = readLines("derby");
    public static final Set<String> FIREBIRD = readLines("firebird");
    public static final Set<String> H2 = readLines("h2");
    public static final Set<String> HSQLDB = readLines("hsqldb");
    public static final Set<String> MYSQL = readLines("mysql");
    public static final Set<String> ORACLE = readLines("oracle");
    public static final Set<String> POSTGRESQL = readLines("postgresql");
    public static final Set<String> SQLITE = readLines("sqlite");
    public static final Set<String> SQLSERVER2005 = readLines("sqlserver2005");
    public static final Set<String> SQLSERVER2008 = readLines("sqlserver2008");
    public static final Set<String> SQLSERVER2012 = readLines("sqlserver2012");
}

@@ -733,16 +733,45 @@
 eption;%0A
+import java.util.Collection;%0A
 import j
@@ -784,16 +784,16 @@
 il.Set;%0A
-
 %0Aimport 
@@ -825,16 +825,98 @@
 arsets;%0A
+import com.google.common.collect.Sets;%0Aimport com.google.common.io.LineProcessor;%0A
 import c
@@ -1263,16 +1263,74 @@
 ts.UTF_8
+,%0A                    new CommentDiscardingLineProcessor()
 ));%0A    
@@ -2298,24 +2298,24 @@
 rver2008%22);%0A
-
     public s
@@ -2381,11 +2381,527 @@
 r2012%22);
+%0A%0A    private static class CommentDiscardingLineProcessor implements LineProcessor%3CCollection%3CString%3E%3E %7B%0A%0A        private final Collection%3CString%3E result = Sets.newHashSet();%0A%0A        @Override%0A        public boolean processLine(String line) throws IOException %7B%0A            if (!line.isEmpty() && !line.startsWith(%22#%22)) %7B%0A                result.add(line);%0A            %7D%0A            return true;%0A        %7D%0A%0A        @Override%0A        public Collection%3CString%3E getResult() %7B%0A            return result;%0A        %7D%0A%0A    %7D
 %0A%7D%0A

Add support for comments in keyword files