]> gitweb.factorcode.org Git - factor.git/blob - basis/html/templates/chloe/syntax/syntax.factor
Fixing conflicts from stack checker changes
[factor.git] / basis / html / templates / chloe / syntax / syntax.factor
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: html.templates.chloe.syntax
4 USING: accessors kernel sequences combinators kernel namespaces
5 classes.tuple assocs splitting words arrays memoize parser lexer
6 io io.files io.encodings.utf8 io.streams.string
7 unicode.case mirrors fry math urls
8 multiline xml xml.data xml.writer xml.syntax
9 html.components
10 html.templates ;
11
12 SYMBOL: tags
13
14 tags [ H{ } clone ] initialize
15
16 : define-chloe-tag ( name quot -- ) swap tags get set-at ;
17
18 : CHLOE:
19     scan parse-definition define-chloe-tag ; parsing
20
21 CONSTANT: chloe-ns "http://factorcode.org/chloe/1.0"
22
23 : chloe-name? ( name -- ? )
24     url>> chloe-ns = ;
25
26 XML-NS: chloe-name http://factorcode.org/chloe/1.0
27
28 : required-attr ( tag name -- value )
29     [ nip ] [ chloe-name attr ] 2bi
30     [ ] [ " attribute is required" append throw ] ?if ;
31
32 : optional-attr ( tag name -- value )
33     chloe-name attr ;