当前位置: 首页>>代码示例>>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;未经允许,请勿转载。