Tcl Library Source Code

Check-in [10d94706b2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:pt::pe - Added constructors for explicit char-classes and strings. Version bumped to 1.0.2.
Timelines: family | ancestors | descendants | both | pt-work
Files: files | file ages | folders
SHA1: 10d94706b2eeb3ad12c55d897995daf7a6ef95a1
User & Date: aku 2014-06-27 05:55:34
Context
2014-06-27
05:57
char - Reworked the internals to be more useful. Fixed the internals docs. Added testsuite. Version bumped to 1.0.1. check-in: 5d0a671a78 user: aku tags: pt-work
05:55
pt::pe - Added constructors for explicit char-classes and strings. Version bumped to 1.0.2. check-in: 10d94706b2 user: aku tags: pt-work
2014-06-26
23:27
Added lots of test cases going over characters special to PEG, Tcl, and C. Currently mainly failing due to bogus handling in the various generators. The layers of quoting need some sorting. check-in: 74769ab5c0 user: aku tags: pt-work
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/pt/pkgIndex.tcl.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ifneeded pt::ast     1.1 [list source [file join $dir pt_astree.tcl]]

# General parser support. Currently only conversion of structured
# syntax errors (or parts thereof) into a human-readable form.
package ifneeded pt::util    1   [list source [file join $dir pt_util.tcl]]

# Parsing Expression support
package ifneeded pt::pe        1.0.1 [list source [file join $dir pt_pexpression.tcl]]
package ifneeded pt::pe::op        1 [list source [file join $dir pt_pexpr_op.tcl]]

# Parsing Expression Grammar support.
package ifneeded pt::peg                1 [list source [file join $dir pt_pegrammar.tcl]]
package ifneeded pt::peg::container     1 [list source [file join $dir pt_peg_container.tcl]]
package ifneeded pt::peg::interp    1.0.1 [list source [file join $dir pt_peg_interp.tcl]]
package ifneeded pt::peg::op        1.0.1 [list source [file join $dir pt_peg_op.tcl]]







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ifneeded pt::ast     1.1 [list source [file join $dir pt_astree.tcl]]

# General parser support. Currently only conversion of structured
# syntax errors (or parts thereof) into a human-readable form.
package ifneeded pt::util    1   [list source [file join $dir pt_util.tcl]]

# Parsing Expression support
package ifneeded pt::pe        1.0.2 [list source [file join $dir pt_pexpression.tcl]]
package ifneeded pt::pe::op        1 [list source [file join $dir pt_pexpr_op.tcl]]

# Parsing Expression Grammar support.
package ifneeded pt::peg                1 [list source [file join $dir pt_pegrammar.tcl]]
package ifneeded pt::peg::container     1 [list source [file join $dir pt_peg_container.tcl]]
package ifneeded pt::peg::interp    1.0.1 [list source [file join $dir pt_peg_interp.tcl]]
package ifneeded pt::peg::op        1.0.1 [list source [file join $dir pt_peg_op.tcl]]

Changes to modules/pt/pt_pexpression.tcl.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
	verify verify-as-canonical canonicalize \
	bottomup topdown print equal \
	\
	epsilon dot alnum alpha ascii digit graph lower printable \
	control punct space upper wordchar xdigit ddigit \
	nonterminal optional repeat0 repeat1 ahead notahead \
	choice sequence \
	terminal range

    namespace ensemble create
}

# # ## ### ##### ######## #############
## Public API








|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
	verify verify-as-canonical canonicalize \
	bottomup topdown print equal \
	\
	epsilon dot alnum alpha ascii digit graph lower printable \
	control punct space upper wordchar xdigit ddigit \
	nonterminal optional repeat0 repeat1 ahead notahead \
	choice sequence \
	terminal range class str

    namespace ensemble create
}

# # ## ### ##### ######## #############
## Public API

238
239
240
241
242
243
244
245


246
247
248
249
250
251














252
253
254
255
256
257
258
proc ::pt::pe::repeat1     {pe} { list + $pe }
proc ::pt::pe::ahead       {pe} { list & $pe }
proc ::pt::pe::notahead    {pe} { list ! $pe }

proc ::pt::pe::choice   {pe args} { linsert $args 0 / $pe }
proc ::pt::pe::sequence {pe args} { linsert $args 0 x $pe }

proc ::pt::pe::terminal {t}     { list t $t }


proc ::pt::pe::range    {ta tb} {
    if {$ta eq $tb} {
	list t $ta
    } else {
	list .. $ta $tb
    }














}

namespace eval ::pt::pe {
    # # ## ### ##### ######## #############
    ## Strings for error messages.

    variable ourprefix    "error in serialization:"







|
>
>
|





>
>
>
>
>
>
>
>
>
>
>
>
>
>







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
proc ::pt::pe::repeat1     {pe} { list + $pe }
proc ::pt::pe::ahead       {pe} { list & $pe }
proc ::pt::pe::notahead    {pe} { list ! $pe }

proc ::pt::pe::choice   {pe args} { linsert $args 0 / $pe }
proc ::pt::pe::sequence {pe args} { linsert $args 0 x $pe }

proc ::pt::pe::terminal {t} {
    list t $t
}
proc ::pt::pe::range {ta tb} {
    if {$ta eq $tb} {
	list t $ta
    } else {
	list .. $ta $tb
    }
}
proc ::pt::pe::class {set} {
    if {[string length $set] > 1} {
	list cl $set
    } else {
	list t $set
    }
}
proc ::pt::pe::str {str} {
    if {[string length $str] > 1} {
	list str $str
    } else {
	list t $str
    }
}

namespace eval ::pt::pe {
    # # ## ### ##### ######## #############
    ## Strings for error messages.

    variable ourprefix    "error in serialization:"
297
298
299
300
301
302
303
304
305
    ##
    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide pt::pe 1.0.1
return







|

313
314
315
316
317
318
319
320
321
    ##
    # # ## ### ##### ######## #############
}

# # ## ### ##### ######## ############# #####################
## Ready

package provide pt::pe 1.0.2
return