Class CppTarget


  • public class CppTarget
    extends Target
    • Field Detail

      • cppKeywords

        protected static final String[] cppKeywords
      • badWords

        protected final Set<String> badWords
        Avoid grammar symbols in this set to prevent conflicts in gen'd code.
    • Method Detail

      • getVersion

        public String getVersion()
        Description copied from class: Target
        ANTLR tool should check output templates / target are compatible with tool code generation. For now, a simple string match used on x.y of x.y.z scheme. We use a method to avoid mismatches between a template called VERSION. This value is checked against Tool.VERSION during load of templates. This additional method forces all targets 4.3 and beyond to add this method.
        Specified by:
        getVersion in class Target
      • needsHeader

        public boolean needsHeader()
        Overrides:
        needsHeader in class Target
      • getBadWords

        public Set<String> getBadWords()
      • addBadWords

        protected void addBadWords()
      • getSerializedATNSegmentLimit

        public int getSerializedATNSegmentLimit()
        Description copied from class: Target
        Gets the maximum number of 16-bit unsigned integers that can be encoded in a single segment of the serialized ATN.
        Overrides:
        getSerializedATNSegmentLimit in class Target
        Returns:
        the serialized ATN segment limit
        See Also:
        SerializedATN.getSegments()
      • getRecognizerFileName

        public String getRecognizerFileName​(boolean header)
        Description copied from class: Target
        Generate TParser.java and TLexer.java from T.g4 if combined, else just use T.java as output regardless of type.
        Overrides:
        getRecognizerFileName in class Target
      • getListenerFileName

        public String getListenerFileName​(boolean header)
        Description copied from class: Target
        A given grammar T, return the listener name such as TListener.java, if we're using the Java target.
        Overrides:
        getListenerFileName in class Target
      • getVisitorFileName

        public String getVisitorFileName​(boolean header)
        Description copied from class: Target
        A given grammar T, return the visitor name such as TVisitor.java, if we're using the Java target.
        Overrides:
        getVisitorFileName in class Target
      • getBaseListenerFileName

        public String getBaseListenerFileName​(boolean header)
        Description copied from class: Target
        A given grammar T, return a blank listener implementation such as TBaseListener.java, if we're using the Java target.
        Overrides:
        getBaseListenerFileName in class Target
      • getBaseVisitorFileName

        public String getBaseVisitorFileName​(boolean header)
        Description copied from class: Target
        A given grammar T, return a blank listener implementation such as TBaseListener.java, if we're using the Java target.
        Overrides:
        getBaseVisitorFileName in class Target
      • loadTemplates

        protected org.stringtemplate.v4.STGroup loadTemplates()
        Overrides:
        loadTemplates in class Target
      • appendUnicodeEscapedCodePoint

        protected void appendUnicodeEscapedCodePoint​(int codePoint,
                                                     StringBuilder sb)
        Description copied from class: Target
        Escape the Unicode code point appropriately for this language and append the escaped value to sb.
        Specified by:
        appendUnicodeEscapedCodePoint in class Target