Commit 885da523 authored by david_v's avatar david_v
Browse files

2003-07-16 Valentin David <valentin@lrde.epita.fr>

	* src/xtc/det-gen.str, src/detgen/detgen.str: Add new options to
	specify markup style.

	* README: Update.
parent 055b5c1a
2003-07-16 Valentin David <valentin@lrde.epita.fr>
* src/xtc/det-gen.str, src/detgen/detgen.str: Add new options to
specify markup style.
* README: Update.
2003-06-20 Valentin David <valentin@lrde.epita.fr>
* src/xtc/parse-detboxedsdf.str,
......
......@@ -39,6 +39,14 @@ exports
%% will give determi:
%% ".*.[a].*." "::" Foo ".*.[!a].*." -> Bar
%% {pp(H hs=0[KW[".*.[a].*."] KW["::"] _1 KW[".*.[!a].*."]]), cons("a")}
%% but you can fix the non-terminal symbol to add the markups to:
"blah" Foo "(" Body ")" -> Bar {dettag("c",1), cons("c")}
Own marks-up
------------
You can specify to "det-gen" and "detgen" --begin and --end options so as to
set mark-up style.
If you want to have xml style marks-up, you can use --begin "<%>" --end "</%>".
......@@ -27,6 +27,8 @@ imports lib DetBoxedSdf sdf-2-pp-lib
signature
constructors
Import : String -> Option
Begin : String -> Option
End : String -> Option
strategies
......@@ -36,10 +38,22 @@ strategies
*/
import-option =
ArgOption("-m" + "--import"
, where(<set-config> ("-c",<id>)); !Import(<id>)
, where(<set-config> ("-m",<id>)); !Import(<id>)
, !"-m n|--import n Generated module will import n"
)
begin-option =
ArgOption("-b" + "--begin"
, where(<set-config> ("-b",<id>)); !Begin(<id>)
, !"-b s|--begin s Use s as begin markup"
)
end-option =
ArgOption("-e" + "--end"
, where(<set-config> ("-e",<id>)); !End(<id>)
, !"-e s|--end s Use s as end markup"
)
rules
......@@ -69,7 +83,7 @@ rules
* This rule generates a begin tag.
*/
ToBegin : lit -> lit'
where <concat-strings> ["[", lit, "]"]
where <Beginize> lit
; ToLayout
; double-quote => lit'
......@@ -79,7 +93,7 @@ rules
* This rule generates a end tag.
*/
ToEnd : lit -> lit'
where <concat-strings> ["[!", lit, "]"]
where <Endize> lit
; ToLayout
; double-quote => lit'
......@@ -175,9 +189,36 @@ strategies
; concat
; !Module("Det",[],[Exports(context-free-syntax(<id>))])
cut-string =
explode-string
; ?s
; drop-until(37)
; Tl
; ?s2
; !s
; take-until(37)
; !(<implode-string>, <implode-string> s2)
detgen = iowrap(
(id, det-gen-prods)
(option-defined(Begin(?b))
; where(
!b
; cut-string => (bb,eb)
; rules(Beginize : l -> <concat-strings> [bb, l, eb])
)
<+
rules(Beginize : l -> <concat-strings> ["[", l, "]"])
,id)
; (option-defined(End(?e))
; where(
!e
; cut-string => (be,ee)
; rules(Endize : l -> <concat-strings> [be, l, ee])
)
<+ rules(Endize : l -> <concat-strings> ["[", l, "]"])
,id)
; (id, det-gen-prods)
; try((option-defined(Import(?imp)), id)
; (id,Module(?name; <concat-strings> [name, imp]
,![Imports([imp])],id)))
, import-option)
, import-option + begin-option + end-option)
......@@ -27,11 +27,13 @@ imports xtc-lib stratego-xt-xtc-tools
strategies
det-gen =
xtc-io-wrap(import-option,
xtc-io-wrap(import-option + begin-option + end-option,
xtc-transform(!"parse-detboxedsdf")
; ((where(<get-config> "-m")
; try(xtc-transform(!"detgen", !["-m", <get-config> "-m"])))
<+ xtc-transform(!"detgen"))
; xtc-transform(!"detgen",
<table-getlist> "config"
; filter(("-m" + "-b" + "-e", id)
; TupleToList)
; concat)
; xtc-transform(!"pp-boxedsdf")
)
......@@ -41,3 +43,14 @@ strategies
, !"-m n|--import n Generated module will import n"
)
begin-option =
ArgOption("-b" + "--begin"
, where(<set-config> ("-b",<id>))
, !"-b s|--begin s Use s as begin markup"
)
end-option =
ArgOption("-e" + "--end"
, where(<set-config> ("-e",<id>))
, !"-e s|--end s Use s as end markup"
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment