Changeset 289

Show
Ignore:
Timestamp:
03/01/08 19:32:14 (4 years ago)
Author:
h3r3tic
Message:

ported Enki to Tango; bootstraps, no other tests done yet

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/enki/BaseParser.d

    r245 r289  
    3333private import enki.IParser; 
    3434 
    35 private import std.string; 
    36 private import std.stdio; 
    37 private import std.regexp; 
    38 private import std.utf; 
     35import tango.text.Util; 
     36import tango.text.Unicode; 
     37import tango.io.Stdout; 
     38import tango.text.Regex; 
     39import tango.text.convert.Format; 
    3940 
    4041alias ResultT!(bool) ResultBool; 
     
    108109                } 
    109110            } 
    110             result ~= transcodeToString(std.string.format("(%d,%d) %s\n",line,err.pos-startOfLine+1,err.text)); 
     111            result ~= transcodeToString(Format("({},{}) {}\n",line,err.pos-startOfLine+1,err.text)); 
    111112        } 
    112113        return result; 
     
    292293     
    293294    public ResultBool parse_err(){ 
    294         throw new Exception(toUTF8(getErrorReport())); 
     295        throw new Exception(.toString(getErrorReport())); 
    295296        return ResultBool(false); 
    296297    } 
  • trunk/enki/CodeGenerator.d

    r231 r289  
    2727private import enki.types; 
    2828 
    29 private import std.string
     29private import tango.io.Stdout
    3030 
    3131interface IRenderable{ 
     
    6767    public this(String name){ 
    6868        counter++; 
    69         this.name = name ~ std.string.toString(counter);  
     69        this.name = name ~ .toString(counter);  
    7070    } 
    7171     
     
    170170    public String getUniqueLabel(String label){ 
    171171        counter++; 
    172         return label ~ std.string.toString(counter); 
     172        return label ~ .toString(counter); 
    173173    } 
    174174     
  • trunk/enki/Directive.d

    r239 r289  
    2929private import enki.CodeGenerator; 
    3030 
    31 debug private import std.stdio
     31debug private import tango.io.Stdout
    3232 
    3333/* 
     
    197197else{ 
    198198    private import enki.EnkiParser; 
    199     private import std.file; 
     199    private import tango.io.FilePath; 
     200    private import tango.io.File; 
    200201} 
    201202 
     
    217218        }  
    218219        else{ 
    219             if(!std.file.isfile(filename)){ 
     220            if(!FilePath(filename).exists){ 
    220221                throw new Exception("Cannot include '" ~ filename ~ "'; file doesn't exist."); 
    221222            } 
    222223                 
    223224            auto parser = new EnkiParser(); 
    224             parser.initalize(cast(char[])std.file.read(filename)); 
     225            parser.initalize(cast(char[])File(filename).read()); 
    225226            auto result = parser.parse_Syntax(); 
    226227             
  • trunk/enki/EnkiBackend.d

    r277 r289  
    3232private import enki.Rule; 
    3333 
    34 debug private import std.stdio
     34debug private import tango.io.Stdout
    3535 
    3636interface SyntaxLine{ 
     
    253253            emit("version(build) pragma(export_version,EnkiUTF" ~ utf ~ ");"); 
    254254            emit(""); 
    255             emit("debug private import std.stdio;"); 
     255            emit("debug private import tango.io.Stdout;"); 
    256256             
    257257            if(typelib != ""){ 
  • trunk/enki/EnkiParser.d

    r277 r289  
    2929version(build) pragma(export_version,EnkiUTF8); 
    3030 
    31 debug private import std.stdio
     31debug private import tango.io.Stdout
    3232private import enki.types; 
    3333private import enki.EnkiBackend; 
     
    4747    */ 
    4848    public ResultT!(bool) parse_WS(){ 
    49         debug writefln("parse_WS()"); 
     49        debug Stdout.formatln("parse_WS()"); 
    5050        uint start1 = position; 
    5151        //no declarations 
     
    9393        } 
    9494    match1: 
    95         debug writefln("parse_WS() PASS"); 
     95        debug Stdout.formatln("parse_WS() PASS"); 
    9696        return ResultT!(bool)(true); 
    9797    mismatch2: 
     
    108108    */ 
    109109    public ResultT!(String) parse_Syntax(){ 
    110         debug writefln("parse_Syntax()"); 
     110        debug Stdout.formatln("parse_Syntax()"); 
    111111        uint start6 = position; 
    112112        SyntaxLine[] bind_lines; 
     
    166166        } 
    167167    match7: 
    168         debug writefln("parse_Syntax() PASS"); 
     168        debug Stdout.formatln("parse_Syntax() PASS"); 
    169169        createSyntax(bind_lines); 
    170170        return ResultT!(String)(sliceData(start6,position)); 
     
    182182    */ 
    183183    public ResultT!(Rule) parse_Rule(){ 
    184         debug writefln("parse_Rule()"); 
     184        debug Stdout.formatln("parse_Rule()"); 
    185185        uint start12 = position; 
    186186        String bind_name; 
     
    246246        } 
    247247    match16: 
    248         debug writefln("parse_Rule() PASS"); 
     248        debug Stdout.formatln("parse_Rule() PASS"); 
    249249        ResultT!(Rule) passed = ResultT!(Rule)(new Rule(bind_name,bind_pred,bind_expr,bind_decl)); 
    250250        return passed; 
     
    263263    */ 
    264264    public ResultT!(RuleDecl) parse_RuleDecl(){ 
    265         debug writefln("parse_RuleDecl()"); 
     265        debug Stdout.formatln("parse_RuleDecl()"); 
    266266        uint start18 = position; 
    267267        Param[] bind_params; 
     
    280280        } 
    281281    match20: 
    282         debug writefln("parse_RuleDecl() PASS"); 
     282        debug Stdout.formatln("parse_RuleDecl() PASS"); 
    283283        ResultT!(RuleDecl) passed = ResultT!(RuleDecl)(new RuleDecl(bind_params)); 
    284284        return passed; 
     
    297297    */ 
    298298    public ResultT!(RulePredicate) parse_RulePredicate(){ 
    299         debug writefln("parse_RulePredicate()"); 
     299        debug Stdout.formatln("parse_RulePredicate()"); 
    300300        uint start20 = position; 
    301301        RulePredicate bind_pred; 
     
    330330        } 
    331331    match22: 
    332         debug writefln("parse_RulePredicate() PASS"); 
     332        debug Stdout.formatln("parse_RulePredicate() PASS"); 
    333333        return ResultT!(RulePredicate)(bind_pred); 
    334334    mismatch23: 
     
    345345    */ 
    346346    public ResultT!(ClassPredicate) parse_ClassPredicate(){ 
    347         debug writefln("parse_ClassPredicate()"); 
     347        debug Stdout.formatln("parse_ClassPredicate()"); 
    348348        uint start23 = position; 
    349349        String bind_name; 
     
    362362        } 
    363363    match26: 
    364         debug writefln("parse_ClassPredicate() PASS"); 
     364        debug Stdout.formatln("parse_ClassPredicate() PASS"); 
    365365        ResultT!(ClassPredicate) passed = ResultT!(ClassPredicate)(new ClassPredicate(bind_name,bind_params)); 
    366366        return passed; 
     
    379379    */ 
    380380    public ResultT!(FunctionPredicate) parse_FunctionPredicate(){ 
    381         debug writefln("parse_FunctionPredicate()"); 
     381        debug Stdout.formatln("parse_FunctionPredicate()"); 
    382382        uint start25 = position; 
    383383        Param bind_decl; 
     
    397397        } 
    398398    match28: 
    399         debug writefln("parse_FunctionPredicate() PASS"); 
     399        debug Stdout.formatln("parse_FunctionPredicate() PASS"); 
    400400        ResultT!(FunctionPredicate) passed = ResultT!(FunctionPredicate)(new FunctionPredicate(bind_decl,bind_params)); 
    401401        return passed; 
     
    414414    */ 
    415415    public ResultT!(BindingPredicate) parse_BindingPredicate(){ 
    416         debug writefln("parse_BindingPredicate()"); 
     416        debug Stdout.formatln("parse_BindingPredicate()"); 
    417417        uint start27 = position; 
    418418        Param bind_param; 
     
    431431        } 
    432432    match30: 
    433         debug writefln("parse_BindingPredicate() PASS"); 
     433        debug Stdout.formatln("parse_BindingPredicate() PASS"); 
    434434        ResultT!(BindingPredicate) passed = ResultT!(BindingPredicate)(new BindingPredicate(bind_param)); 
    435435        return passed; 
     
    448448    */ 
    449449    public ResultT!(Param[]) parse_ParamsExpr(){ 
    450         debug writefln("parse_ParamsExpr()"); 
     450        debug Stdout.formatln("parse_ParamsExpr()"); 
    451451        uint start29 = position; 
    452452        Param[] bind_params; 
     
    511511        } 
    512512    match32: 
    513         debug writefln("parse_ParamsExpr() PASS"); 
     513        debug Stdout.formatln("parse_ParamsExpr() PASS"); 
    514514        return ResultT!(Param[])(bind_params); 
    515515    mismatch33: 
     
    526526    */ 
    527527    public ResultT!(Param) parse_Param(){ 
    528         debug writefln("parse_Param()"); 
     528        debug Stdout.formatln("parse_Param()"); 
    529529        uint start36 = position; 
    530530        Param bind_param; 
     
    543543        } 
    544544    match41: 
    545         debug writefln("parse_Param() PASS"); 
     545        debug Stdout.formatln("parse_Param() PASS"); 
    546546        return ResultT!(Param)(bind_param); 
    547547    mismatch42: 
     
    558558    */ 
    559559    public ResultT!(Param) parse_WeakParam(){ 
    560         debug writefln("parse_WeakParam()"); 
     560        debug Stdout.formatln("parse_WeakParam()"); 
    561561        uint start38 = position; 
    562562        String bind_name; 
     
    575575        } 
    576576    match43: 
    577         debug writefln("parse_WeakParam() PASS"); 
     577        debug Stdout.formatln("parse_WeakParam() PASS"); 
    578578        ResultT!(Param) passed = ResultT!(Param)(new Param(bind_name)); 
    579579        return passed; 
     
    592592    */ 
    593593    public ResultT!(Param) parse_ExplicitParam(){ 
    594         debug writefln("parse_ExplicitParam()"); 
     594        debug Stdout.formatln("parse_ExplicitParam()"); 
    595595        uint start40 = position; 
    596596        bool bind_isArray; 
     
    630630        } 
    631631    match45: 
    632         debug writefln("parse_ExplicitParam() PASS"); 
     632        debug Stdout.formatln("parse_ExplicitParam() PASS"); 
    633633        ResultT!(Param) passed = ResultT!(Param)(new Param(bind_isArray,bind_type,bind_name)); 
    634634        return passed; 
     
    646646    */ 
    647647    public ResultT!(bool) parse_Brackets(){ 
    648         debug writefln("parse_Brackets()"); 
     648        debug Stdout.formatln("parse_Brackets()"); 
    649649        uint start44 = position; 
    650650        //no declarations 
     
    673673        } 
    674674    match49: 
    675         debug writefln("parse_Brackets() PASS"); 
     675        debug Stdout.formatln("parse_Brackets() PASS"); 
    676676        return ResultT!(bool)(true); 
    677677    mismatch50: 
     
    688688    */ 
    689689    public ResultT!(Expression) parse_Expression(){ 
    690         debug writefln("parse_Expression()"); 
     690        debug Stdout.formatln("parse_Expression()"); 
    691691        uint start48 = position; 
    692692        Term[] bind_terms; 
     
    729729        } 
    730730    match53: 
    731         debug writefln("parse_Expression() PASS"); 
     731        debug Stdout.formatln("parse_Expression() PASS"); 
    732732        ResultT!(Expression) passed = ResultT!(Expression)(new Expression(bind_terms)); 
    733733        return passed; 
     
    746746    */ 
    747747    public ResultT!(SubExpression[]) parse_Term(){ 
    748         debug writefln("parse_Term()"); 
     748        debug Stdout.formatln("parse_Term()"); 
    749749        uint start53 = position; 
    750750        SubExpression[] bind_factors; 
     
    788788        } 
    789789    match60: 
    790         debug writefln("parse_Term() PASS"); 
     790        debug Stdout.formatln("parse_Term() PASS"); 
    791791        return ResultT!(SubExpression[])(bind_factors); 
    792792    mismatch61: 
     
    803803    */ 
    804804    public ResultT!(SubExpression) parse_SubExpression(){ 
    805         debug writefln("parse_SubExpression()"); 
     805        debug Stdout.formatln("parse_SubExpression()"); 
    806806        uint start58 = position; 
    807807        SubExpression bind_expr; 
     
    820820        } 
    821821    match67: 
    822         debug writefln("parse_SubExpression() PASS"); 
     822        debug Stdout.formatln("parse_SubExpression() PASS"); 
    823823        return ResultT!(SubExpression)(bind_expr); 
    824824    mismatch68: 
     
    835835    */ 
    836836    public ResultT!(Production) parse_Production(){ 
    837         debug writefln("parse_Production()"); 
     837        debug Stdout.formatln("parse_Production()"); 
    838838        uint start60 = position; 
    839839        String bind_name; 
     
    917917        } 
    918918    match69: 
    919         debug writefln("parse_Production() PASS"); 
     919        debug Stdout.formatln("parse_Production() PASS"); 
    920920        ResultT!(Production) passed = ResultT!(Production)(new Production(bind_name,bind_binding,bind_args)); 
    921921        return passed; 
     
    934934    */ 
    935935    public ResultT!(ProductionArg) parse_ProductionArg(){ 
    936         debug writefln("parse_ProductionArg()"); 
     936        debug Stdout.formatln("parse_ProductionArg()"); 
    937937        uint start69 = position; 
    938938        ProductionArg bind_arg; 
     
    951951        } 
    952952    match78: 
    953         debug writefln("parse_ProductionArg() PASS"); 
     953        debug Stdout.formatln("parse_ProductionArg() PASS"); 
    954954        return ResultT!(ProductionArg)(bind_arg); 
    955955    mismatch79: 
     
    966966    */ 
    967967    public ResultT!(StringProductionArg) parse_StringProductionArg(){ 
    968         debug writefln("parse_StringProductionArg()"); 
     968        debug Stdout.formatln("parse_StringProductionArg()"); 
    969969        uint start71 = position; 
    970970        String bind_value; 
     
    983983        } 
    984984    match80: 
    985         debug writefln("parse_StringProductionArg() PASS"); 
     985        debug Stdout.formatln("parse_StringProductionArg() PASS"); 
    986986        ResultT!(StringProductionArg) passed = ResultT!(StringProductionArg)(new StringProductionArg(bind_value)); 
    987987        return passed; 
     
    10001000    */ 
    10011001    public ResultT!(BindingProductionArg) parse_BindingProductionArg(){ 
    1002         debug writefln("parse_BindingProductionArg()"); 
     1002        debug Stdout.formatln("parse_BindingProductionArg()"); 
    10031003        uint start73 = position; 
    10041004        String bind_value; 
     
    10171017        } 
    10181018    match82: 
    1019         debug writefln("parse_BindingProductionArg() PASS"); 
     1019        debug Stdout.formatln("parse_BindingProductionArg() PASS"); 
    10201020        ResultT!(BindingProductionArg) passed = ResultT!(BindingProductionArg)(new BindingProductionArg(bind_value)); 
    10211021        return passed; 
     
    10341034    */ 
    10351035    public ResultT!(Substitution) parse_Substitution(){ 
    1036         debug writefln("parse_Substitution()"); 
     1036        debug Stdout.formatln("parse_Substitution()"); 
    10371037        uint start75 = position; 
    10381038        String bind_name; 
     
    10711071        } 
    10721072    match84: 
    1073         debug writefln("parse_Substitution() PASS"); 
     1073        debug Stdout.formatln("parse_Substitution() PASS"); 
    10741074        ResultT!(Substitution) passed = ResultT!(Substitution)(new Substitution(bind_name,bind_binding)); 
    10751075        return passed; 
     
    10881088    */ 
    10891089    public ResultT!(GroupExpr) parse_GroupExpr(){ 
    1090         debug writefln("parse_GroupExpr()"); 
     1090        debug Stdout.formatln("parse_GroupExpr()"); 
    10911091        uint start79 = position; 
    10921092        Expression bind_expr; 
     
    11341134        } 
    11351135    match88: 
    1136         debug writefln("parse_GroupExpr() PASS"); 
     1136        debug Stdout.formatln("parse_GroupExpr() PASS"); 
    11371137        ResultT!(GroupExpr) passed = ResultT!(GroupExpr)(new GroupExpr(bind_expr,bind_binding)); 
    11381138        return passed; 
     
    11511151    */ 
    11521152    public ResultT!(OptionalExpr) parse_OptionalExpr(){ 
    1153         debug writefln("parse_OptionalExpr()"); 
     1153        debug Stdout.formatln("parse_OptionalExpr()"); 
    11541154        uint start83 = position; 
    11551155        Expression bind_expr; 
     
    11971197        } 
    11981198    match92: 
    1199         debug writefln("parse_OptionalExpr() PASS"); 
     1199        debug Stdout.formatln("parse_OptionalExpr() PASS"); 
    12001200        ResultT!(OptionalExpr) passed = ResultT!(OptionalExpr)(new OptionalExpr(bind_expr,bind_binding)); 
    12011201        return passed; 
     
    12141214    */ 
    12151215    public ResultT!(ZeroOrMoreExpr) parse_ZeroOrMoreExpr(){ 
    1216         debug writefln("parse_ZeroOrMoreExpr()"); 
     1216        debug Stdout.formatln("parse_ZeroOrMoreExpr()"); 
    12171217        uint start87 = position; 
    12181218        Expression bind_expr; 
     
    12711271        } 
    12721272    match96: 
    1273         debug writefln("parse_ZeroOrMoreExpr() PASS"); 
     1273        debug Stdout.formatln("parse_ZeroOrMoreExpr() PASS"); 
    12741274        ResultT!(ZeroOrMoreExpr) passed = ResultT!(ZeroOrMoreExpr)(new ZeroOrMoreExpr(bind_expr,bind_binding,bind_term)); 
    12751275        return passed; 
     
    12881288    */ 
    12891289    public ResultT!(Terminal) parse_Terminal(){ 
    1290         debug writefln("parse_Terminal()"); 
     1290        debug Stdout.formatln("parse_Terminal()"); 
    12911291        uint start93 = position; 
    12921292        String bind_text; 
     
    13221322        } 
    13231323    match100: 
    1324         debug writefln("parse_Terminal() PASS"); 
     1324        debug Stdout.formatln("parse_Terminal() PASS"); 
    13251325        ResultT!(Terminal) passed = ResultT!(Terminal)(new Terminal(bind_text,bind_binding)); 
    13261326        return passed; 
     
    13391339    */ 
    13401340    public ResultT!(Range) parse_Range(){ 
    1341         debug writefln("parse_Range()"); 
     1341        debug Stdout.formatln("parse_Range()"); 
    13421342        uint start97 = position; 
    13431343        String bind_start; 
     
    13841384        } 
    13851385    match104: 
    1386         debug writefln("parse_Range() PASS"); 
     1386        debug Stdout.formatln("parse_Range() PASS"); 
    13871387        ResultT!(Range) passed = ResultT!(Range)(new Range(bind_start,bind_end,bind_binding)); 
    13881388        return passed; 
     
    14011401    */ 
    14021402    public ResultT!(Regexp) parse_Regexp(){ 
    1403         debug writefln("parse_Regexp()"); 
     1403        debug Stdout.formatln("parse_Regexp()"); 
    14041404        uint start103 = position; 
    14051405        String bind_text; 
     
    14751475        } 
    14761476    match108: 
    1477         debug writefln("parse_Regexp() PASS"); 
     1477        debug Stdout.formatln("parse_Regexp() PASS"); 
    14781478        ResultT!(Regexp) passed = ResultT!(Regexp)(new Regexp(bind_text,bind_binding)); 
    14791479        return passed; 
     
    14921492    */ 
    14931493    public ResultT!(Negate) parse_NegateExpr(){ 
    1494         debug writefln("parse_NegateExpr()"); 
     1494        debug Stdout.formatln("parse_NegateExpr()"); 
    14951495        uint start111 = position; 
    14961496        SubExpression bind_expr; 
     
    15081508        } 
    15091509    match117: 
    1510         debug writefln("parse_NegateExpr() PASS"); 
     1510        debug Stdout.formatln("parse_NegateExpr() PASS"); 
    15111511        ResultT!(Negate) passed = ResultT!(Negate)(new Negate(bind_expr)); 
    15121512        return passed; 
     
    15251525    */ 
    15261526    public ResultT!(Test) parse_TestExpr(){ 
    1527         debug writefln("parse_TestExpr()"); 
     1527        debug Stdout.formatln("parse_TestExpr()"); 
    15281528        uint start113 = position; 
    15291529        SubExpression bind_expr; 
     
    15411541        } 
    15421542    match119: 
    1543         debug writefln("parse_TestExpr() PASS"); 
     1543        debug Stdout.formatln("parse_TestExpr() PASS"); 
    15441544        ResultT!(Test) passed = ResultT!(Test)(new Test(bind_expr)); 
    15451545        return passed; 
     
    15581558    */ 
    15591559    public ResultT!(LiteralExpr) parse_LiteralExpr(){ 
    1560         debug writefln("parse_LiteralExpr()"); 
     1560        debug Stdout.formatln("parse_LiteralExpr()"); 
    15611561        uint start115 = position; 
    15621562        String bind_name; 
     
    16431643        } 
    16441644    match121: 
    1645         debug writefln("parse_LiteralExpr() PASS"); 
     1645        debug Stdout.formatln("parse_LiteralExpr() PASS"); 
    16461646        ResultT!(LiteralExpr) passed = ResultT!(LiteralExpr)(new LiteralExpr(bind_name,bind_binding,bind_args)); 
    16471647        return passed; 
     
    16601660    */ 
    16611661    public ResultT!(CustomTerminal) parse_CustomTerminal(){ 
    1662         debug writefln("parse_CustomTerminal()"); 
     1662        debug Stdout.formatln("parse_CustomTerminal()"); 
    16631663        uint start124 = position; 
    16641664        String bind_name; 
     
    16971697        } 
    16981698    match130: 
    1699         debug writefln("parse_CustomTerminal() PASS"); 
     1699        debug Stdout.formatln("parse_CustomTerminal() PASS"); 
    17001700        ResultT!(CustomTerminal) passed = ResultT!(CustomTerminal)(new CustomTerminal(bind_name,bind_binding)); 
    17011701        return passed; 
     
    17141714    */ 
    17151715    public ResultT!(Binding) parse_Binding(){ 
    1716         debug writefln("parse_Binding()"); 
     1716        debug Stdout.formatln("parse_Binding()"); 
    17171717        uint start128 = position; 
    17181718        bool bind_isConcat; 
     
    17561756        } 
    17571757    match134: 
    1758         debug writefln("parse_Binding() PASS"); 
     1758        debug Stdout.formatln("parse_Binding() PASS"); 
    17591759        ResultT!(Binding) passed = ResultT!(Binding)(new Binding(bind_isConcat,bind_name)); 
    17601760        return passed; 
     
    17731773    */ 
    17741774    public ResultT!(String) parse_Identifier(){ 
    1775         debug writefln("parse_Identifier()"); 
     1775        debug Stdout.formatln("parse_Identifier()"); 
    17761776        uint start132 = position; 
    17771777        String bind_value; 
     
    18271827        } 
    18281828    match138: 
    1829         debug writefln("parse_Identifier() PASS"); 
     1829        debug Stdout.formatln("parse_Identifier() PASS"); 
    18301830        return ResultT!(String)(bind_value); 
    18311831    mismatch139: 
     
    18421842    */ 
    18431843    public ResultT!(String) parse_IdentifierStartChar(){ 
    1844         debug writefln("parse_IdentifierStartChar()"); 
     1844        debug Stdout.formatln("parse_IdentifierStartChar()"); 
    18451845        uint start139 = position; 
    18461846        String bind_text; 
     
    18731873        } 
    18741874    match147: 
    1875         debug writefln("parse_IdentifierStartChar() PASS"); 
     1875        debug Stdout.formatln("parse_IdentifierStartChar() PASS"); 
    18761876        return ResultT!(String)(bind_text); 
    18771877    mismatch148: 
     
    18881888    */ 
    18891889    public ResultT!(String) parse_IdentifierChar(){ 
    1890         debug writefln("parse_IdentifierChar()"); 
     1890        debug Stdout.formatln("parse_IdentifierChar()"); 
    18911891        uint start143 = position; 
    18921892        String bind_text; 
     
    19191919        } 
    19201920    match151: 
    1921         debug writefln("parse_IdentifierChar() PASS"); 
     1921        debug Stdout.formatln("parse_IdentifierChar() PASS"); 
    19221922        return ResultT!(String)(bind_text); 
    19231923    mismatch152: 
     
    19341934    */ 
    19351935    public ResultT!(String) parse_String(){ 
    1936         debug writefln("parse_String()"); 
     1936        debug Stdout.formatln("parse_String()"); 
    19371937        uint start147 = position; 
    19381938        String bind_text; 
     
    19911991        } 
    19921992    match155: 
    1993         debug writefln("parse_String() PASS"); 
     1993        debug Stdout.formatln("parse_String() PASS"); 
    19941994        return ResultT!(String)(bind_text); 
    19951995    mismatch156: 
     
    20062006    */ 
    20072007    public ResultT!(String) parse_HexExpr(){ 
    2008         debug writefln("parse_HexExpr()"); 
     2008        debug Stdout.formatln("parse_HexExpr()"); 
    20092009        uint start154 = position; 
    20102010        String bind_text; 
     
    21012101        } 
    21022102    match162: 
    2103         debug writefln("parse_HexExpr() PASS"); 
     2103        debug Stdout.formatln("parse_HexExpr() PASS"); 
    21042104        return ResultT!(String)(bind_text); 
    21052105    mismatch163: 
     
    21162116    */ 
    21172117    public ResultT!(String) parse_AnyChar(){ 
    2118         debug writefln("parse_AnyChar()"); 
     2118        debug Stdout.formatln("parse_AnyChar()"); 
    21192119        uint start164 = position; 
    21202120        String bind_value; 
     
    21462146        } 
    21472147    match172: 
    2148         debug writefln("parse_AnyChar() PASS"); 
     2148        debug Stdout.formatln("parse_AnyChar() PASS"); 
    21492149        return ResultT!(String)(bind_value); 
    21502150    mismatch173: 
     
    21612161    */ 
    21622162    public ResultT!(Comment) parse_Comment(){ 
    2163         debug writefln("parse_Comment()"); 
     2163        debug Stdout.formatln("parse_Comment()"); 
    21642164        uint start168 = position; 
    21652165        String bind_text; 
     
    21782178        } 
    21792179    match176: 
    2180         debug writefln("parse_Comment() PASS"); 
     2180        debug Stdout.formatln("parse_Comment() PASS"); 
    21812181        ResultT!(Comment) passed = ResultT!(Comment)(new Comment(bind_text)); 
    21822182        return passed; 
     
    21952195    */ 
    21962196    public ResultT!(String) parse_PoundComment(){ 
    2197         debug writefln("parse_PoundComment()"); 
     2197        debug Stdout.formatln("parse_PoundComment()"); 
    21982198        uint start170 = position; 
    21992199        String bind_text; 
     
    22412241        } 
    22422242    match178: 
    2243         debug writefln("parse_PoundComment() PASS"); 
     2243        debug Stdout.formatln("parse_PoundComment() PASS"); 
    22442244        return ResultT!(String)(bind_text); 
    22452245    mismatch179: 
     
    22562256    */ 
    22572257    public ResultT!(String) parse_SlashSlashComment(){ 
    2258         debug writefln("parse_SlashSlashComment()"); 
     2258        debug Stdout.formatln("parse_SlashSlashComment()"); 
    22592259        uint start175 = position; 
    22602260        String bind_text; 
     
    23022302        } 
    23032303    match185: 
    2304         debug writefln("parse_SlashSlashComment() PASS"); 
     2304        debug Stdout.formatln("parse_SlashSlashComment() PASS"); 
    23052305        return ResultT!(String)(bind_text); 
    23062306    mismatch186: 
     
    23172317    */ 
    23182318    public ResultT!(String) parse_SlashStarComment(){ 
    2319         debug writefln("parse_SlashStarComment()"); 
     2319        debug Stdout.formatln("parse_SlashStarComment()"); 
    23202320        uint start180 = position; 
    23212321        String bind_text; 
     
    23632363        } 
    23642364    match192: 
    2365         debug writefln("parse_SlashStarComment() PASS"); 
     2365        debug Stdout.formatln("parse_SlashStarComment() PASS"); 
    23662366        return ResultT!(String)(bind_text); 
    23672367    mismatch193: 
     
    23782378    */ 
    23792379    public ResultT!(Directive) parse_Directive(){ 
    2380         debug writefln("parse_Directive()"); 
     2380        debug Stdout.formatln("parse_Directive()"); 
    23812381        uint start185 = position; 
    23822382        Directive bind_dir; 
     
    24082408        } 
    24092409    match199: 
    2410         debug writefln("parse_Directive() PASS"); 
     2410        debug Stdout.formatln("parse_Directive() PASS"); 
    24112411        return ResultT!(Directive)(bind_dir); 
    24122412    mismatch200: 
     
    24232423    */ 
    24242424    public ResultT!(ImportDirective) parse_ImportDirective(){ 
    2425         debug writefln("parse_ImportDirective()"); 
     2425        debug Stdout.formatln("parse_ImportDirective()"); 
    24262426        uint start188 = position; 
    24272427        String bind_imp; 
     
    24392439        } 
    24402440    match203: 
    2441         debug writefln("parse_ImportDirective() PASS"); 
     2441        debug Stdout.formatln("parse_ImportDirective() PASS"); 
    24422442        ResultT!(ImportDirective) passed = ResultT!(ImportDirective)(new ImportDirective(bind_imp)); 
    24432443        return passed; 
     
    24562456    */ 
    24572457    public ResultT!(BaseClassDirective) parse_BaseClassDirective(){ 
    2458         debug writefln("parse_BaseClassDirective()"); 
     2458        debug Stdout.formatln("parse_BaseClassDirective()"); 
    24592459        uint start190 = position; 
    24602460        String bind_name; 
     
    24722472        } 
    24732473    match205: 
    2474         debug writefln("parse_BaseClassDirective() PASS"); 
     2474        debug Stdout.formatln("parse_BaseClassDirective() PASS"); 
    24752475        ResultT!(BaseClassDirective) passed = ResultT!(BaseClassDirective)(new BaseClassDirective(bind_name)); 
    24762476        return passed; 
     
    24892489    */ 
    24902490    public ResultT!(ClassnameDirective) parse_ClassnameDirective(){ 
    2491         debug writefln("parse_ClassnameDirective()"); 
     2491        debug Stdout.formatln("parse_ClassnameDirective()"); 
    24922492        uint start192 = position; 
    24932493        String bind_name; 
     
    25052505        } 
    25062506    match207: 
    2507         debug writefln("parse_ClassnameDirective() PASS"); 
     2507        debug Stdout.formatln("parse_ClassnameDirective() PASS"); 
    25082508        ResultT!(ClassnameDirective) passed = ResultT!(ClassnameDirective)(new ClassnameDirective(bind_name)); 
    25092509        return passed; 
     
    25222522    */ 
    25232523    public ResultT!(DefineDirective) parse_DefineDirective(){ 
    2524         debug writefln("parse_DefineDirective()"); 
     2524        debug Stdout.formatln("parse_DefineDirective()"); 
    25252525        uint start194 = position; 
    25262526        String bind_returnType; 
     
    26032603        } 
    26042604    match209: 
    2605         debug writefln("parse_DefineDirective() PASS"); 
     2605        debug Stdout.formatln("parse_DefineDirective() PASS"); 
    26062606        ResultT!(DefineDirective) passed = ResultT!(DefineDirective)(new DefineDirective(bind_returnType,bind_name,bind_isTerminal,bind_description)); 
    26072607        return passed; 
     
    26202620    */ 
    26212621    public ResultT!(IncludeDirective) parse_IncludeDirective(){ 
    2622         debug writefln("parse_IncludeDirective()"); 
     2622        debug Stdout.formatln("parse_IncludeDirective()"); 
    26232623        uint start198 = position; 
    26242624        String bind_filename; 
     
    26362636        } 
    26372637    match213: 
    2638         debug writefln("parse_IncludeDirective() PASS"); 
     2638        debug Stdout.formatln("parse_IncludeDirective() PASS"); 
    26392639        ResultT!(IncludeDirective) passed = ResultT!(IncludeDirective)(new IncludeDirective(bind_filename)); 
    26402640        return passed; 
     
    26532653    */ 
    26542654    public ResultT!(AliasDirective) parse_AliasDirective(){ 
    2655         debug writefln("parse_AliasDirective()"); 
     2655        debug Stdout.formatln("parse_AliasDirective()"); 
    26562656        uint start200 = position; 
    26572657        String bind_rule; 
     
    26702670        } 
    26712671    match215: 
    2672         debug writefln("parse_AliasDirective() PASS"); 
     2672        debug Stdout.formatln("parse_AliasDirective() PASS"); 
    26732673        ResultT!(AliasDirective) passed = ResultT!(AliasDirective)(new AliasDirective(bind_rule,bind_ruleAlias)); 
    26742674        return passed; 
     
    26872687    */ 
    26882688    public ResultT!(ModuleDirective) parse_ModuleDirective(){ 
    2689         debug writefln("parse_ModuleDirective()"); 
     2689        debug Stdout.formatln("parse_ModuleDirective()"); 
    26902690        uint start202 = position; 
    26912691        String bind_moduleName; 
     
    27032703        } 
    27042704    match217: 
    2705         debug writefln("parse_ModuleDirective() PASS"); 
     2705        debug Stdout.formatln("parse_ModuleDirective() PASS"); 
    27062706        ResultT!(ModuleDirective) passed = ResultT!(ModuleDirective)(new ModuleDirective(bind_moduleName)); 
    27072707        return passed; 
     
    27202720    */ 
    27212721    public ResultT!(CodeDirective) parse_CodeDirective(){ 
    2722         debug writefln("parse_CodeDirective()"); 
     2722        debug Stdout.formatln("parse_CodeDirective()"); 
    27232723        uint start204 = position; 
    27242724        String bind_code; 
     
    27722772        } 
    27732773    match219: 
    2774         debug writefln("parse_CodeDirective() PASS"); 
     2774        debug Stdout.formatln("parse_CodeDirective() PASS"); 
    27752775        ResultT!(CodeDirective) passed = ResultT!(CodeDirective)(new CodeDirective(bind_code)); 
    27762776        return passed; 
     
    27892789    */ 
    27902790    public ResultT!(TypelibDirective) parse_TypelibDirective(){ 
    2791         debug writefln("parse_TypelibDirective()"); 
     2791        debug Stdout.formatln("parse_TypelibDirective()"); 
    27922792        uint start209 = position; 
    27932793        String bind_importName; 
     
    28052805        } 
    28062806    match226: 
    2807         debug writefln("parse_TypelibDirective() PASS"); 
     2807        debug Stdout.formatln("parse_TypelibDirective() PASS"); 
    28082808        ResultT!(TypelibDirective) passed = ResultT!(TypelibDirective)(new TypelibDirective(bind_importName)); 
    28092809        return passed; 
     
    28222822    */ 
    28232823    public ResultT!(ParseTypeDirective) parse_ParseTypeDirective(){ 
    2824         debug writefln("parse_ParseTypeDirective()"); 
     2824        debug Stdout.formatln("parse_ParseTypeDirective()"); 
    28252825        uint start211 = position; 
    28262826        String bind_typeName; 
     
    28382838        } 
    28392839    match228: 
    2840         debug writefln("parse_ParseTypeDirective() PASS"); 
     2840        debug Stdout.formatln("parse_ParseTypeDirective() PASS"); 
    28412841        ResultT!(ParseTypeDirective) passed = ResultT!(ParseTypeDirective)(new ParseTypeDirective(bind_typeName)); 
    28422842        return passed; 
     
    28552855    */ 
    28562856    public ResultT!(BoilerplateDirective) parse_BoilerplateDirective(){ 
    2857         debug writefln("parse_BoilerplateDirective()"); 
     2857        debug Stdout.formatln("parse_BoilerplateDirective()"); 
    28582858        uint start213 = position; 
    28592859        String bind_code; 
     
    29072907        } 
    29082908    match230: 
    2909         debug writefln("parse_BoilerplateDirective() PASS"); 
     2909        debug Stdout.formatln("parse_BoilerplateDirective() PASS"); 
    29102910        ResultT!(BoilerplateDirective) passed = ResultT!(BoilerplateDirective)(new BoilerplateDirective(bind_code)); 
    29112911        return passed; 
     
    29242924    */ 
    29252925    public ResultT!(HeaderDirective) parse_HeaderDirective(){ 
    2926         debug writefln("parse_HeaderDirective()"); 
     2926        debug Stdout.formatln("parse_HeaderDirective()"); 
    29272927        uint start218 = position; 
    29282928        String bind_code; 
     
    29762976        } 
    29772977    match237: 
    2978         debug writefln("parse_HeaderDirective() PASS"); 
     2978        debug Stdout.formatln("parse_HeaderDirective() PASS"); 
    29792979        ResultT!(HeaderDirective) passed = ResultT!(HeaderDirective)(new HeaderDirective(bind_code)); 
    29802980        return passed; 
     
    29932993    */ 
    29942994    public ResultT!(UTFDirective) parse_UTFDirective(){ 
    2995         debug writefln("parse_UTFDirective()"); 
     2995        debug Stdout.formatln("parse_UTFDirective()"); 
    29962996        uint start223 = position; 
    29972997        String bind_value; 
     
    30093009        } 
    30103010    match244: 
    3011         debug writefln("parse_UTFDirective() PASS"); 
     3011        debug Stdout.formatln("parse_UTFDirective() PASS"); 
    30123012        ResultT!(UTFDirective) passed = ResultT!(UTFDirective)(new UTFDirective(bind_value)); 
    30133013        return passed; 
     
    30263026    */ 
    30273027    public ResultT!(String) parse_DirectiveArg(){ 
    3028         debug writefln("parse_DirectiveArg()"); 
     3028        debug Stdout.formatln("parse_DirectiveArg()"); 
    30293029        uint start225 = position; 
    30303030        String bind_arg; 
     
    30433043        } 
    30443044    match246: 
    3045         debug writefln("parse_DirectiveArg() PASS"); 
     3045        debug Stdout.formatln("parse_DirectiveArg() PASS"); 
    30463046        return ResultT!(String)(bind_arg); 
    30473047    mismatch247: 
  • trunk/enki/Expression.d

    r276 r289  
    3030private import enki.Rule; 
    3131 
    32 private import std.stdio
     32private import tango.io.Stdout
    3333 
    3434class Expression  : IRenderable{ 
  • trunk/enki/Rule.d

    r239 r289  
    3030private import enki.CodeGenerator; 
    3131 
    32 private import std.stdio
     32private import tango.io.Stdout
    3333 
    3434class Rule : SyntaxLine, IRenderable{ 
     
    130130                emit("public ResultT!(" ~ type ~ ") parse_" ~ name ~ "(" ~ decl.renderDeclaration() ~ "){"); 
    131131                indent(); 
    132                     emit("debug writefln(\"parse_" ~ name ~ "()\");"); 
     132                    emit("debug Stdout.formatln(\"parse_" ~ name ~ "()\");"); 
    133133                    emit("uint " ~ startLabel ~ " = position;"); 
    134134                    pred.renderDeclarations(generator,decl.paramXRef); 
     
    141141                     
    142142                    render(matchLabel); 
    143                     emit("debug writefln(\"parse_" ~ name ~ "() PASS\");"); 
     143                    emit("debug Stdout.formatln(\"parse_" ~ name ~ "() PASS\");"); 
    144144                    pred.renderPass(generator,startLabel); 
    145145                     
  • trunk/enki/bootstrap.d

    r277 r289  
    4040private import enki.Rule; 
    4141 
    42 private import std.string; 
    43 private import std.stdio; 
    44 private import std.file; 
     42import tango.text.Util; 
     43import tango.text.Unicode; 
     44import tango.io.Stdout; 
     45import tango.io.File; 
    4546 
    4647// helper functions 
     
    12101211 
    12111212    // create bnf file 
    1212     std.file.write("enki/enki.bnf",syntax.toBNF());                    
     1213    File("enki/enki.bnf").write(syntax.toBNF());                   
    12131214     
    12141215    // emit the code 
    1215     std.file.write("enki/EnkiParser.d",syntax.render());       
     1216    File("enki/EnkiParser.d").write(syntax.render());      
    12161217} 
  • trunk/enki/enki_bn.d

    r277 r289  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 204
     4long auto_build_number = 236
  • trunk/enki/types.d

    r277 r289  
    2525module enki.types; 
    2626 
    27 private import std.string; 
     27/+private import std.string; 
    2828private import std.utf; 
    29 private import std.conv; 
     29private import std.conv;+/ 
     30import tango.text.Util; 
     31import tango.text.Unicode; 
     32import tango.util.Convert; 
     33static import tango.text.convert.Utf; 
    3034 
    3135version(EnkiUTF32){ 
    3236    alias dchar[] String; 
    3337    alias dchar Char; 
    34     alias toUTF32 transcodeToString; 
    35     alias toUTF8 transcodeToUTF8; 
     38    alias to!(dchar[]) transcodeToString; 
     39    alias to!(char[]) transcodeToUTF8; 
    3640} 
    3741else version(EnkiUTF16){ 
    3842    alias wchar[] String; 
    3943    alias wchar Char; 
    40     alias toUTF16 transcodeToString; 
    41     alias toUTF8 transcodeToUTF8; 
     44    alias to!(wchar[]) transcodeToString; 
     45    alias to!(char[]) transcodeToUTF8; 
    4246} 
    4347else{ 
    4448    alias char[] String; 
    4549    alias char Char; 
    46     alias toUTF8 transcodeToString; 
     50    alias to!(char[]) transcodeToString; 
    4751    char[] transcodeToUTF8(char[] value){ return value; } 
    4852} 
     53 
     54alias to!(char[]) toString; 
     55 
    4956 
    5057// implicitly converable 
     
    7279                } 
    7380                else{ 
    74                     return transcodeToString(std.string.toString(value)); 
     81                    return transcodeToString(to!(char[])(value)); 
    7582                } 
    7683            } 
     
    8390    U convert(V value){ 
    8491        static if(is(U == int)){ 
    85             return std.conv.toInt(value); 
    86         } 
    87         else static if(is(U == int)){ 
    88             return std.conv.toUint(value); 
     92            return to!(U)(value); 
     93        } 
     94        else static if(is(U == uint)){ 
     95            return to!(U)(value); 
    8996        }        
    9097        else static if(is(U == long)){ 
    91             return std.conv.toLong(value); 
     98            return to!(U)(value); 
    9299        }        
    93100        else static if(is(U == ulong)){ 
    94             return std.conv.toUlong(value); 
     101            return to!(U)(value); 
    95102        }        
    96103        else static if(is(U == short)){ 
    97             return std.conv.toShort(value); 
     104            return to!(U)(value); 
    98105        }        
    99106        else static if(is(U == ushort)){ 
    100             return std.conv.toUshort(value); 
     107            return to!(U)(value); 
    101108        }        
    102109        else static if(is(U == byte)){ 
    103             return std.conv.toByte(value); 
     110            return to!(U)(value); 
    104111        }        
    105112        else static if(is(U == ubyte)){ 
    106             return std.conv.toUbyte(value); 
     113            return to!(U)(value); 
    107114        }    
    108115        else static if(is(U == float)){ 
    109             return std.conv.toFloat(value); 
     116            return to!(U)(value); 
    110117        } 
    111118        else static if(is(U == double)){ 
    112             return std.conv.toDouble(value); 
     119            return to!(U)(value); 
    113120        } 
    114121        else static if(is(U == real)){ 
    115             return std.conv.toReal(value); 
     122            return to!(U)(value); 
    116123        } 
    117124        else static if(is(U == bool)){ 
     
    194201     
    195202    alias T Type; 
    196     alias Result!(T) ThisType; 
     203    alias typeof(*this) ThisType; 
    197204     
    198205    public static ThisType opCall(T result){