当前位置: 首页>>代码示例>>Java>>正文


Java BlackHoleChannel类代码示例

本文整理汇总了Java中com.sonar.sslr.impl.channel.BlackHoleChannel的典型用法代码示例。如果您正苦于以下问题:Java BlackHoleChannel类的具体用法?Java BlackHoleChannel怎么用?Java BlackHoleChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BlackHoleChannel类属于com.sonar.sslr.impl.channel包,在下文中一共展示了BlackHoleChannel类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
/**
 * Creates a Lexer, contains all channels to analyze apex language.
 *
 * @param config apex configuration.
 * @return a lexer instance.
 */
public static Lexer create(ApexConfiguration config) {
    return Lexer.builder()
            .withCharset(config.getCharset())
            .withFailIfNoChannelToConsumeOneCharacter(Boolean.TRUE)
            .withChannel(commentRegexp(SINGLE_LINE_PATTERN))
            .withChannel(commentRegexp(MULTI_LINE_PATTERN))
            .withChannel(regexp(ApexTokenType.DECIMAL_FLOATING_POINT_LITERAL, DECIMAL_FLOATING_POINT_LITERAL_PATTERN))
            .withChannel(regexp(ApexTokenType.HEXADECIMAL_FLOATING_POINT_LITERAL, HEXADECIMAL_FLOATING_POINT_LITERAL_PATTERN))
            .withChannel(regexp(ApexTokenType.INTEGER_LITERAL, INTEGER_LITERAL_PATTERN))
            .withChannel(regexp(ApexTokenType.STRING, STRING_PATTERN))
            .withChannel(new IdentifierAndKeywordChannel(IDENTIFIER_PATTERN,
                    Boolean.FALSE, ApexKeyword.values()))
            .withChannel(new PunctuatorChannel(ApexPunctuator.values()))
            .withChannel(new BlackHoleChannel(BLACK_HOLE))
            .build();
}
 
开发者ID:fundacionjala,项目名称:enforce-sonarqube-plugin,代码行数:23,代码来源:ApexLexer.java

示例2: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
public static Lexer create(FlowConfiguration conf) {
  return Lexer.builder()
  	.withCharset(conf.getCharset())
      .withFailIfNoChannelToConsumeOneCharacter(true)
      .withChannel(new SaxChannel())
      .withChannel(new BlackHoleChannel(".*"))
      .build();
}
 
开发者ID:I8C,项目名称:sonar-flow-plugin,代码行数:9,代码来源:FlowLexer.java

示例3: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
public static Lexer create(PuppetConfiguration conf) {
  return Lexer.builder()
    .withCharset(conf.getCharset())
    .withFailIfNoChannelToConsumeOneCharacter(true)

    .withChannel(regexp(PuppetTokenType.BOM, "\uFEFF"))
    .withChannel(regexp(PuppetTokenType.HEX_INTEGER, "0(x|X)[0-9a-fA-F]+"))
    .withChannel(regexp(PuppetTokenType.OCTAL_INTEGER, "0[0-7]+"))
    .withChannel(regexp(PuppetTokenType.FLOAT, "-?(?=\\d+[.eE])(?=\\.?\\d)\\d*\\.?\\d*(?:[eE][+-]?\\d+)?"))
    .withChannel(regexp(PuppetTokenType.INTEGER, "[0-9][0-9]*"))

    .withChannel(new NameAndKeywordChannel("((::)?[a-z0-9][-\\w]*)(::[a-z0-9][-\\w]*)*", true, PuppetKeyword.values()))

    .withChannel(regexp(PuppetTokenType.REF, "(::)?[A-Z]\\w*(::[A-Z]\\w*)*"))
    .withChannel(regexp(PuppetTokenType.VARIABLE, "\\$(::)?(\\w+::)*\\w+"))

    // String Literals
    .withChannel(regexp(PuppetTokenType.SINGLE_QUOTED_STRING_LITERAL, SINGLE_QUOTED_LITERAL))
    .withChannel(regexp(PuppetTokenType.DOUBLE_QUOTED_STRING_LITERAL, DOUBLE_QUOTED_LITERAL))

    .withChannel(commentRegexp(COMMENT))

    // Lets play with matching regex!
    .withChannel(new PuppetRegexpChannel())

    .withChannel(new PunctuatorChannel(PuppetPunctuator.values()))
    .withChannel(new BlackHoleChannel("[ \t\r\n]+"))
    .build();
}
 
开发者ID:iwarapter,项目名称:sonar-puppet,代码行数:30,代码来源:PuppetLexer.java

