# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*- # -- Tcl Module # @@ Meta Begin # Package pt::peg::export::peg 1 # Meta as::build::date 2015-05-25 # Meta as::origin http://sourceforge.net/projects/tcllib # Meta category Parser Tools # Meta description PEG Export Plugin. Write PEG format # Meta license BSD # Meta platform tcl # Meta require {Tcl 8.5} # Meta require pt::peg::to::peg # Meta subject expression {push down automaton} state EBNF # Meta subject {context-free languages} matching PEG TDPL # Meta subject {parsing expression} parser serialization # Meta subject {recursive descent} grammar export transducer # Meta subject {top-down parsing languages} # Meta subject {parsing expression grammar} LL(k) plugin # Meta summary pt::peg::export::peg # @@ Meta End # ACTIVESTATE TEAPOT-PKG BEGIN REQUIREMENTS package require Tcl 8.5 package require pt::peg::to::peg # ACTIVESTATE TEAPOT-PKG END REQUIREMENTS # ACTIVESTATE TEAPOT-PKG BEGIN DECLARE package provide pt::peg::export::peg 1 # ACTIVESTATE TEAPOT-PKG END DECLARE # ACTIVESTATE TEAPOT-PKG END TM # peg_to_export.tcl -- # # The PEG to PEG (text representation) export plugin. Generation # of plain text. # # Copyright (c) 2009 Andreas Kupries # # 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