當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamTokenizer.slashSlashComments方法代碼示例

本文整理匯總了Java中java.io.StreamTokenizer.slashSlashComments方法的典型用法代碼示例。如果您正苦於以下問題:Java StreamTokenizer.slashSlashComments方法的具體用法?Java StreamTokenizer.slashSlashComments怎麽用?Java StreamTokenizer.slashSlashComments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.StreamTokenizer的用法示例。


在下文中一共展示了StreamTokenizer.slashSlashComments方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: JaasConfig

import java.io.StreamTokenizer; //導入方法依賴的package包/類
public JaasConfig(String loginContextName, String jaasConfigParams) {
    StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(jaasConfigParams));
    tokenizer.slashSlashComments(true);
    tokenizer.slashStarComments(true);
    tokenizer.wordChars('-', '-');
    tokenizer.wordChars('_', '_');
    tokenizer.wordChars('$', '$');

    try {
        configEntries = new ArrayList<>();
        while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) {
            configEntries.add(parseAppConfigurationEntry(tokenizer));
        }
        if (configEntries.isEmpty())
            throw new IllegalArgumentException("Login module not specified in JAAS config");

        this.loginContextName = loginContextName;

    } catch (IOException e) {
        throw new KafkaException("Unexpected exception while parsing JAAS config");
    }
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:23,代碼來源:JaasConfig.java

示例2: parse

import java.io.StreamTokenizer; //導入方法依賴的package包/類
private Void parse(Reader reader) throws ParseException, IOException
{
    StreamTokenizer st = new StreamTokenizer(reader);
    st.eolIsSignificant(true);
    st.wordChars((int) '_', (int) '_');
    st.parseNumbers();
    st.quoteChar((int) '"');
    // These calls caused comments to be discarded
    st.slashSlashComments(true);
    st.slashStarComments(true);

    // Parse the file
    ParserState currentState = this.getBeginningOfLineState();
    while (currentState != null)
    {
        currentState = currentState.parse(st);
    }
    return null;
}
 
開發者ID:goldmansachs,項目名稱:tablasco,代碼行數:20,代碼來源:ExpectedResultsParser.java

示例3: readConfig

import java.io.StreamTokenizer; //導入方法依賴的package包/類
private void readConfig(Reader reader, HashMap newConfig)
		throws IOException {

	if (!(reader instanceof BufferedReader))
		reader = new BufferedReader(reader);

	st = new StreamTokenizer(reader);
	st.quoteChar('"');
	st.wordChars('$', '$');
	st.wordChars('_', '_');
	st.wordChars('-', '-');
	st.lowerCaseMode(false);
	st.slashSlashComments(true);
	st.slashStarComments(true);
	st.eolIsSignificant(true);

	lookahead = nextToken();
	while (lookahead != StreamTokenizer.TT_EOF) {
		parseLoginEntry(newConfig);
	}
}
 
開發者ID:GovernIB,項目名稱:sistra,代碼行數:22,代碼來源:ConfigurationLogin.java

示例4: setSyntax

import java.io.StreamTokenizer; //導入方法依賴的package包/類
/**
 * This method sets the syntax of the StreamTokenizer. i.e. set the
 * whitespace, comment and delimit chars.
 * 
 */
protected void setSyntax(StreamTokenizer tk) {
  tk.resetSyntax();
  tk.eolIsSignificant(false);
  tk.slashStarComments(true);
  tk.slashSlashComments(true);
  tk.whitespaceChars(0, ' ');
  tk.wordChars(' ' + 1, '\u00ff');
  tk.ordinaryChar('[');
  tk.ordinaryChar(']');
  tk.ordinaryChar('{');
  tk.ordinaryChar('}');
  tk.ordinaryChar('-');
  tk.ordinaryChar('>');
  tk.ordinaryChar('/');
  tk.ordinaryChar('*');
  tk.quoteChar('"');
  tk.whitespaceChars(';', ';');
  tk.ordinaryChar('=');
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:25,代碼來源:DotParser.java

示例5: SimpleCalcStreamTok

import java.io.StreamTokenizer; //導入方法依賴的package包/類
/** Construct from an existing Reader */
public SimpleCalcStreamTok(Reader rdr) throws IOException {
    tf = new StreamTokenizer(rdr);
    // Control the input character set:
    tf.slashSlashComments(true);    // treat "//" as comments
    tf.ordinaryChar('-');        // used for subtraction
    tf.ordinaryChar('/');    // used for division

    s = new Stack();
}
 
開發者ID:shashanksingh28,項目名稱:code-similarity,代碼行數:11,代碼來源:SimpleCalcStreamTok.java

示例6: normalize

import java.io.StreamTokenizer; //導入方法依賴的package包/類
public static String normalize(String sql, boolean removeComments) {
	if (removeComments)
		sql = sql.replace("--", "//");
	StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(sql));
	tokenizer.resetSyntax();
	tokenizer.wordChars('A', 'Z');
	tokenizer.wordChars('a', 'z');
	tokenizer.wordChars('0', '9');
	tokenizer.wordChars('_', '_');
	tokenizer.whitespaceChars(' ', ' ');
	tokenizer.whitespaceChars('\n', '\n');
	tokenizer.whitespaceChars('\r', '\r');
	tokenizer.whitespaceChars('\t', '\t');
	tokenizer.quoteChar('\'');
	tokenizer.quoteChar('"');
	if (removeComments) {
		tokenizer.slashStarComments(true);
		tokenizer.slashSlashComments(true);
	}
	StringBuilder builder = new StringBuilder();
	int lastTtype = StreamTokenizer.TT_EOF;
	try {
		while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) {
			int ttype = tokenizer.ttype;
			if (builder.length() > 0 // insert space if this is not the beginning of the string 
					&& ttype != ')' && ttype != ',' && lastTtype != '(' // no space for brackets and lists
					&& lastTtype != '.' && ttype != '.' // no space around '.' 
					&& !(lastTtype == '/' && ttype =='*') // preserve /* if it has not been filtered out 
					&& !(lastTtype == '-' && ttype =='-') // preserve -- if it has not been filtered out
					&& !(lastTtype == '*' && ttype =='/')) // preserve */ if it has not been filtered out
				builder.append(' ');
			switch (ttype) {
				case StreamTokenizer.TT_WORD: builder.append(tokenizer.sval); break;
				case StreamTokenizer.TT_NUMBER: builder.append(renderNumber(tokenizer)); break;
				case '"': builder.append('"').append(tokenizer.sval).append('"'); break;
				case '\'': builder.append('\'').append(tokenizer.sval).append('\''); break;
				default: builder.append((char) ttype);
			}				
			lastTtype = ttype;
		}
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
	return builder.toString();
}
 
開發者ID:aravindc,項目名稱:jdbacl,代碼行數:46,代碼來源:SQLUtil.java

示例7: configureTokenizer

import java.io.StreamTokenizer; //導入方法依賴的package包/類
private static void configureTokenizer(StreamTokenizer tokenizer) {
    tokenizer.wordChars('_', '_');
    tokenizer.slashSlashComments(true);
    tokenizer.slashStarComments(true);
}
 
開發者ID:Netflix,項目名稱:hollow,代碼行數:6,代碼來源:HollowSchemaParser.java


注:本文中的java.io.StreamTokenizer.slashSlashComments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。