1256N/A/*
1256N/A * CDDL HEADER START
1256N/A *
1256N/A * The contents of this file are subject to the terms of the
1256N/A * Common Development and Distribution License (the "License").
1256N/A * You may not use this file except in compliance with the License.
1256N/A *
1256N/A * See LICENSE.txt included in this distribution for the specific
1256N/A * language governing permissions and limitations under the License.
1256N/A *
1256N/A * When distributing Covered Code, include this CDDL HEADER in each
1256N/A * file and include the License file at LICENSE.txt.
1256N/A * If applicable, add the following below this CDDL HEADER, with the
1256N/A * fields enclosed by brackets "[]" replaced with your own identifying
1256N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1256N/A *
1256N/A * CDDL HEADER END
1256N/A */
1256N/A
1256N/A/*
1256N/A * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
1256N/A */
1256N/Apackage org.opensolaris.opengrok.analysis.vb;
1256N/A
1256N/Aimport java.io.BufferedReader;
1256N/Aimport java.io.IOException;
1256N/Aimport java.io.InputStreamReader;
1256N/Aimport java.util.Collections;
1256N/Aimport java.util.HashSet;
1256N/Aimport java.util.Locale;
1256N/Aimport java.util.Set;
1256N/A
1256N/A@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
1256N/Apublic final class Consts {
1256N/A
1256N/A private static final Set<String> reservedKeywords;
1256N/A
1256N/A static {
1256N/A HashSet<String> kwds = new HashSet<String>();
1256N/A try {
1256N/A
1256N/A populateKeywordSet(kwds, "vbReservedWords.dat");
1256N/A } catch (IOException ioe) {
1256N/A throw new RuntimeException(ioe);
1256N/A }
1256N/A reservedKeywords = Collections.unmodifiableSet(kwds);
1256N/A }
1256N/A
1256N/A private Consts() {
1256N/A // Util class, can not be constructed.
1256N/A }
1256N/A
1256N/A private static void populateKeywordSet(Set<String> set, String file)
1256N/A throws IOException {
1256N/A String line, lline;
1256N/A BufferedReader reader =
1256N/A new BufferedReader(new InputStreamReader(
1256N/A Consts.class.getResourceAsStream(file), "US-ASCII"));
1256N/A try {
1256N/A while ((line = reader.readLine()) != null) {
1256N/A line = line.trim();
1256N/A lline = line.toLowerCase(Locale.US);
1256N/A if (line.charAt(0) != '#') {
1256N/A set.add(line);
1256N/A set.add(lline);
1256N/A }
1256N/A }
1256N/A } finally {
1256N/A reader.close();
1256N/A }
1256N/A }
1256N/A
1256N/A static Set<String> getReservedKeywords() {
1256N/A return reservedKeywords;
1256N/A }
1256N/A}