org.antlr.v4.tool.Grammar.getType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.antlr.v4.tool.Grammar.getType()方法的一些代码示例,展示了Grammar.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grammar.getType()方法的具体详情如下:
包路径:org.antlr.v4.tool.Grammar
类名称:Grammar
方法名:getType

Grammar.getType介绍

暂无

代码示例

代码示例来源:origin: org.antlr/antlr4

/** Given a grammar type, what should be the default action scope?
 *  If I say @members in a COMBINED grammar, for example, the
 *  default scope should be "parser".
 */
public String getDefaultActionScope() {
  switch ( getType() ) {
    case ANTLRParser.LEXER :
      return "lexer";
    case ANTLRParser.PARSER :
    case ANTLRParser.COMBINED :
      return "parser";
  }
  return null;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/** Given a grammar type, what should be the default action scope?
 *  If I say @members in a COMBINED grammar, for example, the
 *  default scope should be "parser".
 */
public String getDefaultActionScope() {
  switch ( getType() ) {
    case ANTLRParser.LEXER :
      return "lexer";
    case ANTLRParser.PARSER :
    case ANTLRParser.COMBINED :
      return "parser";
  }
  return null;
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

/** Given a grammar type, what should be the default action scope?
 *  If I say @members in a COMBINED grammar, for example, the
 *  default scope should be "parser".
 */
public String getDefaultActionScope() {
  switch ( getType() ) {
    case ANTLRParser.LEXER :
      return "lexer";
    case ANTLRParser.PARSER :
    case ANTLRParser.COMBINED :
      return "parser";
  }
  return null;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** Given a grammar type, what should be the default action scope?
 *  If I say @members in a COMBINED grammar, for example, the
 *  default scope should be "parser".
 */
public String getDefaultActionScope() {
  switch ( getType() ) {
    case ANTLRParser.LEXER :
      return "lexer";
    case ANTLRParser.PARSER :
    case ANTLRParser.COMBINED :
      return "parser";
  }
  return null;
}

代码示例来源:origin: org.antlr/antlr4

public boolean isLexer() { return getType()==ANTLRParser.LEXER; }
public boolean isParser() { return getType()==ANTLRParser.PARSER; }

代码示例来源:origin: org.antlr/antlr4

public boolean isParser() { return getType()==ANTLRParser.PARSER; }
public boolean isCombined() { return getType()==ANTLRParser.COMBINED; }

代码示例来源:origin: com.tunnelvisionlabs/antlr4

public boolean isParser() { return getType()==ANTLRParser.PARSER; }
public boolean isCombined() { return getType()==ANTLRParser.COMBINED; }

代码示例来源:origin: uk.co.nichesolutions/antlr4

public boolean isLexer() { return getType()==ANTLRParser.LEXER; }
public boolean isParser() { return getType()==ANTLRParser.PARSER; }

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public boolean isParser() { return getType()==ANTLRParser.PARSER; }
public boolean isCombined() { return getType()==ANTLRParser.COMBINED; }

代码示例来源:origin: org.antlr/antlr4

public String getTypeString() {
  if ( ast==null ) return null;
  return ANTLRParser.tokenNames[getType()].toLowerCase();
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

public String getTypeString() {
  if ( ast==null ) return null;
  return ANTLRParser.tokenNames[getType()].toLowerCase();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public String getTypeString() {
  if ( ast==null ) return null;
  return ANTLRParser.tokenNames[getType()].toLowerCase();
}

代码示例来源:origin: com.tunnelvisionlabs/antlr4

public String getTypeString() {
  if ( ast==null ) return null;
  return ANTLRParser.tokenNames[getType()].toLowerCase();
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public String getTypeString() {
  if ( ast==null ) return null;
  return ANTLRParser.tokenNames[getType()].toLowerCase();
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

boolean legalGrammarOption(String key) {
  switch ( g.getType() ) {
    case ANTLRParser.LEXER :
      return Grammar.lexerOptions.contains(key);
    case ANTLRParser.PARSER :
      return Grammar.parserOptions.contains(key);
    default :
      return Grammar.parserOptions.contains(key);
  }
}

代码示例来源:origin: org.antlr/antlr4

boolean legalGrammarOption(String key) {
  switch ( g.getType() ) {
    case ANTLRParser.LEXER :
      return Grammar.lexerOptions.contains(key);
    case ANTLRParser.PARSER :
      return Grammar.parserOptions.contains(key);
    default :
      return Grammar.parserOptions.contains(key);
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

boolean legalGrammarOption(String key) {
  switch ( g.getType() ) {
    case ANTLRParser.LEXER :
      return Grammar.lexerOptions.contains(key);
    case ANTLRParser.PARSER :
      return Grammar.parserOptions.contains(key);
    default :
      return Grammar.parserOptions.contains(key);
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

boolean legalGrammarOption(String key) {
  switch ( g.getType() ) {
    case ANTLRParser.LEXER :
      return Grammar.lexerOptions.contains(key);
    case ANTLRParser.PARSER :
      return Grammar.parserOptions.contains(key);
    default :
      return Grammar.parserOptions.contains(key);
  }
}

代码示例来源:origin: com.tunnelvisionlabs/antlr4

boolean legalGrammarOption(String key) {
  switch ( g.getType() ) {
    case ANTLRParser.LEXER :
      return Grammar.lexerOptions.contains(key);
    case ANTLRParser.PARSER :
      return Grammar.parserOptions.contains(key);
    default :
      return Grammar.parserOptions.contains(key);
  }
}

代码示例来源:origin: antlr/intellij-plugin-v4

public PreviewState getAssociatedParserIfLexer(String grammarFileName) {
    for (PreviewState s : grammarToPreviewState.values()) {
      if ( s!=null && s.lg!=null &&
         (grammarFileName.equals(s.lg.fileName)||s.lg==ParsingUtils.BAD_LEXER_GRAMMAR) )
      {
        // s has a lexer with same filename, see if there is a parser grammar
        // (not a combined grammar)
        if ( s.g!=null && s.g.getType()==ANTLRParser.PARSER ) {
//                    System.out.println(s.lg.fileName+" vs "+grammarFileName+", g="+s.g.name+", type="+s.g.getTypeString());
          return s;
        }
      }
    }
    return null;
  }

相关文章