1# peg_to_export.tcl -- 2# 3# The PEG to PEG (text representation) export plugin. Generation 4# of plain text. 5# 6# Copyright (c) 2009 Andreas Kupries <andreas_kupries@sourceforge.net> 7# 8# See the file "license.terms" for information on usage and redistribution 9# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 10# 11# RCS: @(#) $Id: pt_peg_export_peg.tcl,v 1.1 2010/03/26 05:07:24 andreas_kupries Exp $ 12 13# This package is a plugin for the pt::peg export manager. It 14# takes the canonical serialization of a parsing expression grammar 15# and produces the corresponding human readable text representation. 16 17# ### ### ### ######### ######### ######### 18## Requisites 19 20# @mdgen NODEP: pt::peg::export::plugin 21 22package require Tcl 8.5 23package require pt::peg::export::plugin ; # The presence of this 24 # pseudo package 25 # indicates execution 26 # inside of a properly 27 # initialized plugin 28 # interpreter. 29package require pt::peg::to::peg 30 31# ### ### ### ######### ######### ######### 32## API. 33 34proc export {serial configuration} { 35 36 pt::peg::to::peg reset 37 foreach {option value} $configuration { 38 pt::peg::to::peg configure $option $value 39 } 40 41 set text [pt::peg::to::peg convert $serial] 42 43 pt::peg::to::peg reset 44 return $text 45} 46 47# ### ### ### ######### ######### ######### 48## Ready 49 50package provide pt::peg::export::peg 1 51return 52