Parse_CspCASL.hs revision 8267b99c0d7a187abe6f87ad50530dc08f5d1cdc
8a77240a809197c92c0736c431b4b88947a7bac1Christian Maeder{- |
8a77240a809197c92c0736c431b4b88947a7bac1Christian MaederModule : $Id$
6ea54752d184beb92c92fbae17ae9f7dd065d988Christian MaederCopyright : (c)
306763c67bb99228487345b32ab8c5c6cd41f23cChristian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
3a6c7a7ff823616f56cd3d205fc44664a683effdChristian Maeder
6ea54752d184beb92c92fbae17ae9f7dd065d988Christian MaederMaintainer : a.m.gimblett@swan.ac.uk
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuStability : experimental
2eeec5240b424984e3ee26296da1eeab6c6d739eChristian MaederPortability :
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder
306763c67bb99228487345b32ab8c5c6cd41f23cChristian MaederParser for CSP-CASL specifications.
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder
9f87aabedf02d74917d94fe1ac0300e07d3d4bc2Christian Maeder-}
44fb55f639914f4f531641f32dd4904f15c510a4Till Mossakowski
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowskimodule CspCASL.Parse_CspCASL (
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski basicCspCaslSpec, dataDefn
af0cbe339851fc558d2b18cde3666981325e667cTill Mossakowski) where
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowskiimport Text.ParserCombinators.Parsec
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maederimport CASL.Parse_AS_Basic (basicSpec)
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maederimport Common.AnnoState (AParser, asKey)
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maederimport Common.Keywords (endS)
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maederimport CspCASL.AS_CspCASL
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maederimport CspCASL.AS_CspCASL_Process
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maederimport CspCASL.CspCASL_Keywords
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maederimport CspCASL.Parse_CspCASL_Process (csp_casl_process)
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian MaederbasicCspCaslSpec :: AParser st BASIC_CSP_CASL_SPEC
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder-- The following is horrible, since if the spec _does_ end with "end",
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder-- it'll be parsed twice, the first time failing. Alas, the more
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder-- sensible version (afterwards, commented out), doesn't work, and I
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder-- don't know why not.
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian MaederbasicCspCaslSpec = try (do asKey dataS
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder d <- dataDefn
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder asKey processS
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder p <- csp_casl_process
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder eof
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder return (Basic_Csp_Casl_Spec d p)
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder )
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder <|> (do asKey dataS
1bc5dccbf0083a620ae1181c717fea75e4af5e5cChristian Maeder d <- dataDefn
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski asKey processS
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski p <- csp_casl_process
922819b1c2d383a0fa5d70e1c4aa76667e2f1ca3Christian Maeder (asKey endS)
63324a97283728a30932828a612c7b0b0f687624Christian Maeder eof
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder return (Basic_Csp_Casl_Spec d p)
19298cbfd6ee2abd904f3181af7760b965b822c3Christian Maeder )
9f87aabedf02d74917d94fe1ac0300e07d3d4bc2Christian Maeder
9f87aabedf02d74917d94fe1ac0300e07d3d4bc2Christian Maeder-- Hmmm, well, if this is the broken version, I'm not surprised. The
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder-- try should be around endS, not eof.
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder--
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder--cspCaslSpec = do asKey dataS
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder-- d <- dataDefn
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder-- asKey processS
27166b063721ef1a2efd8f00ab3d9bc820b315fbChristian Maeder-- p <- processDefn
63324a97283728a30932828a612c7b0b0f687624Christian Maeder-- (asKey endS)
556f473448dfcceee22afaa89ed7a364489cdbbbChristian Maeder-- (try eof)
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski-- return (Csp_Casl_Spec d p)
59fa9b1349ae1e001d996da732c4ac805c2938e2Christian Maeder
e9249d3ecd51a2b6a966a58669953e58d703adc6Till MossakowskidataDefn :: AParser st DATA_DEFN
e9249d3ecd51a2b6a966a58669953e58d703adc6Till MossakowskidataDefn = do d <- basicSpec csp_casl_keywords
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski return (Spec d)
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski
53310804002cd9e3c9c5844db3b984abcf001788Christian MaederprocessDefn :: AParser st PROCESS
e9249d3ecd51a2b6a966a58669953e58d703adc6Till MossakowskiprocessDefn = do p <- csp_casl_process
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski return p
e9249d3ecd51a2b6a966a58669953e58d703adc6Till Mossakowski