當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorType類代碼示例

本文整理匯總了Java中org.stringtemplate.v4.misc.ErrorType的典型用法代碼示例。如果您正苦於以下問題:Java ErrorType類的具體用法?Java ErrorType怎麽用?Java ErrorType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ErrorType類屬於org.stringtemplate.v4.misc包,在下文中一共展示了ErrorType類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: defineRegion

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public CompiledST defineRegion(String enclosingTemplateName, Token regionT, String template, Token templateToken) {
    String name = regionT.getText();
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    CompiledST code = compile(getFileName(), enclosingTemplateName, null, template, templateToken);
    String mangled = getMangledRegionName(enclosingTemplateName, name);
    if ( lookupTemplate(mangled)==null ) {
        errMgr.compileTimeError(ErrorType.NO_SUCH_REGION,
                                templateToken,
                                regionT,
                                enclosingTemplateName,
                                name);
        return new CompiledST();
    }
    code.name = mangled;
    code.isRegion = true;
    code.regionDefType = ST.RegionType.EXPLICIT;
    code.templateDefStartToken = regionT;
    rawDefineTemplate(mangled, code, regionT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this);
    return code;
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:24,代碼來源:STGroup.java

示例2: rawDefineTemplate

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public void rawDefineTemplate(String name, CompiledST code, Token defT) {
    CompiledST prev = rawGetTemplate(name);
    if ( prev!=null ) {
        if ( !prev.isRegion ) {
            errMgr.compileTimeError(ErrorType.TEMPLATE_REDEFINITION, null, defT);
            return;
        }
        else {
            if ( code.regionDefType!= ST.RegionType.IMPLICIT && prev.regionDefType==ST.RegionType.EMBEDDED ) {
                errMgr.compileTimeError(ErrorType.EMBEDDED_REGION_REDEFINITION, null, defT, getUnMangledTemplateName(name));
                return;
            }
            else if ( code.regionDefType==ST.RegionType.IMPLICIT || prev.regionDefType==ST.RegionType.EXPLICIT ) {
                     errMgr.compileTimeError(ErrorType.REGION_REDEFINITION,
                                             null,
                                             defT,
                                             getUnMangledTemplateName(name));
                     return;
            }
        }
    }
    code.nativeGroup = this;
    code.templateDefStartToken = defT;
    templates.put(name, code);
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:26,代碼來源:STGroup.java

示例3: loadTemplateFile

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
/** Load template stream into this group. {@code unqualifiedFileName} is
 *  {@code "a.st"}. The {@code prefix} is path from group root to
 *  {@code unqualifiedFileName} like {@code "/subdir"} if file is in
 *  {@code /subdir/a.st}.
 */

public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
    GroupLexer lexer = new GroupLexer(templateStream);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    GroupParser parser = new GroupParser(tokens);
    parser.group = this;
    lexer.group = this;
    try {
        parser.templateDef(prefix);
    }
    catch (RecognitionException re) {
        errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
    }

    String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
    if ( prefix!=null && prefix.length()>0 ) templateName = prefix+templateName;
    CompiledST impl = rawGetTemplate(templateName);
    impl.prefix = prefix;
    return impl;
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:26,代碼來源:STGroup.java

示例4: getRootDirURL

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
@Override
    public URL getRootDirURL() {
//      System.out.println("url of "+fileName+" is "+url.toString());
        String parent = Misc.stripLastPathElement(url.toString());
        if ( parent.endsWith(".jar!") ) {
            parent = parent+"/."; // whooops. at the root so add "current dir" after jar spec
        }
        try {
            URL parentURL = new URL(parent);
//          System.out.println("parent URL "+parentURL.toString());
            return parentURL;
        }
        catch (MalformedURLException mue) {
            errMgr.runTimeError(null, null, ErrorType.INVALID_TEMPLATE_NAME, mue, parent);
        }
        return null;
    }
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:18,代碼來源:STGroupFile.java

示例5: defineRegion

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public CompiledST defineRegion(String enclosingTemplateName, Token regionT, String template, Token templateToken) {
    String name = regionT.getText();
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    CompiledST code = compile(getFileName(), enclosingTemplateName, null, template, templateToken);
    String mangled = getMangledRegionName(enclosingTemplateName, name);
    if ( lookupTemplate(mangled)==null ) {
        errMgr.compileTimeError(ErrorType.NO_SUCH_REGION, templateToken, regionT, enclosingTemplateName, name);
        return new CompiledST();
    }
    code.name = mangled;
    code.isRegion = true;
    code.regionDefType = ST.RegionType.EXPLICIT;
    code.templateDefStartToken = regionT;
    rawDefineTemplate(mangled, code, regionT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this);
    return code;
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:20,代碼來源:STGroup.java

示例6: rawDefineTemplate

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public void rawDefineTemplate(String name, CompiledST code, Token defT) {
    CompiledST prev = rawGetTemplate(name);
    if ( prev!=null ) {
        if ( !prev.isRegion ) {
            errMgr.compileTimeError(ErrorType.TEMPLATE_REDEFINITION, null, defT);
            return;
        }
        else {
            if ( code.regionDefType!= ST.RegionType.IMPLICIT && prev.regionDefType==ST.RegionType.EMBEDDED ) {
                errMgr.compileTimeError(ErrorType.EMBEDDED_REGION_REDEFINITION, null, defT, getUnMangledTemplateName(name));
                return;
            }
            else if ( code.regionDefType==ST.RegionType.IMPLICIT || prev.regionDefType==ST.RegionType.EXPLICIT ) {
                     errMgr.compileTimeError(ErrorType.REGION_REDEFINITION, null, defT, getUnMangledTemplateName(name));
                     return;
            }
        }
    }
    code.nativeGroup = this;
    code.templateDefStartToken = defT;
    templates.put(name, code);
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:23,代碼來源:STGroup.java

示例7: defineRegion

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public CompiledST defineRegion(String enclosingTemplateName, Token regionT, String template, Token templateToken) {
    String name = regionT.getText();
    template = Misc.trimOneStartingNewline(template);
    template = Misc.trimOneTrailingNewline(template);
    CompiledST code = compile(getFileName(), enclosingTemplateName, null, template, templateToken);
    String mangled = getMangledRegionName(enclosingTemplateName, name);
    if ( lookupTemplate(mangled) ==null ) {
        errMgr.compileTimeError(ErrorType.NO_SUCH_REGION,
                                templateToken,
                                regionT,
                                enclosingTemplateName,
                                name);
        return new CompiledST();
    }
    code.name = mangled;
    code.isRegion = true;
    code.regionDefType = ST.RegionType.EXPLICIT;
    code.templateDefStartToken = regionT;
    rawDefineTemplate(mangled, code, regionT);
    code.defineArgDefaultValueTemplates(this);
    code.defineImplicitlyDefinedTemplates(this);
    return code;
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:24,代碼來源:STGroup.java

示例8: rawDefineTemplate

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
public void rawDefineTemplate(String name, CompiledST code, Token defT) {
    CompiledST prev = rawGetTemplate(name);
    if ( prev!=null ) {
        if ( !prev.isRegion ) {
            errMgr.compileTimeError(ErrorType.TEMPLATE_REDEFINITION, null, defT);
            return;
        }
        else {
            if ( code.regionDefType!= ST.RegionType.IMPLICIT && prev.regionDefType== ST.RegionType.EMBEDDED ) {
                errMgr.compileTimeError(ErrorType.EMBEDDED_REGION_REDEFINITION, null, defT, getUnMangledTemplateName(name));
                return;
            }
            else if ( code.regionDefType== ST.RegionType.IMPLICIT || prev.regionDefType== ST.RegionType.EXPLICIT ) {
                errMgr.compileTimeError(ErrorType.REGION_REDEFINITION,
                                        null,
                                        defT,
                                        getUnMangledTemplateName(name));
                return;
            }
        }
    }
    code.nativeGroup = this;
    code.templateDefStartToken = defT;
    templates.put(name, code);
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:26,代碼來源:STGroup.java

示例9: loadTemplateFile

import org.stringtemplate.v4.misc.ErrorType; //導入依賴的package包/類
/** Load template stream into this group. {@code unqualifiedFileName} is
 *  {@code "a.st"}. The {@code prefix} is path from group root to
 *  {@code unqualifiedFileName} like {@code "/subdir"} if file is in
 *  {@code /subdir/a.st}.
 */

public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName, CharStream templateStream) {
    GroupLexer lexer = new GroupLexer(templateStream);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    GroupParser parser = new GroupParser(tokens);
    parser.group = this;
    lexer.group = this;
    try {
        parser.templateDef(prefix);
    }
    catch (RecognitionException re) {
        errMgr.groupSyntaxError(ErrorType.SYNTAX_ERROR, unqualifiedFileName, re, re.getMessage());
    }

    String templateName = Misc.getFileNameNoSuffix(unqualifiedFileName);
    if ( prefix !=null && prefix.length()>0 ) templateName = prefix+templateName;
    CompiledST impl = rawGetTemplate(templateName);
    impl.prefix = prefix;
    return impl;
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:26,代碼來源:STGroup.java


注:本文中的org.stringtemplate.v4.misc.ErrorType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。