Index: bootstrap/remeta ================================================================== --- bootstrap/remeta +++ bootstrap/remeta @@ -5,41 +5,60 @@ # http://core.tcl.tk/akupries/ # # # ## ### ##### ######## ############# ##################### ## Regenerate the SLIF boot parser ## Regenerate the LITERAL parser +## Regenerate the example language parsers +## - json +## - heredoc +## - min-dt package require Tcl 8.5 package require marpa::slif::parser package require marpa::slif::container package require marpa::slif::semantics package require marpa::gen package require marpa::gen::format::cparse-critcl +package require marpa::gen::format::tparse package require fileutil #debug on util/benchmarking if {[llength $argv] > 1} { puts "Usage: $argv0 ?/path/to/main/destination/directory?" puts "Results are written to:" puts " - DST/slif-parser/parser.tcl" puts " - DST/slif-literal/lparser.tcl" + puts " - DST/languages/*/*-{c,tcl}.tcl" puts "" exit 1 } # Default: Current working directory. if {![llength $argv]} { lappend argv [pwd] } +set a {Andreas Kupries} +set ja {Jeffrey Kegler + Andreas Kupries} + set selfdir [file dirname [file normalize [info script]]] +set topdir [file dirname $selfdir] set meta [file join $selfdir marpa-tcl-slif slif] set literals [file join $selfdir marpa-tcl-slif literals] + +set lang [file join $topdir languages] +set json [file join $lang json g json.slif] +set heredoc [file join $lang heredoc g heredoc.slif] +set mindt [file join $lang min-dt g min-dt.slif] +set mindtsf [file join $lang min-dt g sf.slif] + set dst [lindex $argv 0] proc F {n} { format "%.2f" $n } -proc Make {name src dst authors} { +proc Make {authors name src dst {format cparse-critcl}} { + file mkdir [file dirname $dst] + # _ __ ___ _____ ________ _____________ _____________________ # Process the grammar set sz [file size $src] puts "Processing $src ($sz bytes) ..." marpa::slif::container create GC @@ -66,11 +85,11 @@ marpa::gen config! writer $authors marpa::gen config! year [clock format [clock seconds] -format %Y] marpa::gen config! name $name marpa::gen config! operator $::tcl_platform(user)@[info hostname] marpa::gen config! tool [file tail [info script]] - set parser [marpa::gen::format::cparse-critcl container GC] + set parser [marpa::gen::format::$format container GC] GC destroy # _ __ ___ _____ ________ _____________ _____________________ # Write to file for debugging. puts "Saving to $dst ..." @@ -79,20 +98,32 @@ puts {... OK} return } # _ __ ___ _____ ________ _____________ _____________________ -# Process the slif meta grammar - -file mkdir $dst/slif-parser $dst/slif-literal-parser - -Make marpa::slif::parser \ - $meta \ - $dst/slif-parser/parser.tcl \ - {Jeffrey Kegler + Andreas Kupries} - -Make marpa::slif::literal::parser \ - $literals \ - $dst/slif-literal/lparser.tcl \ - {Andreas Kupries} +# Process the slif grammars (meta & literal) + +Make $ja marpa::slif::parser $meta $dst/slif-parser/parser.tcl +Make $a marpa::slif::literal::parser $literals $dst/slif-literal/lparser.tcl + +# _ __ ___ _____ ________ _____________ _____________________ +# Process the example json grammar + +Make $a json::parser::c $json $dst/languages/json/json-c.tcl +Make $a json::parser::tcl $json $dst/languages/json/json-tcl.tcl tparse + +# _ __ ___ _____ ________ _____________ _____________________ +# Process the example heredoc grammar + +Make $a heredoc::parser::c $heredoc $dst/languages/heredoc/heredoc-c.tcl +Make $a heredoc::parser::tcl $heredoc $dst/languages/heredoc/heredoc-tcl.tcl tparse + +# _ __ ___ _____ ________ _____________ _____________________ +# Process the example min-dt grammars + +Make $a mindt::parser::c $mindt $dst/languages/min-dt/mindt-lang-c.tcl +Make $a mindt::parser::tcl $mindt $dst/languages/min-dt/mindt-lang-tcl.tcl tparse + +Make $a mindt::parser::sf::c $mindtsf $dst/languages/min-dt/mindt-sf-c.tcl +Make $a mindt::parser::sf::tcl $mindtsf $dst/languages/min-dt/mindt-sf-tcl.tcl tparse exit Index: languages/heredoc/heredoc-c.tcl ================================================================== --- languages/heredoc/heredoc-c.tcl +++ languages/heredoc/heredoc-c.tcl @@ -2,16 +2,16 @@ ## # This template is BSD-licensed. # (c) 2017-present Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries # http://core.tcl.tk/akupries/ ## -# (c) 2018 Grammar heredoc::parser::c 1 By Andreas Kupries +# (c) 2018 Grammar heredoc::parser::c 0 By Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "heredoc::parser::c". -## Generated On Wed Aug 08 12:05:14 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:33 PDT 2018 +## By andreask@ten +## Via remeta ## #* Space taken: 5704 bytes ## #* Statistics #* L0 @@ -24,11 +24,11 @@ #* G1 #* - #Symbols: 11 #* - #Rule Insn: 7 (+2: setup, start-sym) #* - #Rules: 7 (match insn) -package provide heredoc::parser::c 1 +package provide heredoc::parser::c 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# apply, lassign, ... @@ -688,42 +688,22 @@ Tcl_IncrRefCount (fqn); instance->name = Tcl_NewStringObj (Tcl_GetCommandName (interp, instance->cmd), -1); Tcl_IncrRefCount (instance->name); } - method process-file proc {Tcl_Interp* ip Tcl_Obj* path object args} ok { + method process-file proc {Tcl_Interp* ip object path object args} ok { int from, to; if (!marpatcl_rtc_pe_range (ip, args.c, args.v, &from, &to)) { return TCL_ERROR; } - int res, got; - char* buf; - Tcl_Channel in = Tcl_FSOpenFileChannel (ip, path, "r", 0666); - - if (!in) { - return TCL_ERROR; - } - Tcl_SetChannelBufferSize (in, 4096); - Tcl_SetChannelOption (ip, in, "-translation", "binary"); - Tcl_SetChannelOption (ip, in, "-encoding", "utf-8"); - // TODO: abort on failed set-channel-option - - Tcl_Obj* cbuf = Tcl_NewObj(); - Tcl_Obj* ebuf = Tcl_NewObj(); - while (!Tcl_Eof(in)) { - got = Tcl_ReadChars (in, cbuf, 4096, 0); - if (got < 0) { - Tcl_DecrRefCount (cbuf); - Tcl_DecrRefCount (ebuf); - return TCL_ERROR; - } - if (!got) continue; /* Pass the buck to next Tcl_Eof */ - Tcl_AppendObjToObj (ebuf, cbuf); - } - Tcl_DecrRefCount (cbuf); - (void) Tcl_Close (ip, in); - - buf = Tcl_GetStringFromObj (ebuf, &got); + Tcl_Obj* ebuf; + if (marpatcl_rtc_fget (ip, instance->state, path, &ebuf) != TCL_OK) { + return TCL_ERROR; + } + + + int got; + char* buf = Tcl_GetStringFromObj (ebuf, &got); marpatcl_rtc_enter (instance->state, buf, got, from, to); Tcl_DecrRefCount (ebuf); return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); } @@ -732,10 +712,29 @@ int from, to; if (!marpatcl_rtc_pe_range (ip, args.c, args.v, &from, &to)) { return TCL_ERROR; } marpatcl_rtc_enter (instance->state, string.s, string.len, from, to); return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); } + + method extend proc {Tcl_Interp* ip pstring string} int { + return marpatcl_rtc_enter_more (instance->state, string.s, string.len); + } + + method extend-file proc {Tcl_Interp* ip object path} ok { + Tcl_Obj* ebuf; + if (marpatcl_rtc_fget (ip, instance->state, path, &ebuf) != TCL_OK) { + return TCL_ERROR; + } + + int got; + char* buf = Tcl_GetStringFromObj (ebuf, &got); + int offset = marpatcl_rtc_enter_more (instance->state, buf, got); + Tcl_DecrRefCount (ebuf); + + Tcl_SetObjResult (ip, Tcl_NewIntObj (offset)); + return TCL_OK; + } support { /* ** Stem: @stem@ ** Pkg: @package@ Index: languages/heredoc/heredoc-tcl.tcl ================================================================== --- languages/heredoc/heredoc-tcl.tcl +++ languages/heredoc/heredoc-tcl.tcl @@ -5,15 +5,15 @@ # http://core.tcl.tk/akupries/ ## # (c) 2018 Grammar heredoc::parser::tcl By Andreas Kupries ## ## `marpa::runtime::tcl`-derived Parser for grammar "heredoc::parser::tcl". -## Generated On Wed Aug 08 12:05:14 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:33 PDT 2018 +## By andreask@ten +## Via remeta -package provide heredoc::parser::tcl 1 +package provide heredoc::parser::tcl 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# -- Foundation Index: languages/heredoc/tests/common/hd-core.testsuite ================================================================== --- languages/heredoc/tests/common/hd-core.testsuite +++ languages/heredoc/tests/common/hd-core.testsuite @@ -39,13 +39,13 @@ ## No method sequence checking for the parser. ## Methods can be called in any order. # # ## ### ##### ######## ############# ##################### -kt source support/ast.tcl -kt source support/dirs.tcl -kt source support/textutils.tcl +kt source ../../../tests/support/ast.tcl +kt source ../../../tests/support/dirs.tcl +kt source ../../../tests/support/textutils.tcl # # ## ### ##### ######## ############# ##################### ## (xx) kt local testing heredoc::parser DELETED languages/heredoc/tests/support/ast.tcl Index: languages/heredoc/tests/support/ast.tcl ================================================================== --- languages/heredoc/tests/support/ast.tcl +++ languages/heredoc/tests/support/ast.tcl @@ -1,40 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support marpa::util - -# Test suite support. -# # ## ### ##### ######## ############# -## Pretty printing an AST coming out of the SLIF parser - -proc ast-format {ast {step { }}} { - set lines {} - ast-format-acc $ast {} $step - return [join $lines \n] -} - -proc ast-format-acc {ast indent step} { - upvar 1 lines lines - - if {[string is integer [lindex $ast 0]]} { - # Terminal, Data is offset, length, and lexeme value. - lappend lines ${indent}@[marpa location show $ast] - return - } - - lassign $ast symbol children - - lappend lines $indent$symbol - append indent $step - foreach child $children { - ast-format-acc $child $indent $step - } - return -} - -# # ## ### ##### ######## ############# -return DELETED languages/heredoc/tests/support/dirs.tcl Index: languages/heredoc/tests/support/dirs.tcl ================================================================== --- languages/heredoc/tests/support/dirs.tcl +++ languages/heredoc/tests/support/dirs.tcl @@ -1,34 +0,0 @@ -# -*- tcl -*- -## -# (c) 2018-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -# Test suite support. -# # ## ### ##### ######## ############# -## Quick access to common directories of the testsuite. - -proc td {} { - return [file normalize $::tcltest::testsDirectory] -} - -proc indir {args} { - return [file normalize [file join [td] input {*}$args]] -} - -proc redir {args} { - return [file normalize [file join [td] result {*}$args]] -} - -proc locate {base args} { - foreach file $args { - set path [file join $base $file] - if {![file exists $path]} continue - return $path - } - return -code error "Unable to find any of [join $args {, }] for $base" -} - -# # ## ### ##### ######## ############# -return DELETED languages/heredoc/tests/support/textutils.tcl Index: languages/heredoc/tests/support/textutils.tcl ================================================================== --- languages/heredoc/tests/support/textutils.tcl +++ languages/heredoc/tests/support/textutils.tcl @@ -1,17 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support fileutil - -# Test suite support. -# # ## ### ##### ######## ############# - -proc fget {path} { fileutil::cat $path } -proc fgetc {path enc} { fileutil::cat -encoding $enc $path } - -# # ## ### ##### ######## ############# -return Index: languages/json/json-c.tcl ================================================================== --- languages/json/json-c.tcl +++ languages/json/json-c.tcl @@ -1,19 +1,19 @@ # -*- tcl -*- ## # This template is BSD-licensed. -# (c) 2017 Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ +# (c) 2017-present Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries +# http://core.tcl.tk/akupries/ ## -# (c) 2018-present Grammar json::parser::c 1 By Andreas Kupries +# (c) 2018 Grammar json::parser::c 0 By Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "json::parser::c". -## Generated On Tue Mar 20 20:43:56 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:32 PDT 2018 +## By andreask@ten +## Via remeta ## -#* Space taken: 4899 bytes +#* Space taken: 4903 bytes ## #* Statistics #* L0 #* - #Symbols: 318 #* - #Lexemes: 12 @@ -24,17 +24,18 @@ #* G1 #* - #Symbols: 24 #* - #Rule Insn: 18 (+2: setup, start-sym) #* - #Rules: 18 (match insn) -package provide json::parser::c 1 +package provide json::parser::c 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# apply, lassign, ... package require critcl 3.1 + critcl::buildrequirement { package require critcl::class package require critcl::cutil } @@ -52,10 +53,11 @@ # # ## ### ##### ######## ############# ##################### ## Requirements critcl::api import marpa::runtime::c 0 +critcl::api import critcl::callback 1 # # ## ### ##### ######## ############# ##################### ## Static data structures declaring the grammar critcl::ccode { @@ -470,11 +472,11 @@ 303, /* --- (36) --- --- --- Internal */ 33, 39, 35, 43, 47, 32, 55, 198, 272, 295, 183, 188, 189, 190, 192, 195, - 199, 204, 254, 281, 282, 304, 29, 30, 34, 36, 37, 44, 38, 40, 41, 42, + 199, 204, 254, 281, 282, 304, 29, 30, 34, 36, 37, 38, 40, 41, 42, 44, 45, 46, 31, 28 }; static marpatcl_rtc_sym json_parser_c_l0_rule_definitions [261] = { /* 522 bytes */ MARPATCL_RCMD_SETUP (6), @@ -495,25 +497,25 @@ MARPATCL_RCMD_PRIO (1), 280, 93, /* ::= <@CHR:<\135>> */ MARPATCL_RCMD_QUP (281), 285, /* ::= <@CLS:<\t-\n\r\40>> + */ MARPATCL_RCMD_PRIO (1), 282, 306, /* <@^CLS:<\0-\37\42\134>> ::= <@BRAN:<\40!>> */ MARPATCL_RCMD_PRIS (1) , 304, /* | <@BRAN:<#\133>> */ MARPATCL_RCMD_PRIS (1) , 307, /* | <@BRAN:<\135\177>> */ - MARPATCL_RCMD_PRIS (2) , 312, 308, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 283, 308, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 313, 308, 308, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 310, 308, 237, 311, 308, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIO (1), 283, 310, /* <@BRAN:<\u00a0\u00bf>> ::= <@BRAN:<\u00a0\u00af>> */ - MARPATCL_RCMD_PRIS (1) , 311, /* | <@BRAN:<\u00b0\u00bf>> */ + MARPATCL_RCMD_PRIS (2) , 311, 308, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 283, 308, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 312, 308, 308, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 309, 308, 237, 310, 308, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIO (1), 283, 309, /* <@BRAN:<\240\277>> ::= <@BRAN:<\240\257>> */ + MARPATCL_RCMD_PRIS (1) , 310, /* | <@BRAN:<\260\277>> */ MARPATCL_RCMD_PRIO (1), 284, 34, /* <@CLS:<\42/\134bfnrt>> ::= <@BYTE:<\42>> */ MARPATCL_RCMD_PRIS (1) , 47, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 92, /* | <@BYTE:<\134>> */ MARPATCL_RCMD_PRIS (1) , 98, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 102, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 110, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 114, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 116, /* | <@BYTE:> */ - MARPATCL_RCMD_PRIO (1), 285, 309, /* <@CLS:<\t-\n\r\40>> ::= <@BRAN:<\t\n>> */ + MARPATCL_RCMD_PRIO (1), 285, 313, /* <@CLS:<\t-\n\r\40>> ::= <@BRAN:<\t\n>> */ MARPATCL_RCMD_PRIS (1) , 13, /* | <@BYTE:<\r>> */ MARPATCL_RCMD_PRIS (1) , 32, /* | <@BYTE:<\40>> */ MARPATCL_RCMD_PRIO (1), 286, 69, /* <@CLS:> ::= <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 101, /* | <@BYTE:> */ MARPATCL_RCMD_PRIO (1), 287, 305, /* <@NCC:<[:xdigit:]>> ::= <@BRAN:<09>> */ @@ -543,16 +545,16 @@ MARPATCL_RCMD_PRIS (1) , 302, /* | */ MARPATCL_RCMD_BRAN (304), MARPATCL_RCMD_BOXR ( 35, 91), /* <@BRAN:<#\133>> brange (35 - 91) */ MARPATCL_RCMD_BRAN (305), MARPATCL_RCMD_BOXR ( 48, 57), /* <@BRAN:<09>> brange (48 - 57) */ MARPATCL_RCMD_BRAN (306), MARPATCL_RCMD_BOXR ( 32, 33), /* <@BRAN:<\40!>> brange (32 - 33) */ MARPATCL_RCMD_BRAN (307), MARPATCL_RCMD_BOXR ( 93,127), /* <@BRAN:<\135\177>> brange (93 - 127) */ - MARPATCL_RCMD_BRAN (308), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\u00bf>> brange (128 - 191) */ - MARPATCL_RCMD_BRAN (309), MARPATCL_RCMD_BOXR ( 9, 10), /* <@BRAN:<\t\n>> brange (9 - 10) */ - MARPATCL_RCMD_BRAN (310), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\u00a0\u00af>> brange (160 - 175) */ - MARPATCL_RCMD_BRAN (311), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\u00b0\u00bf>> brange (176 - 191) */ - MARPATCL_RCMD_BRAN (312), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\u00c2\u00df>> brange (194 - 223) */ - MARPATCL_RCMD_BRAN (313), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\u00e1\u00ef>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (308), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\277>> brange (128 - 191) */ + MARPATCL_RCMD_BRAN (309), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\240\257>> brange (160 - 175) */ + MARPATCL_RCMD_BRAN (310), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\260\277>> brange (176 - 191) */ + MARPATCL_RCMD_BRAN (311), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\302\337>> brange (194 - 223) */ + MARPATCL_RCMD_BRAN (312), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\341\357>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (313), MARPATCL_RCMD_BOXR ( 9, 10), /* <@BRAN:<\t\n>> brange (9 - 10) */ MARPATCL_RCMD_BRAN (314), MARPATCL_RCMD_BOXR ( 65, 70), /* <@BRAN:> brange (65 - 70) */ MARPATCL_RCMD_BRAN (315), MARPATCL_RCMD_BOXR ( 97,102), /* <@BRAN:> brange (97 - 102) */ MARPATCL_RCMD_BRAN (316), MARPATCL_RCMD_BOXR ( 49, 57), /* <@RAN:<19>> brange (49 - 57) */ MARPATCL_RCMD_PRIO (2), 317, 256, 269, /* <@L0:START> ::= <@ACS:colon> */ MARPATCL_RCMD_PRIS (2) , 257, 270, /* | <@ACS:comma> */ @@ -574,11 +576,11 @@ /* .sname */ &json_parser_c_pool, /* .symbols */ { 318, json_parser_c_l0_sym_name }, /* .rules */ { 0, NULL }, /* .lhs */ { 0, NULL }, /* .rcode */ json_parser_c_l0_rule_definitions, - 0 + /* .events */ 0 }; static marpatcl_rtc_sym json_parser_c_l0semantics [3] = { /* 6 bytes */ MARPATCL_SV_START, MARPATCL_SV_LENGTH, MARPATCL_SV_VALUE }; @@ -634,11 +636,11 @@ /* .sname */ &json_parser_c_pool, /* .symbols */ { 24, json_parser_c_g1_sym_name }, /* .rules */ { 18, json_parser_c_g1_rule_name }, /* .lhs */ { 18, json_parser_c_g1_rule_lhs }, /* .rcode */ json_parser_c_g1_rule_definitions, - 0 + /* .events */ 0 }; static marpatcl_rtc_sym json_parser_c_g1semantics [4] = { /* 8 bytes */ /* --- (1) --- --- --- Tag */ @@ -690,28 +692,72 @@ # # ## ### ##### ######## ############# ##################### ## Class exposing the grammar engine. critcl::class def json::parser::c { + insvariable marpatcl_rtc_sv_p result { Parse result } { instance->result = 0; } { if (instance->result) marpatcl_rtc_sv_unref (instance->result); } + # Note how `rtc` is declared before `pedesc`. We need it + # initalized to be able to feed it into the construction of the + # PE descriptor facade. insvariable marpatcl_rtc_p state { C-level engine, RTC structures. } { instance->state = marpatcl_rtc_cons (&json_parser_c_spec, - NULL /* actions - TODO FUTURE */, + NULL, /* No actions */ @stem@_result, (void*) instance, - 0, 0 ); + marpatcl_rtc_eh_report, (void*) &instance->ehstate ); } { marpatcl_rtc_destroy (instance->state); } + + insvariable marpatcl_rtc_pedesc_p pedesc { + Facade to the parse event descriptor structures. + Maintained only when we have parse events declared, i.e. possible. + } { + // Feed our RTC structure into the facade class so that its constructor has access to it. + marpatcl_rtc_pedesc_rtc_set (interp, instance->state); + instance->pedesc = marpatcl_rtc_pedesc_new (interp, 0, 0); + ASSERT (!marpatcl_rtc_pedesc_rtc_get (interp), "Constructor failed to take rtc structure"); + } { + marpatcl_rtc_pedesc_destroy (instance->pedesc); + } + + insvariable marpatcl_ehandlers ehstate { + Handler for parse events + } { + marpatcl_rtc_eh_init (&instance->ehstate, interp, + (marpatcl_events_to_names) 0); + /* See on-event above for further setup */ + } { + marpatcl_rtc_eh_clear (&instance->ehstate); + Tcl_DecrRefCount (instance->ehstate.self); + instance->ehstate.self = 0; + } + + insvariable Tcl_Obj* name { + Object name, tail + } { /* Initialized in the post constructor */ } { + Tcl_DecrRefCount (instance->name); + } + + method on-event proc {object args} void { + marpatcl_rtc_eh_setup (&instance->ehstate, args.c, args.v); + } + + method match proc {Tcl_Interp* ip object args} ok { + /* -- Delegate to the parse event descriptor facade */ + return marpatcl_rtc_pe_match (instance->pedesc, ip, instance->name, + args.c, args.v); + } constructor { /* * Syntax: ... [] * skip == 2: new ... @@ -720,54 +766,74 @@ if (objc > 0) { Tcl_WrongNumArgs (interp, objcskip, objv-objcskip, 0); goto error; } - } {} - - method process-file proc {Tcl_Interp* ip Tcl_Obj* path} ok { - int res, got; - char* buf; - Tcl_Obj* cbuf = Tcl_NewObj(); - Tcl_Channel in = Tcl_FSOpenFileChannel (ip, path, "r", 0666); - if (!in) { - return TCL_ERROR; - } - Tcl_SetChannelBufferSize (in, 4096); - Tcl_SetChannelOption (ip, in, "-translation", "binary"); - Tcl_SetChannelOption (ip, in, "-encoding", "utf-8"); - // TODO: abort on failed set-channel-option - - while (!Tcl_Eof(in)) { - got = Tcl_ReadChars (in, cbuf, 4096, 0); - if (got < 0) { - return TCL_ERROR; - } - if (!got) continue; /* Pass the buck to next Tcl_Eof */ - buf = Tcl_GetStringFromObj (cbuf, &got); - marpatcl_rtc_enter (instance->state, buf, got, 0, -1); - if (marpatcl_rtc_failed (instance->state)) break; - } - Tcl_DecrRefCount (cbuf); - - (void) Tcl_Close (ip, in); - return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); - } - - method process proc {Tcl_Interp* ip pstring string} ok { - marpatcl_rtc_enter (instance->state, string.s, string.len, 0, -1); - return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); - } - - support { - /* Helper function capturing parse results (semantic values of the parser) + } { + /* Post body. Save the FQN for use in the callbacks */ + instance->ehstate.self = fqn; + Tcl_IncrRefCount (fqn); + instance->name = Tcl_NewStringObj (Tcl_GetCommandName (interp, instance->cmd), -1); + Tcl_IncrRefCount (instance->name); + } + + method process-file proc {Tcl_Interp* ip object path object args} ok { + int from, to; + if (!marpatcl_rtc_pe_range (ip, args.c, args.v, &from, &to)) { return TCL_ERROR; } + + Tcl_Obj* ebuf; + if (marpatcl_rtc_fget (ip, instance->state, path, &ebuf) != TCL_OK) { + return TCL_ERROR; + } + + + int got; + char* buf = Tcl_GetStringFromObj (ebuf, &got); + marpatcl_rtc_enter (instance->state, buf, got, from, to); + Tcl_DecrRefCount (ebuf); + + return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); + } + + method process proc {Tcl_Interp* ip pstring string object args} ok { + int from, to; + if (!marpatcl_rtc_pe_range (ip, args.c, args.v, &from, &to)) { return TCL_ERROR; } + marpatcl_rtc_enter (instance->state, string.s, string.len, from, to); + return marpatcl_rtc_sv_complete (ip, instance->result, instance->state); + } + + method extend proc {Tcl_Interp* ip pstring string} int { + return marpatcl_rtc_enter_more (instance->state, string.s, string.len); + } + + method extend-file proc {Tcl_Interp* ip object path} ok { + Tcl_Obj* ebuf; + if (marpatcl_rtc_fget (ip, instance->state, path, &ebuf) != TCL_OK) { + return TCL_ERROR; + } + + int got; + char* buf = Tcl_GetStringFromObj (ebuf, &got); + int offset = marpatcl_rtc_enter_more (instance->state, buf, got); + Tcl_DecrRefCount (ebuf); + + Tcl_SetObjResult (ip, Tcl_NewIntObj (offset)); + return TCL_OK; + } + + support { + /* ** Stem: @stem@ ** Pkg: @package@ ** Class: @class@ ** IType: @instancetype@ ** CType: @classtype@ */ + + /* + ** Helper function capturing parse results (semantic values of the parser) + */ static void @stem@_result (void* cdata, marpatcl_rtc_sv_p sv) { @instancetype@ instance = (@instancetype@) cdata; Index: languages/json/json-tcl.tcl ================================================================== --- languages/json/json-tcl.tcl +++ languages/json/json-tcl.tcl @@ -1,19 +1,19 @@ # -*- tcl -*- ## # This template is BSD-licensed. -# (c) 2017 Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ +# (c) 2017-present Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries +# http://core.tcl.tk/akupries/ ## -# (c) 2018-present Grammar json::parser::tcl By Andreas Kupries +# (c) 2018 Grammar json::parser::tcl By Andreas Kupries ## ## `marpa::runtime::tcl`-derived Parser for grammar "json::parser::tcl". -## Generated On Tue Mar 13 08:05:02 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:33 PDT 2018 +## By andreask@ten +## Via remeta -package provide json::parser::tcl 1 +package provide json::parser::tcl 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# -- Foundation @@ -191,10 +191,19 @@ debug.json/parser/tcl # NOTE. This is currently limited to array semantics. # NOTE. No support for command semantics in the lexer yet. return {start length value} } + + method L0.Events {} { + debug.json/parser/tcl + # L0 parse event definitions (pre-, post-lexeme, discard) + # events = dict (symbol -> (e-type -> (e-name -> boolean))) + # Due to the nature of SLIF syntax we can only associate one + # event per type with each symbol, for a maximum of three. + return {} + } method G1.Symbols {} { # Structural symbols debug.json/parser/tcl return { @@ -236,10 +245,18 @@ {value := object} {value := string} {value := true} } } + + method G1.Events {} { + debug.json/parser/tcl + # G1 parse event definitions (predicted, nulled, completed) + # events = dict (symbol -> (e-type -> (e-name -> boolean))) + # Each symbol can have more than one event per type. + return {} + } method Start {} { debug.json/parser/tcl # G1 start symbol return {value} Index: languages/json/tests/common/json-core.testsuite ================================================================== --- languages/json/tests/common/json-core.testsuite +++ languages/json/tests/common/json-core.testsuite @@ -58,13 +58,13 @@ ## No method sequence checking for the parser. ## Methods can be called in any order. # # ## ### ##### ######## ############# ##################### -kt source support/ast.tcl -kt source support/dirs.tcl -kt source support/textutils.tcl +kt source ../../../tests/support/ast.tcl +kt source ../../../tests/support/dirs.tcl +kt source ../../../tests/support/textutils.tcl # # ## ### ##### ######## ############# ##################### kt local support [cl] DELETED languages/json/tests/support/ast.tcl Index: languages/json/tests/support/ast.tcl ================================================================== --- languages/json/tests/support/ast.tcl +++ languages/json/tests/support/ast.tcl @@ -1,40 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support marpa::util - -# Test suite support. -# # ## ### ##### ######## ############# -## Pretty printing an AST coming out of the SLIF parser - -proc ast-format {ast {step { }}} { - set lines {} - ast-format-acc $ast {} $step - return [join $lines \n] -} - -proc ast-format-acc {ast indent step} { - upvar 1 lines lines - - if {[string is integer [lindex $ast 0]]} { - # Terminal, Data is offset, length, and lexeme value. - lappend lines ${indent}@[marpa location show $ast] - return - } - - lassign $ast symbol children - - lappend lines $indent$symbol - append indent $step - foreach child $children { - ast-format-acc $child $indent $step - } - return -} - -# # ## ### ##### ######## ############# -return DELETED languages/json/tests/support/dirs.tcl Index: languages/json/tests/support/dirs.tcl ================================================================== --- languages/json/tests/support/dirs.tcl +++ languages/json/tests/support/dirs.tcl @@ -1,34 +0,0 @@ -# -*- tcl -*- -## -# (c) 2018-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -# Test suite support. -# # ## ### ##### ######## ############# -## Quick access to common directories of the testsuite. - -proc td {} { - return [file normalize $::tcltest::testsDirectory] -} - -proc indir {args} { - return [file normalize [file join [td] input {*}$args]] -} - -proc redir {args} { - return [file normalize [file join [td] result {*}$args]] -} - -proc locate {base args} { - foreach file $args { - set path [file join $base $file] - if {![file exists $path]} continue - return $path - } - return -code error "Unable to find any of [join $args {, }] for $base" -} - -# # ## ### ##### ######## ############# -return DELETED languages/json/tests/support/textutils.tcl Index: languages/json/tests/support/textutils.tcl ================================================================== --- languages/json/tests/support/textutils.tcl +++ languages/json/tests/support/textutils.tcl @@ -1,17 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support fileutil - -# Test suite support. -# # ## ### ##### ######## ############# - -proc fget {path} { fileutil::cat $path } -proc fgetc {path enc} { fileutil::cat -encoding $enc $path } - -# # ## ### ##### ######## ############# -return Index: languages/min-dt/mindt-lang-c.tcl ================================================================== --- languages/min-dt/mindt-lang-c.tcl +++ languages/min-dt/mindt-lang-c.tcl @@ -2,16 +2,16 @@ ## # This template is BSD-licensed. # (c) 2017-present Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries # http://core.tcl.tk/akupries/ ## -# (c) 2018 Grammar mindt::parser::c 1 By Andreas Kupries +# (c) 2018 Grammar mindt::parser::c 0 By Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "mindt::parser::c". -## Generated On Wed Aug 15 21:14:01 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:34 PDT 2018 +## By andreask@ten +## Via remeta ## #* Space taken: 5613 bytes ## #* Statistics #* L0 @@ -24,11 +24,11 @@ #* G1 #* - #Symbols: 30 #* - #Rule Insn: 32 (+2: setup, start-sym) #* - #Rules: 32 (match insn) -package provide mindt::parser::c 1 +package provide mindt::parser::c 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# apply, lassign, ... @@ -523,11 +523,11 @@ /* --- (65) --- --- --- Internal */ 34, 42, 43, 32, 37, 41, 44, 83, 84, 202, 232, 270, 313, 331, 209, 212, 213, 214, 215, 218, 219, 220, 221, 225, 228, 230, 231, 233, 234, 269, 282, 283, 284, 285, 292, 295, 297, 299, 305, 308, 311, 312, 319, 321, 327, 328, 334, 335, - 336, 338, 341, 29, 30, 31, 33, 35, 45, 36, 38, 39, 40, 46, 47, 222, + 336, 338, 341, 29, 30, 31, 33, 35, 36, 38, 39, 40, 45, 46, 47, 222, 28 }; static marpatcl_rtc_sym mindt_parser_c_l0_rule_definitions [418] = { /* 836 bytes */ MARPATCL_RCMD_SETUP (9), @@ -540,46 +540,46 @@ MARPATCL_RCMD_PRIO (1), 273, 323, /* ::= */ MARPATCL_RCMD_PRIO (1), 274, 312, /* ::= */ MARPATCL_RCMD_PRIO (1), 275, 316, /* ::= */ MARPATCL_RCMD_PRIO (1), 276, 319, /* ::= */ MARPATCL_RCMD_PRIO (1), 277, 326, /* ::= */ - MARPATCL_RCMD_PRIO (2), 278, 192, 128, /* <@^CLS:<\173\175>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIO (2), 278, 192, 128, /* <@^CLS:<\173\175>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 281, /* | <@BRAN:<\1z>> */ MARPATCL_RCMD_PRIS (1) , 124, /* | <@BYTE:<|>> */ MARPATCL_RCMD_PRIS (1) , 340, /* | <@BRAN:<~\177>> */ - MARPATCL_RCMD_PRIS (2) , 337, 333, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 338, 333, 333, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 335, 333, 237, 336, 333, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIO (2), 279, 192, 128, /* <@^CLS:<\t-\r\40\42\133\135>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIS (2) , 336, 333, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 337, 333, 333, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 334, 333, 237, 335, 333, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIO (2), 279, 192, 128, /* <@^CLS:<\t-\r\40\42\133\135>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 331, /* | <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 332, /* | <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 33, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 330, /* | <@BRAN:<#Z>> */ MARPATCL_RCMD_PRIS (1) , 92, /* | <@BYTE:<\134>> */ MARPATCL_RCMD_PRIS (1) , 339, /* | <@BRAN:<^\177>> */ - MARPATCL_RCMD_PRIS (2) , 337, 333, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 338, 333, 333, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 335, 333, 237, 336, 333, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIO (2), 280, 192, 128, /* <@^CLS:<\t-\r\40\133\135>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIS (2) , 336, 333, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 337, 333, 333, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 334, 333, 237, 335, 333, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIO (2), 280, 192, 128, /* <@^CLS:<\t-\r\40\133\135>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 331, /* | <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 332, /* | <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 329, /* | <@BRAN:> */ MARPATCL_RCMD_PRIS (1) , 92, /* | <@BYTE:<\134>> */ MARPATCL_RCMD_PRIS (1) , 339, /* | <@BRAN:<^\177>> */ - MARPATCL_RCMD_PRIS (2) , 337, 333, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 338, 333, 333, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 335, 333, 237, 336, 333, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ + MARPATCL_RCMD_PRIS (2) , 336, 333, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 282, 333, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 337, 333, 333, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 334, 333, 237, 335, 333, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ MARPATCL_RCMD_PRIO (1), 281, 331, /* <@BRAN:<\1z>> ::= <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 299, /* | > */ - MARPATCL_RCMD_PRIO (1), 282, 335, /* <@BRAN:<\u00a0\u00bf>> ::= <@BRAN:<\u00a0\u00af>> */ - MARPATCL_RCMD_PRIS (1) , 336, /* | <@BRAN:<\u00b0\u00bf>> */ + MARPATCL_RCMD_PRIO (1), 282, 334, /* <@BRAN:<\240\277>> ::= <@BRAN:<\240\257>> */ + MARPATCL_RCMD_PRIS (1) , 335, /* | <@BRAN:<\260\277>> */ MARPATCL_RCMD_PRIO (1), 283, 10, /* <@CLS:<\n\r>> ::= <@BYTE:<\n>> */ MARPATCL_RCMD_PRIS (1) , 13, /* | <@BYTE:<\r>> */ - MARPATCL_RCMD_PRIO (1), 284, 334, /* <@CLS:<\t-\r\40>> ::= <@BRAN:<\t\r>> */ + MARPATCL_RCMD_PRIO (1), 284, 338, /* <@CLS:<\t-\r\40>> ::= <@BRAN:<\t\r>> */ MARPATCL_RCMD_PRIS (1) , 32, /* | <@BYTE:<\40>> */ MARPATCL_RCMD_PRIO (2), 285, 92, 123, /* <@STR:<\134\173>> ::= <@BYTE:<\134>> <@BYTE:<\173>> */ MARPATCL_RCMD_PRIO (2), 286, 92, 125, /* <@STR:<\134\175>> ::= <@BYTE:<\134>> <@BYTE:<\175>> */ MARPATCL_RCMD_PRIO (2), 287, 13, 10, /* <@STR:<\r\n>> ::= <@BYTE:<\r>> <@BYTE:<\n>> */ MARPATCL_RCMD_PRIO (7), 288, 99, 111, 109, 109, 101, 110, 116, /* <@STR:> ::= <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> */ @@ -594,11 +594,11 @@ MARPATCL_RCMD_PRIO (3), 296, 293, 298, 294, /* ::=
*/ MARPATCL_RCMD_PRIO (1), 297, 292, /* ::= */ MARPATCL_RCMD_PRIS (1) , 296, /* | */ MARPATCL_RCMD_PRIS (1) , 295, /* | */ MARPATCL_RCMD_QUN (298), 297, /* ::= * */ - MARPATCL_RCMD_PRIO (1), 299, 334, /* > ::= <@BRAN:<\t\r>> */ + MARPATCL_RCMD_PRIO (1), 299, 338, /* > ::= <@BRAN:<\t\r>> */ MARPATCL_RCMD_PRIS (1) , 300, /* | > */ MARPATCL_RCMD_PRIO (1), 300, 332, /* > ::= <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 341, /* | > */ MARPATCL_RCMD_PRIO (1), 301, 290, /* ::= <@STR:> */ MARPATCL_RCMD_PRIO (1), 302, 91, /* ::= <@CHR:<\133>> */ @@ -638,16 +638,16 @@ MARPATCL_RCMD_QUPS (328), 327, MARPATCL_RCMD_SEP (326), /* ::= + () */ MARPATCL_RCMD_BRAN (329), MARPATCL_RCMD_BOXR ( 33, 90), /* <@BRAN:> brange (33 - 90) */ MARPATCL_RCMD_BRAN (330), MARPATCL_RCMD_BOXR ( 35, 90), /* <@BRAN:<#Z>> brange (35 - 90) */ MARPATCL_RCMD_BRAN (331), MARPATCL_RCMD_BOXR ( 1, 8), /* <@BRAN:<\1\10>> brange (1 - 8) */ MARPATCL_RCMD_BRAN (332), MARPATCL_RCMD_BOXR ( 14, 31), /* <@BRAN:<\16\37>> brange (14 - 31) */ - MARPATCL_RCMD_BRAN (333), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\u00bf>> brange (128 - 191) */ - MARPATCL_RCMD_BRAN (334), MARPATCL_RCMD_BOXR ( 9, 13), /* <@BRAN:<\t\r>> brange (9 - 13) */ - MARPATCL_RCMD_BRAN (335), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\u00a0\u00af>> brange (160 - 175) */ - MARPATCL_RCMD_BRAN (336), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\u00b0\u00bf>> brange (176 - 191) */ - MARPATCL_RCMD_BRAN (337), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\u00c2\u00df>> brange (194 - 223) */ - MARPATCL_RCMD_BRAN (338), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\u00e1\u00ef>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (333), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\277>> brange (128 - 191) */ + MARPATCL_RCMD_BRAN (334), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\240\257>> brange (160 - 175) */ + MARPATCL_RCMD_BRAN (335), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\260\277>> brange (176 - 191) */ + MARPATCL_RCMD_BRAN (336), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\302\337>> brange (194 - 223) */ + MARPATCL_RCMD_BRAN (337), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\341\357>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (338), MARPATCL_RCMD_BOXR ( 9, 13), /* <@BRAN:<\t\r>> brange (9 - 13) */ MARPATCL_RCMD_BRAN (339), MARPATCL_RCMD_BOXR ( 94,127), /* <@BRAN:<^\177>> brange (94 - 127) */ MARPATCL_RCMD_BRAN (340), MARPATCL_RCMD_BOXR (126,127), /* <@BRAN:<~\177>> brange (126 - 127) */ MARPATCL_RCMD_BRAN (341), MARPATCL_RCMD_BOXR ( 32,122), /* > brange (32 - 122) */ MARPATCL_RCMD_PRIO (2), 342, 256, 267, /* <@L0:START> ::= <@ACS:Braced> */ MARPATCL_RCMD_PRIS (2) , 257, 268, /* | <@ACS:CDone> */ Index: languages/min-dt/mindt-lang-tcl.tcl ================================================================== --- languages/min-dt/mindt-lang-tcl.tcl +++ languages/min-dt/mindt-lang-tcl.tcl @@ -5,15 +5,15 @@ # http://core.tcl.tk/akupries/ ## # (c) 2018 Grammar mindt::parser::tcl By Andreas Kupries ## ## `marpa::runtime::tcl`-derived Parser for grammar "mindt::parser::tcl". -## Generated On Wed Aug 15 21:14:02 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:35 PDT 2018 +## By andreask@ten +## Via remeta -package provide mindt::parser::tcl 1 +package provide mindt::parser::tcl 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# -- Foundation Index: languages/min-dt/mindt-sf-c.tcl ================================================================== --- languages/min-dt/mindt-sf-c.tcl +++ languages/min-dt/mindt-sf-c.tcl @@ -2,16 +2,16 @@ ## # This template is BSD-licensed. # (c) 2017-present Template - Andreas Kupries http://wiki.tcl.tk/andreas%20kupries # http://core.tcl.tk/akupries/ ## -# (c) 2018 Grammar mindt::parser::sf::c 1 By Andreas Kupries +# (c) 2018 Grammar mindt::parser::sf::c 0 By Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "mindt::parser::sf::c". -## Generated On Wed Aug 15 21:14:04 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:36 PDT 2018 +## By andreask@ten +## Via remeta ## #* Space taken: 5800 bytes ## #* Statistics #* L0 @@ -24,11 +24,11 @@ #* G1 #* - #Symbols: 30 #* - #Rule Insn: 37 (+2: setup, start-sym) #* - #Rules: 37 (match insn) -package provide mindt::parser::sf::c 1 +package provide mindt::parser::sf::c 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# apply, lassign, ... @@ -504,11 +504,11 @@ /* --- (62) --- --- --- Internal */ 34, 42, 43, 32, 37, 41, 44, 83, 84, 202, 228, 264, 329, 209, 212, 213, 214, 215, 218, 219, 220, 221, 225, 226, 227, 229, 230, 262, 275, 276, 277, 278, 288, 291, 293, 294, 300, 303, 306, 307, 315, 316, 327, 332, 334, 335, 336, 338, - 29, 30, 31, 33, 35, 45, 36, 38, 39, 40, 46, 47, 222, 28 + 29, 30, 31, 33, 35, 36, 38, 39, 40, 45, 46, 47, 222, 28 }; static marpatcl_rtc_sym mindt_parser_sf_c_l0_rule_definitions [378] = { /* 756 bytes */ MARPATCL_RCMD_SETUP (7), MARPATCL_RCMD_PRIO (1), 266, 293, /* ::= */ @@ -519,46 +519,46 @@ MARPATCL_RCMD_PRIO (1), 271, 298, /* ::= */ MARPATCL_RCMD_PRIO (1), 272, 302, /* ::= */ MARPATCL_RCMD_PRIO (1), 273, 318, /* ::= */ MARPATCL_RCMD_PRIO (1), 274, 321, /* ::= */ MARPATCL_RCMD_PRIO (1), 275, 322, /* ::= */ - MARPATCL_RCMD_PRIO (2), 276, 192, 128, /* <@^CLS:<\173\175>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIO (2), 276, 192, 128, /* <@^CLS:<\173\175>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 279, /* | <@BRAN:<\1z>> */ MARPATCL_RCMD_PRIS (1) , 124, /* | <@BYTE:<|>> */ MARPATCL_RCMD_PRIS (1) , 335, /* | <@BRAN:<~\177>> */ - MARPATCL_RCMD_PRIS (2) , 332, 328, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 333, 328, 328, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 330, 328, 237, 331, 328, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIO (2), 277, 192, 128, /* <@^CLS:<\t-\r\40\42\133\135>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIS (2) , 331, 328, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 332, 328, 328, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 329, 328, 237, 330, 328, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIO (2), 277, 192, 128, /* <@^CLS:<\t-\r\40\42\133\135>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 326, /* | <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 327, /* | <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 33, /* | <@BYTE:> */ MARPATCL_RCMD_PRIS (1) , 325, /* | <@BRAN:<#Z>> */ MARPATCL_RCMD_PRIS (1) , 92, /* | <@BYTE:<\134>> */ MARPATCL_RCMD_PRIS (1) , 334, /* | <@BRAN:<^\177>> */ - MARPATCL_RCMD_PRIS (2) , 332, 328, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 333, 328, 328, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 330, 328, 237, 331, 328, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIO (2), 278, 192, 128, /* <@^CLS:<\t-\r\40\133\135>> ::= <@BYTE:<\u00c0>> <@BYTE:<\200>> */ + MARPATCL_RCMD_PRIS (2) , 331, 328, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 332, 328, 328, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 329, 328, 237, 330, 328, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIO (2), 278, 192, 128, /* <@^CLS:<\t-\r\40\133\135>> ::= <@BYTE:<\300>> <@BYTE:<\200>> */ MARPATCL_RCMD_PRIS (1) , 326, /* | <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 327, /* | <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 324, /* | <@BRAN:> */ MARPATCL_RCMD_PRIS (1) , 92, /* | <@BYTE:<\134>> */ MARPATCL_RCMD_PRIS (1) , 334, /* | <@BRAN:<^\177>> */ - MARPATCL_RCMD_PRIS (2) , 332, 328, /* | <@BRAN:<\u00c2\u00df>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\u00e0>> <@BRAN:<\u00a0\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (3) , 333, 328, 328, /* | <@BRAN:<\u00e1\u00ef>> <@BRAN:<\200\u00bf>> <@BRAN:<\200\u00bf>> */ - MARPATCL_RCMD_PRIS (6) , 237, 330, 328, 237, 331, 328, /* | <@BYTE:<\u00ed>> <@BRAN:<\u00a0\u00af>> <@BRAN:<\200\u00bf>> <@BYTE:<\u00ed>> <@BRAN:<\u00b0\u00bf>> <@BRAN:<\200\u00bf>> */ + MARPATCL_RCMD_PRIS (2) , 331, 328, /* | <@BRAN:<\302\337>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 224, 280, 328, /* | <@BYTE:<\340>> <@BRAN:<\240\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (3) , 332, 328, 328, /* | <@BRAN:<\341\357>> <@BRAN:<\200\277>> <@BRAN:<\200\277>> */ + MARPATCL_RCMD_PRIS (6) , 237, 329, 328, 237, 330, 328, /* | <@BYTE:<\355>> <@BRAN:<\240\257>> <@BRAN:<\200\277>> <@BYTE:<\355>> <@BRAN:<\260\277>> <@BRAN:<\200\277>> */ MARPATCL_RCMD_PRIO (1), 279, 326, /* <@BRAN:<\1z>> ::= <@BRAN:<\1\10>> */ MARPATCL_RCMD_PRIS (1) , 296, /* | > */ - MARPATCL_RCMD_PRIO (1), 280, 330, /* <@BRAN:<\u00a0\u00bf>> ::= <@BRAN:<\u00a0\u00af>> */ - MARPATCL_RCMD_PRIS (1) , 331, /* | <@BRAN:<\u00b0\u00bf>> */ + MARPATCL_RCMD_PRIO (1), 280, 329, /* <@BRAN:<\240\277>> ::= <@BRAN:<\240\257>> */ + MARPATCL_RCMD_PRIS (1) , 330, /* | <@BRAN:<\260\277>> */ MARPATCL_RCMD_PRIO (1), 281, 10, /* <@CLS:<\n\r>> ::= <@BYTE:<\n>> */ MARPATCL_RCMD_PRIS (1) , 13, /* | <@BYTE:<\r>> */ - MARPATCL_RCMD_PRIO (1), 282, 329, /* <@CLS:<\t-\r\40>> ::= <@BRAN:<\t\r>> */ + MARPATCL_RCMD_PRIO (1), 282, 333, /* <@CLS:<\t-\r\40>> ::= <@BRAN:<\t\r>> */ MARPATCL_RCMD_PRIS (1) , 32, /* | <@BYTE:<\40>> */ MARPATCL_RCMD_PRIO (2), 283, 92, 123, /* <@STR:<\134\173>> ::= <@BYTE:<\134>> <@BYTE:<\173>> */ MARPATCL_RCMD_PRIO (2), 284, 92, 125, /* <@STR:<\134\175>> ::= <@BYTE:<\134>> <@BYTE:<\175>> */ MARPATCL_RCMD_PRIO (2), 285, 13, 10, /* <@STR:<\r\n>> ::= <@BYTE:<\r>> <@BYTE:<\n>> */ MARPATCL_RCMD_PRIO (7), 286, 99, 111, 109, 109, 101, 110, 116, /* <@STR:> ::= <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> <@BYTE:> */ @@ -572,11 +572,11 @@ MARPATCL_RCMD_PRIO (3), 293, 290, 295, 291, /* ::=
*/ MARPATCL_RCMD_PRIO (1), 294, 289, /* ::= */ MARPATCL_RCMD_PRIS (1) , 293, /* | */ MARPATCL_RCMD_PRIS (1) , 292, /* | */ MARPATCL_RCMD_QUN (295), 294, /* ::= * */ - MARPATCL_RCMD_PRIO (1), 296, 329, /* > ::= <@BRAN:<\t\r>> */ + MARPATCL_RCMD_PRIO (1), 296, 333, /* > ::= <@BRAN:<\t\r>> */ MARPATCL_RCMD_PRIS (1) , 297, /* | > */ MARPATCL_RCMD_PRIO (1), 297, 327, /* > ::= <@BRAN:<\16\37>> */ MARPATCL_RCMD_PRIS (1) , 336, /* | > */ MARPATCL_RCMD_PRIO (1), 298, 91, /* ::= <@CHR:<\133>> */ MARPATCL_RCMD_PRIO (5), 299, 298, 320, 323, 320, 302, /* ::= */ @@ -614,16 +614,16 @@ MARPATCL_RCMD_QUPS (323), 322, MARPATCL_RCMD_SEP (321), /* ::= + () */ MARPATCL_RCMD_BRAN (324), MARPATCL_RCMD_BOXR ( 33, 90), /* <@BRAN:> brange (33 - 90) */ MARPATCL_RCMD_BRAN (325), MARPATCL_RCMD_BOXR ( 35, 90), /* <@BRAN:<#Z>> brange (35 - 90) */ MARPATCL_RCMD_BRAN (326), MARPATCL_RCMD_BOXR ( 1, 8), /* <@BRAN:<\1\10>> brange (1 - 8) */ MARPATCL_RCMD_BRAN (327), MARPATCL_RCMD_BOXR ( 14, 31), /* <@BRAN:<\16\37>> brange (14 - 31) */ - MARPATCL_RCMD_BRAN (328), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\u00bf>> brange (128 - 191) */ - MARPATCL_RCMD_BRAN (329), MARPATCL_RCMD_BOXR ( 9, 13), /* <@BRAN:<\t\r>> brange (9 - 13) */ - MARPATCL_RCMD_BRAN (330), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\u00a0\u00af>> brange (160 - 175) */ - MARPATCL_RCMD_BRAN (331), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\u00b0\u00bf>> brange (176 - 191) */ - MARPATCL_RCMD_BRAN (332), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\u00c2\u00df>> brange (194 - 223) */ - MARPATCL_RCMD_BRAN (333), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\u00e1\u00ef>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (328), MARPATCL_RCMD_BOXR (128,191), /* <@BRAN:<\200\277>> brange (128 - 191) */ + MARPATCL_RCMD_BRAN (329), MARPATCL_RCMD_BOXR (160,175), /* <@BRAN:<\240\257>> brange (160 - 175) */ + MARPATCL_RCMD_BRAN (330), MARPATCL_RCMD_BOXR (176,191), /* <@BRAN:<\260\277>> brange (176 - 191) */ + MARPATCL_RCMD_BRAN (331), MARPATCL_RCMD_BOXR (194,223), /* <@BRAN:<\302\337>> brange (194 - 223) */ + MARPATCL_RCMD_BRAN (332), MARPATCL_RCMD_BOXR (225,239), /* <@BRAN:<\341\357>> brange (225 - 239) */ + MARPATCL_RCMD_BRAN (333), MARPATCL_RCMD_BOXR ( 9, 13), /* <@BRAN:<\t\r>> brange (9 - 13) */ MARPATCL_RCMD_BRAN (334), MARPATCL_RCMD_BOXR ( 94,127), /* <@BRAN:<^\177>> brange (94 - 127) */ MARPATCL_RCMD_BRAN (335), MARPATCL_RCMD_BOXR (126,127), /* <@BRAN:<~\177>> brange (126 - 127) */ MARPATCL_RCMD_BRAN (336), MARPATCL_RCMD_BOXR ( 32,122), /* > brange (32 - 122) */ MARPATCL_RCMD_PRIO (2), 337, 256, 266, /* <@L0:START> ::= <@ACS:Braced> */ MARPATCL_RCMD_PRIS (2) , 257, 267, /* | <@ACS:Include> */ Index: languages/min-dt/mindt-sf-tcl.tcl ================================================================== --- languages/min-dt/mindt-sf-tcl.tcl +++ languages/min-dt/mindt-sf-tcl.tcl @@ -5,15 +5,15 @@ # http://core.tcl.tk/akupries/ ## # (c) 2018 Grammar mindt::parser::sf::tcl By Andreas Kupries ## ## `marpa::runtime::tcl`-derived Parser for grammar "mindt::parser::sf::tcl". -## Generated On Wed Aug 15 21:14:06 PDT 2018 -## By aku@hephaistos -## Via marpa-gen +## Generated On Fri Sep 07 15:24:37 PDT 2018 +## By andreask@ten +## Via remeta -package provide mindt::parser::sf::tcl 1 +package provide mindt::parser::sf::tcl 0 # # ## ### ##### ######## ############# ## Requisites package require Tcl 8.5 ;# -- Foundation @@ -102,11 +102,11 @@ method Discards {} { debug.mindt/parser/sf/tcl # Discarded symbols (whitespace) return { - + } } method L0.Symbols {} { # Non-lexeme, non-literal symbols Index: languages/min-dt/tests/common/mdt-core.testsuite ================================================================== --- languages/min-dt/tests/common/mdt-core.testsuite +++ languages/min-dt/tests/common/mdt-core.testsuite @@ -1,7 +1,8 @@ # -*- tcl -*- -## (c) 2018-present Andreas Kupries +## (c) 2018-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries +# http://core.tcl.tk/akupries/ # # ## ### ##### ######## ############# ##################### ## Execution core for testing the mini-doctools parser on top of ## different runtimes. ## Configured by the caller with procedures. ## - overall initialization and finalization @@ -28,12 +29,13 @@ kt require support debug kt require support debug::caller kt require support oo::util kt require support TclOO kt require support fileutil ;# cat -kt require support marpa::util -kt require support marpa::multi-stop + +kt l-require support marpa::util +kt l-require support marpa::multi-stop # Parser packages - See (xx) # # ## ### ##### ######## ############# ##################### ## Local shorthands @@ -49,13 +51,17 @@ ## No method sequence checking for the parser. ## Methods can be called in any order. # # ## ### ##### ######## ############# ##################### -kt source support/ast.tcl -kt source support/dirs.tcl -kt source support/textutils.tcl +kt source ../../../tests/support/ast.tcl +kt source ../../../tests/support/dirs.tcl +kt source ../../../tests/support/textutils.tcl + +if {([rt] eq "c") && [args-map]} { + proc args x { string map {... {?args...?}} $x } +} # # ## ### ##### ######## ############# ##################### ## (xx) kt local testing mindt::base @@ -98,11 +104,14 @@ test [tnp]-process-1.1.$l "[$level] :: process, wrong args, not enough" -body { PARSE process } -setup setup-$level \ -cleanup cleanup \ -returnCodes error \ - -result {wrong # args: should be "PARSE process string ..."} + -result [args {wrong # args: should be "PARSE process string ..."}] + + # Reset to regular for high-level interface. + proc args {x} { set x } # # ## ### ##### ######## ############# ##################### ## process - Actual processing - Id formatting prep # # ## ### ##### ######## ############# ##################### Index: languages/min-dt/tests/common/sf-core.testsuite ================================================================== --- languages/min-dt/tests/common/sf-core.testsuite +++ languages/min-dt/tests/common/sf-core.testsuite @@ -1,7 +1,8 @@ # -*- tcl -*- -## (c) 2018-present Andreas Kupries +## (c) 2018-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries +# http://core.tcl.tk/akupries/ # # ## ### ##### ######## ############# ##################### ## Execution core for testing the mini-doctools parser on top of ## different runtimes. ## Configured by the caller with procedures. ## - overall initialization and finalization @@ -23,11 +24,12 @@ kt require support debug kt require support debug::caller kt require support oo::util kt require support TclOO kt require support fileutil ;# cat -kt require support marpa::util + +kt l-require support marpa::util # Parser packages - See (xx) # # ## ### ##### ######## ############# ##################### ## Local shorthands @@ -42,13 +44,17 @@ ## No method sequence checking for the parser. ## Methods can be called in any order. # # ## ### ##### ######## ############# ##################### -kt source support/ast.tcl -kt source support/dirs.tcl -kt source support/textutils.tcl +kt source ../../../tests/support/ast.tcl +kt source ../../../tests/support/dirs.tcl +kt source ../../../tests/support/textutils.tcl + +if {([rt] eq "c") && [args-map]} { + proc args x { string map {... {?args...?}} $x } +} # # ## ### ##### ######## ############# ##################### ## (xx) kt local support [cl] @@ -71,11 +77,11 @@ test [tnp]-process-1.0 "[cl] :: process, wrong args, not enough" -body { PARSE process } -setup setup \ -cleanup cleanup \ -returnCodes error \ - -result {wrong # args: should be "PARSE process string ..."} + -result [args {wrong # args: should be "PARSE process string ..."}] # # ## ### ##### ######## ############# ##################### ## process - Actual processing - Id formatting prep # # ## ### ##### ######## ############# ##################### DELETED languages/min-dt/tests/support/ast.tcl Index: languages/min-dt/tests/support/ast.tcl ================================================================== --- languages/min-dt/tests/support/ast.tcl +++ languages/min-dt/tests/support/ast.tcl @@ -1,40 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support marpa::util - -# Test suite support. -# # ## ### ##### ######## ############# -## Pretty printing an AST coming out of the SLIF parser - -proc ast-format {ast {step { }}} { - set lines {} - ast-format-acc $ast {} $step - return [join $lines \n] -} - -proc ast-format-acc {ast indent step} { - upvar 1 lines lines - - if {[string is integer [lindex $ast 0]]} { - # Terminal, Data is offset, length, and lexeme value. - lappend lines ${indent}@[marpa location show $ast] - return - } - - lassign $ast symbol children - - lappend lines $indent$symbol - append indent $step - foreach child $children { - ast-format-acc $child $indent $step - } - return -} - -# # ## ### ##### ######## ############# -return DELETED languages/min-dt/tests/support/dirs.tcl Index: languages/min-dt/tests/support/dirs.tcl ================================================================== --- languages/min-dt/tests/support/dirs.tcl +++ languages/min-dt/tests/support/dirs.tcl @@ -1,34 +0,0 @@ -# -*- tcl -*- -## -# (c) 2018-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -# Test suite support. -# # ## ### ##### ######## ############# -## Quick access to common directories of the testsuite. - -proc td {} { - return [file normalize $::tcltest::testsDirectory] -} - -proc indir {args} { - return [file normalize [file join [td] input {*}$args]] -} - -proc redir {args} { - return [file normalize [file join [td] result {*}$args]] -} - -proc locate {base args} { - foreach file $args { - set path [file join $base $file] - if {![file exists $path]} continue - return $path - } - return -code error "Unable to find any of [join $args {, }] for $base" -} - -# # ## ### ##### ######## ############# -return DELETED languages/min-dt/tests/support/textutils.tcl Index: languages/min-dt/tests/support/textutils.tcl ================================================================== --- languages/min-dt/tests/support/textutils.tcl +++ languages/min-dt/tests/support/textutils.tcl @@ -1,17 +0,0 @@ -# -*- tcl -*- -## -# (c) 2017 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries -# http://core.tcl.tk/akupries/ -## -# This code is BSD-licensed. - -kt require support fileutil - -# Test suite support. -# # ## ### ##### ######## ############# - -proc fget {path} { fileutil::cat $path } -proc fgetc {path enc} { fileutil::cat -encoding $enc $path } - -# # ## ### ##### ######## ############# -return Index: slif-literal/lparser.tcl ================================================================== --- slif-literal/lparser.tcl +++ slif-literal/lparser.tcl @@ -5,12 +5,12 @@ # http://core.tcl.tk/akupries/ ## # (c) 2018 Grammar marpa::slif::literal::parser 0 By Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "marpa::slif::literal::parser". -## Generated On Thu Sep 06 20:46:28 PDT 2018 -## By aku@hephaistos +## Generated On Fri Sep 07 15:24:31 PDT 2018 +## By andreask@ten ## Via remeta ## #* Space taken: 24956 bytes ## #* Statistics Index: slif-parser/parser.tcl ================================================================== --- slif-parser/parser.tcl +++ slif-parser/parser.tcl @@ -5,12 +5,12 @@ # http://core.tcl.tk/akupries/ ## # (c) 2018 Grammar marpa::slif::parser 0 By Jeffrey Kegler + Andreas Kupries ## ## `marpa::runtime::c`-derived Parser for grammar "marpa::slif::parser". -## Generated On Thu Sep 06 20:46:26 PDT 2018 -## By aku@hephaistos +## Generated On Fri Sep 07 15:24:29 PDT 2018 +## By andreask@ten ## Via remeta ## #* Space taken: 53372 bytes ## #* Statistics ADDED tests/lang-heredoc-rtc.test Index: tests/lang-heredoc-rtc.test ================================================================== --- tests/lang-heredoc-rtc.test +++ tests/lang-heredoc-rtc.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/heredoc/tests { + kt::source heredoc-rtc.test +} ADDED tests/lang-heredoc-tcl.test Index: tests/lang-heredoc-tcl.test ================================================================== --- tests/lang-heredoc-tcl.test +++ tests/lang-heredoc-tcl.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/heredoc/tests { + kt::source heredoc-tcl.test +} ADDED tests/lang-json-rtc.test Index: tests/lang-json-rtc.test ================================================================== --- tests/lang-json-rtc.test +++ tests/lang-json-rtc.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/json/tests { + kt::source json-rtc.test +} ADDED tests/lang-json-tcl.test Index: tests/lang-json-tcl.test ================================================================== --- tests/lang-json-tcl.test +++ tests/lang-json-tcl.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/json/tests { + kt::source json-tcl.test +} ADDED tests/lang-mindt-rtc.test Index: tests/lang-mindt-rtc.test ================================================================== --- tests/lang-mindt-rtc.test +++ tests/lang-mindt-rtc.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/min-dt/tests { + kt::source mindt-rtc.test +} ADDED tests/lang-mindt-sf-rtc.test Index: tests/lang-mindt-sf-rtc.test ================================================================== --- tests/lang-mindt-sf-rtc.test +++ tests/lang-mindt-sf-rtc.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/min-dt/tests { + kt::source mindt-sf-rtc.test +} ADDED tests/lang-mindt-sf-tcl.test Index: tests/lang-mindt-sf-tcl.test ================================================================== --- tests/lang-mindt-sf-tcl.test +++ tests/lang-mindt-sf-tcl.test @@ -0,0 +1,5 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/min-dt/tests { + kt::source mindt-sf-tcl.test +} + ADDED tests/lang-mindt-tcl.test Index: tests/lang-mindt-tcl.test ================================================================== --- tests/lang-mindt-tcl.test +++ tests/lang-mindt-tcl.test @@ -0,0 +1,4 @@ +# -*- tcl -*- tcl.tk//DSL tcltest//EN// +kt::in ../languages/min-dt/tests { + kt::source mindt-tcl.test +} Index: tests/support/ast.tcl ================================================================== --- tests/support/ast.tcl +++ tests/support/ast.tcl @@ -2,10 +2,12 @@ ## # (c) 2017-present Andreas Kupries http://wiki.tcl.tk/andreas%20kupries # http://core.tcl.tk/akupries/ ## # This code is BSD-licensed. + +kt l-require support marpa::util # Test suite support. # # ## ### ##### ######## ############# ## Pretty printing an AST coming out of the SLIF parser Index: tests/support/textutils.tcl ================================================================== --- tests/support/textutils.tcl +++ tests/support/textutils.tcl @@ -41,10 +41,12 @@ proc 2lines {path} { split [string trimright [fget $path]] \n } proc fget {path} { fileutil::cat $path } + +proc fgetc {path enc} { fileutil::cat -encoding $enc $path } proc strip-gc-comments {lines} { lmap line $lines { if {[string match {*GC comment*} $line]} continue set line