Modify the method of ANTLR error message output format

xiaoxiao2021-03-06  134

turn up

/antlr/defaultfilelineformatter.java, modify the function getFormatString () of class defaultfilelineformatter. I will modify it below to adapt to the VC's error message output format:

Package ANTLR;

/ * ANTLR TRANSLATOR? * Project LED by Terence Parr at http://www.jguru.com?jguru.com: http://www.antlr.org/license.html?*?* $ ID: // Depot / code/org.antlr/release/antlr-2.7.4/antlr/defaultfilelineformatter.java#1 $? * /

// gcb 2004-8-13: change the error report string's format to compatiale with MS vcpublic class DefaultFileLineFormatter extends FileLineFormatter {??? public String getFormatString (String fileName, int line, int column) {??????? StringBuffer BUF = New stringbuffer ();

??????? f (filename! = null) ??????????? buf.append (filename "("); // ":");

??????? f (line! = -1) {??????????? IF (filename == null) ??????????????? BUF .append ("line (");

??????????? buf.append (line); ?????????????? buf.Append (")");

??????????? IF (column! = -1) ??????????????? buf.append (":" column);

??????????? buf.append (":"); ???????}

??????? buf.append ("");

??????? return buf.tostring (); ???}}

转载请注明原文地址:https://www.9cbs.com/read-127483.html

New Post(0)