summaryrefslogtreecommitdiff
path: root/module/css.m
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /module/css.m
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'module/css.m')
-rw-r--r--module/css.m88
1 files changed, 88 insertions, 0 deletions
diff --git a/module/css.m b/module/css.m
new file mode 100644
index 00000000..3c72d06f
--- /dev/null
+++ b/module/css.m
@@ -0,0 +1,88 @@
+#
+# CSS parsing module
+#
+# CSS2.1 style sheets
+#
+# Copyright © 2001, 2005 Vita Nuova Holdings Limited. All rights reserved.
+#
+CSS: module
+{
+ PATH: con "/dis/lib/w3c/css.dis";
+
+ Stylesheet: adt {
+ charset: string;
+ imports: list of ref Import;
+ statements: list of ref Statement;
+ };
+
+ Import: adt {
+ name: string;
+ media: list of string;
+ };
+
+ Statement: adt {
+ pick{
+ Media =>
+ media: list of string;
+ rules: list of ref Statement.Ruleset;
+ Page =>
+ pseudo: string;
+ decls: list of ref Decl;
+ Ruleset =>
+ selectors: list of Selector;
+ decls: list of ref Decl;
+ }
+ };
+
+ Decl: adt {
+ property: string;
+ values: list of ref Value;
+ important: int;
+ };
+
+ Selector: type list of (int, Simplesel); # int is combinator from [ >+]
+ Simplesel: type list of ref Select;
+
+ Select: adt {
+ name: string;
+ pick{
+ Element or ID or Any or Class or Pseudo =>
+ Attrib =>
+ op: string; # "=" "~=" "|="
+ value: ref Value; # optional Ident or String
+ Pseudofn =>
+ arg: string;
+ }
+ };
+
+ Value: adt {
+ sep: int; # which operator of [ ,/] preceded this value in list
+ pick{
+ String or
+ Number or
+ Percentage or
+ Url or
+ Unicoderange =>
+ value: string;
+ Hexcolour =>
+ value: string; # as given
+ rgb: (int, int, int); # converted
+ RGB =>
+ args: cyclic list of ref Value; # as given
+ rgb: (int, int, int); # converted
+ Ident =>
+ name: string;
+ Unit =>
+ value: string; # int or float
+ units: string; # suffix giving units ("cm", "khz", and so on, always lower case)
+ Function =>
+ name: string;
+ args: cyclic list of ref Value;
+ }
+ };
+
+ init: fn(diag: int);
+ parse: fn(s: string): (ref Stylesheet, string);
+ parsedecl: fn(s: string): (list of ref Decl, string);
+# unescape: fn(s: string): string;
+};