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

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

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

Grammar.getTokenDisplayNames介绍

[英]Gets an array of display names for tokens defined or imported by the grammar. The array index is the token type, and the value is the result of #getTokenDisplayName for the corresponding token type.
[中]获取语法定义或导入的标记的显示名称数组。数组索引是令牌类型,该值是对应令牌类型的#getTokenDisplayName的结果。

代码示例

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

public Recognizer(OutputModelFactory factory) {
  super(factory);
  Grammar g = factory.getGrammar();
  grammarFileName = new File(g.fileName).getName();
  grammarName = g.name;
  name = g.getRecognizerName();
  tokens = new LinkedHashMap<String,Integer>();
  for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
    Integer ttype = entry.getValue();
    if ( ttype>0 ) {
      tokens.put(entry.getKey(), ttype);
    }
  }
  ruleNames = g.rules.keySet();
  rules = g.rules.values();
  atn = new SerializedATN(factory, g.atn);
  if (g.getOptionString("superClass") != null) {
    superClass = new ActionText(null, g.getOptionString("superClass"));
  }
  else {
    superClass = null;
  }
  CodeGenerator gen = factory.getGenerator();
  tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), gen);
  literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), gen);
  symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), gen);
}

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

public Recognizer(OutputModelFactory factory) {
  super(factory);
  Grammar g = factory.getGrammar();
  grammarFileName = new File(g.fileName).getName();
  grammarName = g.name;
  name = g.getRecognizerName();
  tokens = new LinkedHashMap<String,Integer>();
  for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
    Integer ttype = entry.getValue();
    if ( ttype>0 ) {
      tokens.put(entry.getKey(), ttype);
    }
  }
  ruleNames = g.rules.keySet();
  rules = g.rules.values();
  atn = new SerializedATN(factory, g.atn);
  if (g.getOptionString("superClass") != null) {
    superClass = new ActionText(null, g.getOptionString("superClass"));
  }
  else {
    superClass = null;
  }
  CodeGenerator gen = factory.getGenerator();
  tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), gen);
  literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), gen);
  symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), gen);
}

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

public Recognizer(OutputModelFactory factory) {
  super(factory);
  Grammar g = factory.getGrammar();
  grammarFileName = new File(g.fileName).getName();
  grammarName = g.name;
  name = g.getRecognizerName();
  accessLevel = g.getOptionString("accessLevel");
  tokens = new LinkedHashMap<String,Integer>();
  for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
    Integer ttype = entry.getValue();
    if ( ttype>0 ) {
      tokens.put(entry.getKey(), ttype);
    }
  }
  ruleNames = g.rules.keySet();
  rules = g.rules.values();
  atn = new SerializedATN(factory, g.atn);
  if (g.getOptionString("superClass") != null) {
    superClass = new ActionText(null, g.getOptionString("superClass"));
  }
  else {
    superClass = null;
  }
  CodeGenerator gen = factory.getGenerator();
  tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), gen);
  literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), gen);
  symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), gen);
}

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

public Recognizer(OutputModelFactory factory) {
  super(factory);
  Grammar g = factory.getGrammar();
  grammarFileName = new File(g.fileName).getName();
  grammarName = g.name;
  name = g.getRecognizerName();
  accessLevel = g.getOptionString("accessLevel");
  tokens = new LinkedHashMap<String,Integer>();
  for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
    Integer ttype = entry.getValue();
    if ( ttype>0 ) {
      tokens.put(entry.getKey(), ttype);
    }
  }
  ruleNames = g.rules.keySet();
  rules = g.rules.values();
  atn = new SerializedATN(factory, g.atn);
  if (g.getOptionString("superClass") != null) {
    superClass = new ActionText(null, g.getOptionString("superClass"));
  }
  else {
    superClass = null;
  }
  CodeGenerator gen = factory.getGenerator();
  tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), gen);
  literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), gen);
  symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), gen);
}

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

public Recognizer(OutputModelFactory factory) {
  super(factory);
  Grammar g = factory.getGrammar();
  grammarFileName = new File(g.fileName).getName();
  grammarName = g.name;
  name = g.getRecognizerName();
  accessLevel = g.getOptionString("accessLevel");
  tokens = new LinkedHashMap<String,Integer>();
  for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
    Integer ttype = entry.getValue();
    if ( ttype>0 ) {
      tokens.put(entry.getKey(), ttype);
    }
  }
  ruleNames = g.rules.keySet();
  rules = g.rules.values();
  atn = new SerializedATN(factory, g.atn, Arrays.asList(g.getRuleNames()));
  if (g.getOptionString("superClass") != null) {
    superClass = new ActionText(null, g.getOptionString("superClass"));
  }
  else {
    superClass = null;
  }
  tokenNames = translateTokenStringsToTarget(g.getTokenDisplayNames(), factory);
  literalNames = translateTokenStringsToTarget(g.getTokenLiteralNames(), factory);
  symbolicNames = translateTokenStringsToTarget(g.getTokenSymbolicNames(), factory);
  abstractRecognizer = g.isAbstract();
}

相关文章