File: pt_peg_export_peg.tcl

package info (click to toggle)
tcllib 1.16-dfsg-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,040 kB
  • ctags: 18,603
  • sloc: tcl: 156,708; ansic: 14,098; sh: 10,783; xml: 1,766; yacc: 1,114; pascal: 551; makefile: 89; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (51 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# peg_to_export.tcl --
#
#	The PEG to PEG (text representation) export plugin. Generation
#	of plain text.
#
# Copyright (c) 2009 Andreas Kupries <andreas_kupries@sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# RCS: @(#) $Id: pt_peg_export_peg.tcl,v 1.1 2010/03/26 05:07:24 andreas_kupries Exp $

# This package is a plugin for the pt::peg export manager.  It
# takes the canonical serialization of a parsing expression grammar
# and produces the corresponding human readable text representation.

# ### ### ### ######### ######### #########
## Requisites

# @mdgen NODEP: pt::peg::export::plugin

package  require Tcl 8.5
package  require pt::peg::export::plugin ; # The presence of this
						# pseudo package
						# indicates execution
						# inside of a properly
						# initialized plugin
						# interpreter.
package require pt::peg::to::peg

# ### ### ### ######### ######### #########
## API.

proc export {serial configuration} {

    pt::peg::to::peg reset
    foreach {option value} $configuration {
	pt::peg::to::peg configure $option $value
    }

    set text [pt::peg::to::peg convert $serial]

    pt::peg::to::peg reset
    return $text
}

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

package provide pt::peg::export::peg 1
return