示例4: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
public static Lexer create(LuaConfiguration conf) {
  return Lexer.builder()
    .withCharset(conf.getCharset())

    .withFailIfNoChannelToConsumeOneCharacter(true)

    .withChannel(new BomCharacterChannel())
    .withChannel(new BlackHoleChannel("\\s++"))

    // Comments
    .withChannel(commentRegexp("//[^\\n\\r]*+"))
    .withChannel(commentRegexp("/\\*[\\s\\S]*?\\*/"))

    // String Literals
    .withChannel(regexp(GenericTokenType.LITERAL, "\"([^\"\\\\]*+(\\\\[\\s\\S])?+)*+\""))
    .withChannel(regexp(GenericTokenType.LITERAL, "\'([^\'\\\\]*+(\\\\[\\s\\S])?+)*+\'"))

    // Regular Expression Literal
    .withChannel(new LuaRegularExpressionLiteralChannel())

    // Numbers
    .withChannel(regexp(LuaTokenType.NUMERIC_LITERAL, "0[xX][0-9a-fA-F]++"))
    .withChannel(regexp(LuaTokenType.NUMERIC_LITERAL, "[0-9]++\\.([0-9]++)?+" + EXP + "?+"))
    .withChannel(regexp(LuaTokenType.NUMERIC_LITERAL, "\\.[0-9]++" + EXP + "?+"))
    .withChannel(regexp(LuaTokenType.NUMERIC_LITERAL, "[0-9]++" + EXP + "?+"))

    .withChannel(new IdentifierAndKeywordChannel("\\p{javaJavaIdentifierStart}++\\p{javaJavaIdentifierPart}*+", true, LuaKeyword.values()))
    .withChannel(new PunctuatorChannel(LuaPunctuator.values()))

    .withChannel(new UnknownCharacterChannel())

    .build();
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-lua,代码行数:34,代码来源:LuaLexer.java

示例5: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
public static Lexer create(Charset charset) {
  return Lexer.builder()
    .withCharset(charset)

    .withFailIfNoChannelToConsumeOneCharacter(true)

    .withChannel(new BomCharacterChannel())
    .withChannel(new BlackHoleChannel("\\s++"))

    .withChannel(regexp(WebTokenType.DOCTYPE, "<!DOCTYPE.*>"))

    .withChannel(regexp(WebTokenType.TAG, "</?[:\\w]+>?"))
    .withChannel(regexp(WebTokenType.TAG, "/?>"))

    // JSP comment
    .withChannel(commentRegexp("<%--[\\w\\W]*?%>"))
    // HTML comment
    .withChannel(commentRegexp("<!--[\\w\\W]*?-->"))
    // C comment
    .withChannel(commentRegexp("/\\*[\\w\\W]*?\\*/"))
    // CPP comment
    .withChannel(commentRegexp("//[^\n\r]*"))

    .withChannel(regexp(WebTokenType.EXPRESSION, "<%[\\w\\W]*?%>"))

    .withChannel(regexp(WebTokenType.ATTRIBUTE, "=[\"']{1}[\\w\\W]*?[\"']{1}"))
    .withChannel(regexp(WebTokenType.ATTRIBUTE, "=[^\\s'\"=<>`]++"))

    .withChannel(new IdentifierAndKeywordChannel("\\w++", true, new TokenType[]{}))

    .withChannel(new UnknownCharacterChannel())

    .build();
}
 
开发者ID:SonarSource,项目名称:sonar-web,代码行数:35,代码来源:WebLexer.java

示例6: create

import com.sonar.sslr.impl.channel.BlackHoleChannel; //导入依赖的package包/类
public static Lexer create(PlSQLConfiguration conf) {
  return Lexer.builder()
      .withCharset(conf.getCharset())

      .withFailIfNoChannelToConsumeOneCharacter(true)

      // Channels, which consumes more frequently should come first.
      // Whitespace character occurs more frequently than any other, and thus come first:
      .withChannel(new BlackHoleChannel("[" + LINE_TERMINATOR + WHITESPACE + "]++"))

      // Comments
      .withChannel(commentRegexp(COMMENT))

      // String Literals
      .withChannel(regexp(GenericTokenType.LITERAL, LITERAL))

      // Regular Expression Literals
   //TODO: check if required   .withChannel(new PlSQLRegexpChannel())

      .withChannel(regexp(PlSQLTokenType.NUMERIC_LITERAL, NUMERIC_LITERAL))

      .withChannel(new IdentifierAndKeywordChannel(IDENTIFIER, false, PlSQLKeyword.values()))
      .withChannel(new PunctuatorChannel(PlSQLPunctuator.values()))

      .withChannel(new UnknownCharacterChannel(true))

      .build();
}
 
开发者ID:Ne0s,项目名称:sonar-plsql,代码行数:29,代码来源:PlSQLLexer.java


注:本文中的com.sonar.sslr.impl.channel.BlackHoleChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。