Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mincss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
mincss
Commits
aaaf2601
Commit
aaaf2601
authored
Jul 24, 2014
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed support for @-<prefix>-keyframes syntax
parent
94a36e40
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
16 deletions
+18
-16
lexer.mll
lexer.mll
+2
-3
parser.mly
parser.mly
+4
-4
stringify.ml
stringify.ml
+8
-5
types.ml
types.ml
+2
-2
util.ml
util.ml
+2
-2
No files found.
lexer.mll
View file @
aaaf2601
...
...
@@ -81,8 +81,6 @@ let X = ['x' 'X']
let Y = ['y' 'Y']
let Z = ['z' 'Z']
let uagent = ('-' ("
webkit
" | "
moz
" | "
ms
" | "
o
") '-')?
rule token = parse
| "
\
r
\
n
" | '
\r
' | '
\n
' { new_line lexbuf; S }
...
...
@@ -105,8 +103,9 @@ rule token = parse
| "
@
charset
" { CHARSET_SYM }
| '@' F O N T '-' F A C E { FONT_FACE_SYM }
| '@' N A M E S P A C E { NAMESPACE_SYM }
| '@' uagent K E Y F R A M E S { KEYFRAMES_SYM }
| '@' S U P P O R T S { SUPPORTS_SYM }
| '@' (('-' ident '-')? as prefix) K E Y F R A M E S
{ KEYFRAMES_SYM (String.lowercase prefix) }
| (s | comment)* s comment* A N D comment* s (s | comment)*
{ advance_pos lexbuf; WS_AND }
...
...
parser.mly
View file @
aaaf2601
...
...
@@ -41,10 +41,10 @@
(* Tokens *)
%
token
S
CDO
CDC
IMPORT_SYM
PAGE_SYM
MEDIA_SYM
CHARSET_SYM
FONT_FACE_SYM
%
token
NAMESPACE_SYM
KEYFRAMES_SYM
SUPPORTS_SYM
IMPORTANT_SYM
%
token
NAMESPACE_SYM
SUPPORTS_SYM
IMPORTANT_SYM
%
token
<
float
>
PERCENTAGE
NUMBER
%
token
<
float
*
string
>
UNIT_VALUE
%
token
<
string
>
COMBINATOR
RELATION
STRING
IDENT
HASH
URI
FUNCTION
%
token
<
string
>
KEYFRAMES_SYM
COMBINATOR
RELATION
STRING
IDENT
HASH
URI
FUNCTION
%
token
LPAREN
RPAREN
LBRACE
RBRACE
LBRACK
RBRACK
SEMICOL
COLON
COMMA
DOT
PLUS
%
token
MINUS
SLASH
STAR
ONLY
AND
(*OR*)
NOT
FROM
TO
EOF
%
token
WS_AND
WS_OR
...
...
@@ -141,8 +141,8 @@ descriptor_declaration:
{
(
name
,
value
)
}
keyframes_rule
:
|
KEYFRAMES_SYM
S
*
id
=
IDENT
S
*
LBRACE
S
*
rules
=
keyframe_ruleset
*
RBRACE
S
*
{
Keyframes
(
id
,
rules
)
}
|
pre
=
KEYFRAMES_SYM
S
*
id
=
IDENT
S
*
LBRACE
S
*
rules
=
keyframe_ruleset
*
RBRACE
S
*
{
Keyframes
(
pre
,
id
,
rules
)
}
keyframe_ruleset
:
|
selector
=
keyframe_selector
S
*
decls
=
decls_block
{
(
selector
,
decls
)
}
...
...
stringify.ml
View file @
aaaf2601
...
...
@@ -110,11 +110,12 @@ let rec string_of_statement = function
"@namespace "
^
string_of_expr
uri
^
";"
|
Namespace
(
Some
prefix
,
uri
)
->
"@namespace "
^
prefix
^
" "
^
string_of_expr
uri
^
";"
|
Keyframes
(
id
,
rules
)
->
|
Keyframes
(
prefix
,
id
,
rules
)
->
let
string_of_keyframe_ruleset
(
expr
,
decls
)
=
string_of_expr
expr
^
block
(
cat
"
\n
"
string_of_declaration
decls
)
in
"@keyframes "
^
id
^
block
(
cat
"
\n\n
"
string_of_keyframe_ruleset
rules
)
"@"
^
prefix
^
"keyframes "
^
id
^
block
(
cat
"
\n\n
"
string_of_keyframe_ruleset
rules
)
|
Supports
(
condition
,
statements
)
->
"@supports "
^
stringify_condition
" "
condition
^
block
(
cat
"
\n\n
"
string_of_statement
statements
)
...
...
@@ -165,7 +166,8 @@ let rec minify_statement = function
|
Import
(
target
,
[]
)
->
"@import "
^
string_of_expr
target
^
";"
|
Import
(
target
,
queries
)
->
"@import "
^
string_of_expr
target
^
" "
^
cat
","
string_of_media_query
queries
^
";"
"@import "
^
string_of_expr
target
^
" "
^
cat
","
string_of_media_query
queries
^
";"
|
Page
(
None
,
decls
)
->
"@page{"
^
cat
";"
minify_declaration
decls
^
"}"
|
Page
(
Some
pseudo
,
decls
)
->
...
...
@@ -175,11 +177,12 @@ let rec minify_statement = function
name
^
":"
^
string_of_expr
value
in
"@font-face{"
^
cat
";"
minify_descriptor_declaration
decls
^
"}"
|
Keyframes
(
id
,
rules
)
->
|
Keyframes
(
prefix
,
id
,
rules
)
->
let
minify_keyframe_ruleset
(
expr
,
decls
)
=
minify_expr
expr
^
"{"
^
cat
";"
minify_declaration
decls
^
"}"
in
"@keyframes "
^
id
^
"{"
^
cat
""
minify_keyframe_ruleset
rules
^
"}"
"@"
^
prefix
^
"keyframes "
^
id
^
"{"
^
cat
""
minify_keyframe_ruleset
rules
^
"}"
|
Supports
(
condition
,
statements
)
->
"@supports "
^
stringify_condition
""
condition
^
"{"
^
cat
""
minify_statement
statements
^
"}"
...
...
types.ml
View file @
aaaf2601
...
...
@@ -46,8 +46,8 @@ type statement =
(* @font-face { <declarations> } *)
|
Namespace
of
string
option
*
expr
(* @namespace [<prefix>] "<uri>"; *)
|
Keyframes
of
string
*
keyframe_ruleset
list
(* @keyframes <id> { <rulesets> } *)
|
Keyframes
of
string
*
string
*
keyframe_ruleset
list
(* @
[-<prefix>-]
keyframes <id> { <rulesets> } *)
|
Supports
of
condition
*
statement
list
(* @supports <condition> { <rulesets> } *)
...
...
util.ml
View file @
aaaf2601
...
...
@@ -203,9 +203,9 @@ let transform_stylesheet f stylesheet =
|
Namespace
(
prefix
,
uri
)
->
let
uri
=
expect_expr
uri
in
f
(
Statement
(
Namespace
(
prefix
,
uri
)))
|
Keyframes
(
id
,
rules
)
->
|
Keyframes
(
prefix
,
id
,
rules
)
->
let
rules
=
trav_all_keyframe_ruleset
rules
in
f
(
Statement
(
Keyframes
(
id
,
rules
)))
f
(
Statement
(
Keyframes
(
prefix
,
id
,
rules
)))
|
Supports
(
condition
,
statements
)
->
let
condition
=
expect_condition
condition
in
let
statements
=
trav_all_statement
statements
in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment