frontsau 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/frontsau +15 -0
- data/bin/frontsau-phaml-compiler +35 -0
- data/example/.frontsau +12 -0
- data/example/assets/head.jpg +0 -0
- data/example/assets/script.js +4 -0
- data/example/assets/style.css +6 -0
- data/example/css/includes.sass +2 -0
- data/example/css/style.sass +6 -0
- data/example/image/head.jpg +0 -0
- data/example/index.html +0 -0
- data/example/js/script.coffee +1 -0
- data/frontsau.gemspec +41 -0
- data/lib/Phamlp/Phamlp.php +72 -0
- data/lib/Phamlp/PhamlpException.php +31 -0
- data/lib/Phamlp/haml/HamlException.php +29 -0
- data/lib/Phamlp/haml/HamlHelpers.php +199 -0
- data/lib/Phamlp/haml/HamlParser.php +1250 -0
- data/lib/Phamlp/haml/filters/HamlBaseFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlCdataFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlCssFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlEscapedFilter.php +32 -0
- data/lib/Phamlp/haml/filters/HamlJavascriptFilter.php +31 -0
- data/lib/Phamlp/haml/filters/HamlPhpFilter.php +27 -0
- data/lib/Phamlp/haml/filters/HamlPlainFilter.php +28 -0
- data/lib/Phamlp/haml/filters/HamlPreserveFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlSassFilter.php +37 -0
- data/lib/Phamlp/haml/filters/HamlScssFilter.php +37 -0
- data/lib/Phamlp/haml/filters/_HamlMarkdownFilter.php +50 -0
- data/lib/Phamlp/haml/filters/_HamlTextileFilter.php +50 -0
- data/lib/Phamlp/haml/messages/_i18n.php +32 -0
- data/lib/Phamlp/haml/messages/de.php +32 -0
- data/lib/Phamlp/haml/messages/fr.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompactRenderer.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompressedRenderer.php +48 -0
- data/lib/Phamlp/haml/renderers/HamlExpandedRenderer.php +58 -0
- data/lib/Phamlp/haml/renderers/HamlNestedRenderer.php +77 -0
- data/lib/Phamlp/haml/renderers/HamlRenderer.php +137 -0
- data/lib/Phamlp/haml/tree/HamlCodeBlockNode.php +58 -0
- data/lib/Phamlp/haml/tree/HamlCommentNode.php +41 -0
- data/lib/Phamlp/haml/tree/HamlDoctypeNode.php +27 -0
- data/lib/Phamlp/haml/tree/HamlElementNode.php +52 -0
- data/lib/Phamlp/haml/tree/HamlFilterNode.php +50 -0
- data/lib/Phamlp/haml/tree/HamlHelperNode.php +73 -0
- data/lib/Phamlp/haml/tree/HamlNode.php +253 -0
- data/lib/Phamlp/haml/tree/HamlNodeExceptions.php +19 -0
- data/lib/Phamlp/haml/tree/HamlRootNode.php +58 -0
- data/lib/Phamlp/sass/SassException.php +29 -0
- data/lib/Phamlp/sass/SassFile.php +164 -0
- data/lib/Phamlp/sass/SassParser.php +848 -0
- data/lib/Phamlp/sass/extensions/compass/config.php +65 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/_blueprint.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +101 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_colors.scss +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_debug.scss +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +86 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_form.scss +68 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_grid.scss +249 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_ie.scss +109 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +57 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +147 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_print.scss +93 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +54 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_typography.scss +104 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +58 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/ie.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/print.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/screen.sass +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/manifest.rb +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/manifest.rb +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/print.sass +8 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/screen.sass +45 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/manifest.rb +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_form.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_page.sass +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_two_col.sass +38 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/print.sass +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/screen.sass +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_gradient.scss +82 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/ellipsis.sass +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/manifest.rb +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/manifest.rb +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/stylesheets/main.sass +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/screen.sass +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/USAGE.markdown +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/ie.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/manifest.rb +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/print.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/screen.sass +7 -0
- data/lib/Phamlp/sass/extensions/compass/functions/colourStops.php +268 -0
- data/lib/Phamlp/sass/extensions/compass/functions/constants.php +44 -0
- data/lib/Phamlp/sass/extensions/compass/functions/fontFiles.php +30 -0
- data/lib/Phamlp/sass/extensions/compass/functions/imageSize.php +39 -0
- data/lib/Phamlp/sass/extensions/compass/functions/inlineData.php +84 -0
- data/lib/Phamlp/sass/extensions/compass/functions/lists.php +47 -0
- data/lib/Phamlp/sass/extensions/compass/functions/selectors.php +128 -0
- data/lib/Phamlp/sass/extensions/compass/functions/urls.php +143 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_gradient.scss +96 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/messages/_i18n.php +122 -0
- data/lib/Phamlp/sass/messages/de.php +70 -0
- data/lib/Phamlp/sass/messages/fr.php +70 -0
- data/lib/Phamlp/sass/renderers/SassCompactRenderer.php +130 -0
- data/lib/Phamlp/sass/renderers/SassCompressedRenderer.php +102 -0
- data/lib/Phamlp/sass/renderers/SassExpandedRenderer.php +62 -0
- data/lib/Phamlp/sass/renderers/SassNestedRenderer.php +61 -0
- data/lib/Phamlp/sass/renderers/SassRenderer.php +51 -0
- data/lib/Phamlp/sass/script/SassScriptFunction.php +169 -0
- data/lib/Phamlp/sass/script/SassScriptFunctions.php +751 -0
- data/lib/Phamlp/sass/script/SassScriptLexer.php +114 -0
- data/lib/Phamlp/sass/script/SassScriptOperation.php +151 -0
- data/lib/Phamlp/sass/script/SassScriptParser.php +192 -0
- data/lib/Phamlp/sass/script/SassScriptParserExceptions.php +40 -0
- data/lib/Phamlp/sass/script/SassScriptVariable.php +57 -0
- data/lib/Phamlp/sass/script/literals/SassBoolean.php +67 -0
- data/lib/Phamlp/sass/script/literals/SassColour.php +886 -0
- data/lib/Phamlp/sass/script/literals/SassLiteral.php +359 -0
- data/lib/Phamlp/sass/script/literals/SassLiteralExceptions.php +47 -0
- data/lib/Phamlp/sass/script/literals/SassNumber.php +503 -0
- data/lib/Phamlp/sass/script/literals/SassString.php +106 -0
- data/lib/Phamlp/sass/tree/SassCommentNode.php +64 -0
- data/lib/Phamlp/sass/tree/SassContext.php +120 -0
- data/lib/Phamlp/sass/tree/SassDebugNode.php +84 -0
- data/lib/Phamlp/sass/tree/SassDirectiveNode.php +76 -0
- data/lib/Phamlp/sass/tree/SassElseNode.php +28 -0
- data/lib/Phamlp/sass/tree/SassExtendNode.php +47 -0
- data/lib/Phamlp/sass/tree/SassForNode.php +99 -0
- data/lib/Phamlp/sass/tree/SassIfNode.php +95 -0
- data/lib/Phamlp/sass/tree/SassImportNode.php +69 -0
- data/lib/Phamlp/sass/tree/SassMixinDefinitionNode.php +88 -0
- data/lib/Phamlp/sass/tree/SassMixinNode.php +91 -0
- data/lib/Phamlp/sass/tree/SassNode.php +342 -0
- data/lib/Phamlp/sass/tree/SassNodeExceptions.php +117 -0
- data/lib/Phamlp/sass/tree/SassPropertyNode.php +239 -0
- data/lib/Phamlp/sass/tree/SassRootNode.php +100 -0
- data/lib/Phamlp/sass/tree/SassRuleNode.php +337 -0
- data/lib/Phamlp/sass/tree/SassVariableNode.php +90 -0
- data/lib/Phamlp/sass/tree/SassWhileNode.php +64 -0
- data/lib/frontsau/assets/rack.rb +12 -0
- data/lib/frontsau/assets/sprockets.rb +59 -0
- data/lib/frontsau/assets/static_assets_compiler.rb +50 -0
- data/lib/frontsau/assets/url_rewriter.rb +22 -0
- data/lib/frontsau/assets/watcher.rb +60 -0
- data/lib/frontsau/thor_app.rb +118 -0
- data/lib/frontsau/version.rb +3 -0
- data/lib/frontsau.rb +64 -0
- metadata +578 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassScriptLexer.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassScriptLexer class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
require_once('literals/SassBoolean.php');
|
|
13
|
+
require_once('literals/SassColour.php');
|
|
14
|
+
require_once('literals/SassNumber.php');
|
|
15
|
+
require_once('literals/SassString.php');
|
|
16
|
+
require_once('SassScriptFunction.php');
|
|
17
|
+
require_once('SassScriptOperation.php');
|
|
18
|
+
require_once('SassScriptVariable.php');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SassScriptLexer class.
|
|
22
|
+
* Lexes SassSCript into tokens for the parser.
|
|
23
|
+
*
|
|
24
|
+
* Implements a {@link http://en.wikipedia.org/wiki/Shunting-yard_algorithm Shunting-yard algorithm} to provide {@link http://en.wikipedia.org/wiki/Reverse_Polish_notation Reverse Polish notation} output.
|
|
25
|
+
* @package PHamlP
|
|
26
|
+
* @subpackage Sass.script
|
|
27
|
+
*/
|
|
28
|
+
class SassScriptLexer {
|
|
29
|
+
const MATCH_WHITESPACE = '/^\s+/';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @var SassScriptParser the parser object
|
|
33
|
+
*/
|
|
34
|
+
private $parser;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* SassScriptLexer constructor.
|
|
38
|
+
* @return SassScriptLexer
|
|
39
|
+
*/
|
|
40
|
+
public function __construct($parser) {
|
|
41
|
+
$this->parser = $parser;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Lex an expression into SassScript tokens.
|
|
46
|
+
* @param string expression to lex
|
|
47
|
+
* @param SassContext the context in which the expression is lexed
|
|
48
|
+
* @return array tokens
|
|
49
|
+
*/
|
|
50
|
+
public function lex($string, $context) {
|
|
51
|
+
$tokens = array();
|
|
52
|
+
while ($string !== false) {
|
|
53
|
+
if (($match = $this->isWhitespace($string)) !== false) {
|
|
54
|
+
$tokens[] = null;
|
|
55
|
+
}
|
|
56
|
+
elseif (($match = SassScriptFunction::isa($string)) !== false) {
|
|
57
|
+
preg_match(SassScriptFunction::MATCH_FUNC, $match, $matches);
|
|
58
|
+
|
|
59
|
+
$args = array();
|
|
60
|
+
foreach (SassScriptFunction::extractArgs($matches[SassScriptFunction::ARGS])
|
|
61
|
+
as $expression) {
|
|
62
|
+
$args[] = $this->parser->evaluate($expression, $context);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
$tokens[] = new SassScriptFunction(
|
|
66
|
+
$matches[SassScriptFunction::NAME], $args);
|
|
67
|
+
}
|
|
68
|
+
elseif (($match = SassString::isa($string)) !== false) {
|
|
69
|
+
$tokens[] = new SassString($match);
|
|
70
|
+
}
|
|
71
|
+
elseif (($match = SassBoolean::isa($string)) !== false) {
|
|
72
|
+
$tokens[] = new SassBoolean($match);
|
|
73
|
+
}
|
|
74
|
+
elseif (($match = SassColour::isa($string)) !== false) {
|
|
75
|
+
$tokens[] = new SassColour($match);
|
|
76
|
+
}
|
|
77
|
+
elseif (($match = SassNumber::isa($string)) !== false) {
|
|
78
|
+
$tokens[] = new SassNumber($match);
|
|
79
|
+
}
|
|
80
|
+
elseif (($match = SassScriptOperation::isa($string)) !== false) {
|
|
81
|
+
$tokens[] = new SassScriptOperation($match);
|
|
82
|
+
}
|
|
83
|
+
elseif (($match = SassScriptVariable::isa($string)) !== false) {
|
|
84
|
+
$tokens[] = new SassScriptVariable($match);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
$_string = $string;
|
|
88
|
+
$match = '';
|
|
89
|
+
while (strlen($_string) && !$this->isWhitespace($_string)) {
|
|
90
|
+
foreach (SassScriptOperation::$inStrOperators as $operator) {
|
|
91
|
+
if (substr($_string, 0, strlen($operator)) == $operator) {
|
|
92
|
+
break 2;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
$match .= $_string[0];
|
|
96
|
+
$_string = substr($_string, 1);
|
|
97
|
+
}
|
|
98
|
+
$tokens[] = new SassString($match);
|
|
99
|
+
}
|
|
100
|
+
$string = substr($string, strlen($match));
|
|
101
|
+
}
|
|
102
|
+
return $tokens;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Returns a value indicating if a token of this type can be matched at
|
|
107
|
+
* the start of the subject string.
|
|
108
|
+
* @param string the subject string
|
|
109
|
+
* @return mixed match at the start of the string or false if no match
|
|
110
|
+
*/
|
|
111
|
+
public function isWhitespace($subject) {
|
|
112
|
+
return (preg_match(self::MATCH_WHITESPACE, $subject, $matches) ? $matches[0] : false);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassScriptOperation.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassScriptOperation class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SassScriptOperation class.
|
|
14
|
+
* The operation to perform.
|
|
15
|
+
* @package PHamlP
|
|
16
|
+
* @subpackage Sass.script
|
|
17
|
+
*/
|
|
18
|
+
class SassScriptOperation {
|
|
19
|
+
const MATCH = '/^(\(|\)|\+|-|\*|\/|%|<=|>=|<|>|==|!=|=|#{|}|,|and\b|or\b|xor\b|not\b)/';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @var array map symbols to tokens.
|
|
23
|
+
* A token is function, associativity, precedence, number of operands
|
|
24
|
+
*/
|
|
25
|
+
public static $operators = array(
|
|
26
|
+
'*' => array('times', 'l', 8, 2),
|
|
27
|
+
'/' => array('div', 'l', 8, 2),
|
|
28
|
+
'%' => array('modulo', 'l', 8, 2),
|
|
29
|
+
'+' => array('plus', 'l', 7, 2),
|
|
30
|
+
'-' => array('minus', 'l', 7, 2),
|
|
31
|
+
'<<' => array('shiftl', 'l', 6, 2),
|
|
32
|
+
'>>' => array('shiftr', 'l', 6, 2),
|
|
33
|
+
'<=' => array('lte', 'l', 5, 2),
|
|
34
|
+
'>=' => array('gte', 'l', 5, 2),
|
|
35
|
+
'<' => array('lt', 'l', 5, 2),
|
|
36
|
+
'>' => array('gt', 'l', 5, 2),
|
|
37
|
+
'==' => array('eq', 'l', 4, 2),
|
|
38
|
+
'!=' => array('neq', 'l', 4, 2),
|
|
39
|
+
'and' => array('and', 'l', 3, 2),
|
|
40
|
+
'or' => array('or', 'l', 3, 2),
|
|
41
|
+
'xor' => array('xor', 'l', 3, 2),
|
|
42
|
+
'not' => array('not', 'l', 3, 1),
|
|
43
|
+
'=' => array('assign', 'l', 2, 2),
|
|
44
|
+
')' => array('rparen', 'l', 1),
|
|
45
|
+
'(' => array('lparen', 'l', 0),
|
|
46
|
+
',' => array('comma', 'l', 0, 2),
|
|
47
|
+
'#{' => array('begin_interpolation'),
|
|
48
|
+
'}' => array('end_interpolation'),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @var array operators with meaning in uquoted strings;
|
|
53
|
+
* selectors, property names and values
|
|
54
|
+
*/
|
|
55
|
+
public static $inStrOperators = array(',', '#{');
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @var array default operator token.
|
|
59
|
+
*/
|
|
60
|
+
public static $defaultOperator = array('concat', 'l', 0, 2);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @var string operator for this operation
|
|
64
|
+
*/
|
|
65
|
+
private $operator;
|
|
66
|
+
/**
|
|
67
|
+
* @var string associativity of the operator; left or right
|
|
68
|
+
*/
|
|
69
|
+
private $associativity;
|
|
70
|
+
/**
|
|
71
|
+
* @var integer precedence of the operator
|
|
72
|
+
*/
|
|
73
|
+
private $precedence;
|
|
74
|
+
/**
|
|
75
|
+
* @var integer number of operands required by the operator
|
|
76
|
+
*/
|
|
77
|
+
private $operandCount;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* SassScriptOperation constructor
|
|
81
|
+
*
|
|
82
|
+
* @param mixed string: operator symbol; array: operator token
|
|
83
|
+
* @return SassScriptOperation
|
|
84
|
+
*/
|
|
85
|
+
public function __construct($operation) {
|
|
86
|
+
if (is_string($operation)) {
|
|
87
|
+
$operation = self::$operators[$operation];
|
|
88
|
+
}
|
|
89
|
+
$this->operator = $operation[0];
|
|
90
|
+
if (isset($operation[1])) {
|
|
91
|
+
$this->associativity = $operation[1];
|
|
92
|
+
$this->precedence = $operation[2];
|
|
93
|
+
$this->operandCount = (isset($operation[3]) ?
|
|
94
|
+
$operation[3] : null);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Getter function for properties
|
|
100
|
+
* @param string name of property
|
|
101
|
+
* @return mixed value of the property
|
|
102
|
+
* @throws SassScriptOperationException if the property does not exist
|
|
103
|
+
*/
|
|
104
|
+
public function __get($name) {
|
|
105
|
+
if (property_exists($this, $name)) {
|
|
106
|
+
return $this->$name;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
throw new SassScriptOperationException('Unknown property: {name}', array('{name}'=>$name), SassScriptParser::$context->node);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Performs this operation.
|
|
115
|
+
* @param array operands for the operation. The operands are SassLiterals
|
|
116
|
+
* @return SassLiteral the result of the operation
|
|
117
|
+
* @throws SassScriptOperationException if the oprand count is incorrect or
|
|
118
|
+
* the operation is undefined
|
|
119
|
+
*/
|
|
120
|
+
public function perform($operands) {
|
|
121
|
+
if (count($operands) !== $this->operandCount) {
|
|
122
|
+
throw new SassScriptOperationException('Incorrect operand count for {operation}; expected {expected}, received {received}', array('{operation}'=>get_class($operands[0]), '{expected}'=>$this->operandCount, '{received}'=>count($operands)), SassScriptParser::$context->node);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (count($operands) > 1 && is_null($operands[1])) {
|
|
126
|
+
$operation = 'op_unary_' . $this->operator;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
$operation = 'op_' . $this->operator;
|
|
130
|
+
if ($this->associativity == 'l') {
|
|
131
|
+
$operands = array_reverse($operands);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (method_exists($operands[0], $operation)) {
|
|
136
|
+
return $operands[0]->$operation(!empty($operands[1]) ? $operands[1] : null);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
throw new SassScriptOperationException('Undefined operation "{operation}" for {what}', array('{operation}'=>$operation, '{what}'=>get_class($operands[0])), SassScriptParser::$context->node);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns a value indicating if a token of this type can be matched at
|
|
144
|
+
* the start of the subject string.
|
|
145
|
+
* @param string the subject string
|
|
146
|
+
* @return mixed match at the start of the string or false if no match
|
|
147
|
+
*/
|
|
148
|
+
public static function isa($subject) {
|
|
149
|
+
return (preg_match(self::MATCH, $subject, $matches) ? trim($matches[0]) : false);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassScriptParser.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassScriptParser class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
require_once('SassScriptLexer.php');
|
|
13
|
+
require_once('SassScriptParserExceptions.php');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* SassScriptParser class.
|
|
17
|
+
* Parses SassScript. SassScript is lexed into {@link http://en.wikipedia.org/wiki/Reverse_Polish_notation Reverse Polish notation} by the SassScriptLexer and
|
|
18
|
+
* the calculated result returned.
|
|
19
|
+
* @package PHamlP
|
|
20
|
+
* @subpackage Sass.script
|
|
21
|
+
*/
|
|
22
|
+
class SassScriptParser {
|
|
23
|
+
const MATCH_INTERPOLATION = '/(?<!\\\\)#\{(.*?)\}/';
|
|
24
|
+
const DEFAULT_ENV = 0;
|
|
25
|
+
const CSS_RULE = 1;
|
|
26
|
+
const CSS_PROPERTY = 2;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @var SassContext Used for error reporting
|
|
30
|
+
*/
|
|
31
|
+
public static $context;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @var SassScriptLexer the lexer object
|
|
35
|
+
*/
|
|
36
|
+
private $lexer;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* SassScriptParser constructor.
|
|
40
|
+
* @return SassScriptParser
|
|
41
|
+
*/
|
|
42
|
+
public function __construct() {
|
|
43
|
+
$this->lexer = new SassScriptLexer($this);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Replace interpolated SassScript contained in '#{}' with the parsed value.
|
|
48
|
+
* @param string the text to interpolate
|
|
49
|
+
* @param SassContext the context in which the string is interpolated
|
|
50
|
+
* @return string the interpolated text
|
|
51
|
+
*/
|
|
52
|
+
public function interpolate($string, $context) {
|
|
53
|
+
for ($i = 0, $n = preg_match_all(self::MATCH_INTERPOLATION, $string, $matches);
|
|
54
|
+
$i < $n; $i++) {
|
|
55
|
+
$matches[1][$i] = $this->evaluate($matches[1][$i], $context)->toString();
|
|
56
|
+
}
|
|
57
|
+
return str_replace($matches[0], $matches[1], $string);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Evaluate a SassScript.
|
|
62
|
+
* @param string expression to parse
|
|
63
|
+
* @param SassContext the context in which the expression is evaluated
|
|
64
|
+
* @param integer the environment in which the expression is evaluated
|
|
65
|
+
* @return SassLiteral parsed value
|
|
66
|
+
*/
|
|
67
|
+
public function evaluate($expression, $context, $environment=self::DEFAULT_ENV) {
|
|
68
|
+
self::$context = $context;
|
|
69
|
+
$operands = array();
|
|
70
|
+
|
|
71
|
+
$tokens = $this->parse($expression, $context, $environment);
|
|
72
|
+
|
|
73
|
+
while (count($tokens)) {
|
|
74
|
+
$token = array_shift($tokens);
|
|
75
|
+
if ($token instanceof SassScriptFunction) {
|
|
76
|
+
array_push($operands, $token->perform());
|
|
77
|
+
}
|
|
78
|
+
elseif ($token instanceof SassLiteral) {
|
|
79
|
+
if ($token instanceof SassString) {
|
|
80
|
+
$token = new SassString($this->interpolate($token->toString(), self::$context));
|
|
81
|
+
}
|
|
82
|
+
array_push($operands, $token);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
$args = array();
|
|
86
|
+
for ($i = 0, $c = $token->operandCount; $i < $c; $i++) {
|
|
87
|
+
$args[] = array_pop($operands);
|
|
88
|
+
}
|
|
89
|
+
array_push($operands, $token->perform($args));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return array_shift($operands);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Parse SassScript to a set of tokens in RPN
|
|
97
|
+
* using the Shunting Yard Algorithm.
|
|
98
|
+
* @param string expression to parse
|
|
99
|
+
* @param SassContext the context in which the expression is parsed
|
|
100
|
+
* @param integer the environment in which the expression is parsed
|
|
101
|
+
* @return array tokens in RPN
|
|
102
|
+
*/
|
|
103
|
+
public function parse($expression, $context, $environment=self::DEFAULT_ENV) {
|
|
104
|
+
$outputQueue = array();
|
|
105
|
+
$operatorStack = array();
|
|
106
|
+
$parenthesis = 0;
|
|
107
|
+
|
|
108
|
+
$tokens = $this->lexer->lex($expression, $context);
|
|
109
|
+
|
|
110
|
+
foreach($tokens as $i=>$token) {
|
|
111
|
+
// If two literals/expessions are seperated by whitespace use the concat operator
|
|
112
|
+
if (empty($token)) {
|
|
113
|
+
if ($i > 0 && (!$tokens[$i-1] instanceof SassScriptOperation || $tokens[$i-1]->operator === SassScriptOperation::$operators[')'][0]) &&
|
|
114
|
+
(!$tokens[$i+1] instanceof SassScriptOperation || $tokens[$i+1]->operator === SassScriptOperation::$operators['('][0])) {
|
|
115
|
+
$token = new SassScriptOperation(SassScriptOperation::$defaultOperator, $context);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
elseif ($token instanceof SassScriptVariable) {
|
|
122
|
+
$token = $token->evaluate($context);
|
|
123
|
+
$environment = self::DEFAULT_ENV;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// If the token is a number or function add it to the output queue.
|
|
127
|
+
if ($token instanceof SassLiteral || $token instanceof SassScriptFunction) {
|
|
128
|
+
if ($environment === self::CSS_PROPERTY && $token instanceof SassNumber && !$parenthesis) {
|
|
129
|
+
$token->inExpression = false;
|
|
130
|
+
}
|
|
131
|
+
array_push($outputQueue, $token);
|
|
132
|
+
}
|
|
133
|
+
// If the token is an operation
|
|
134
|
+
elseif ($token instanceof SassScriptOperation) {
|
|
135
|
+
// If the token is a left parenthesis push it onto the stack.
|
|
136
|
+
if ($token->operator == SassScriptOperation::$operators['('][0]) {
|
|
137
|
+
array_push($operatorStack, $token);
|
|
138
|
+
$parenthesis++;
|
|
139
|
+
}
|
|
140
|
+
// If the token is a right parenthesis:
|
|
141
|
+
elseif ($token->operator == SassScriptOperation::$operators[')'][0]) {
|
|
142
|
+
$parenthesis--;
|
|
143
|
+
while ($c = count($operatorStack)) {
|
|
144
|
+
// If the token at the top of the stack is a left parenthesis
|
|
145
|
+
if ($operatorStack[$c - 1]->operator == SassScriptOperation::$operators['('][0]) {
|
|
146
|
+
// Pop the left parenthesis from the stack, but not onto the output queue.
|
|
147
|
+
array_pop($operatorStack);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
// else pop the operator off the stack onto the output queue.
|
|
151
|
+
array_push($outputQueue, array_pop($operatorStack));
|
|
152
|
+
}
|
|
153
|
+
// If the stack runs out without finding a left parenthesis
|
|
154
|
+
// there are mismatched parentheses.
|
|
155
|
+
if ($c == 0) {
|
|
156
|
+
throw new SassScriptParserException('Unmatched parentheses', array(), $context->node);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// the token is an operator, o1, so:
|
|
160
|
+
else {
|
|
161
|
+
// while there is an operator, o2, at the top of the stack
|
|
162
|
+
while ($c = count($operatorStack)) {
|
|
163
|
+
$operation = $operatorStack[$c - 1];
|
|
164
|
+
// if o2 is left parenthesis, or
|
|
165
|
+
// the o1 has left associativty and greater precedence than o2, or
|
|
166
|
+
// the o1 has right associativity and lower or equal precedence than o2
|
|
167
|
+
if (($operation->operator == SassScriptOperation::$operators['('][0]) ||
|
|
168
|
+
($token->associativity == 'l' && $token->precedence > $operation->precedence) ||
|
|
169
|
+
($token->associativity == 'r' && $token->precedence <= $operation->precedence)) {
|
|
170
|
+
break; // stop checking operators
|
|
171
|
+
}
|
|
172
|
+
//pop o2 off the stack and onto the output queue
|
|
173
|
+
array_push($outputQueue, array_pop($operatorStack));
|
|
174
|
+
}
|
|
175
|
+
// push o1 onto the stack
|
|
176
|
+
array_push($operatorStack, $token);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// When there are no more tokens
|
|
182
|
+
while ($c = count($operatorStack)) { // While there are operators on the stack:
|
|
183
|
+
if ($operatorStack[$c - 1]->operator !== SassScriptOperation::$operators['('][0]) {
|
|
184
|
+
array_push($outputQueue, array_pop($operatorStack));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
throw new SassScriptParserException('Unmatched parentheses', array(), $context->node);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return $outputQueue;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassScriptParserExceptions.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassScript Parser exception class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
require_once(dirname(__FILE__).'/../SassException.php');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SassScriptParserException class.
|
|
16
|
+
* @package PHamlP
|
|
17
|
+
* @subpackage Sass.script
|
|
18
|
+
*/
|
|
19
|
+
class SassScriptParserException extends SassException {}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* SassScriptLexerException class.
|
|
23
|
+
* @package PHamlP
|
|
24
|
+
* @subpackage Sass.script
|
|
25
|
+
*/
|
|
26
|
+
class SassScriptLexerException extends SassScriptParserException {}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* SassScriptOperationException class.
|
|
30
|
+
* @package PHamlP
|
|
31
|
+
* @subpackage Sass.script
|
|
32
|
+
*/
|
|
33
|
+
class SassScriptOperationException extends SassScriptParserException {}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* SassScriptFunctionException class.
|
|
37
|
+
* @package PHamlP
|
|
38
|
+
* @subpackage Sass.script
|
|
39
|
+
*/
|
|
40
|
+
class SassScriptFunctionException extends SassScriptParserException {}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassVariable.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassVariable class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script.literals
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SassVariable class.
|
|
14
|
+
* @package PHamlP
|
|
15
|
+
* @subpackage Sass.script.literals
|
|
16
|
+
*/
|
|
17
|
+
class SassScriptVariable {
|
|
18
|
+
/**
|
|
19
|
+
* Regex for matching and extracting Variables
|
|
20
|
+
*/
|
|
21
|
+
const MATCH = '/^(?<!\\\\)(?(?!!important\b)[!\$]([\w-]+))/';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @var string name of variable
|
|
25
|
+
*/
|
|
26
|
+
private $name;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* SassVariable constructor
|
|
30
|
+
* @param string value of the Variable type
|
|
31
|
+
* @return SassVariable
|
|
32
|
+
*/
|
|
33
|
+
public function __construct($value) {
|
|
34
|
+
$this->name = substr($value, 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns the SassScript object for this variable.
|
|
39
|
+
* @param SassContext context of the variable
|
|
40
|
+
* @return SassLiteral the SassScript object for this variable
|
|
41
|
+
*/
|
|
42
|
+
public function evaluate($context) {
|
|
43
|
+
return $context->getVariable($this->name);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns a value indicating if a token of this type can be matched at
|
|
48
|
+
* the start of the subject string.
|
|
49
|
+
* @param string the subject string
|
|
50
|
+
* @return mixed match at the start of the string or false if no match
|
|
51
|
+
*/
|
|
52
|
+
public static function isa($subject) {
|
|
53
|
+
// we need to do the check as preg_match returns a count of 1 if
|
|
54
|
+
// subject == '!important'; the match being an empty match
|
|
55
|
+
return (preg_match(self::MATCH, $subject, $matches) ? (empty($matches[0]) ? false : $matches[0]) : false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/* SVN FILE: $Id: SassBoolean.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
|
3
|
+
/**
|
|
4
|
+
* SassBoolean class file.
|
|
5
|
+
* @author Chris Yates <chris.l.yates@gmail.com>
|
|
6
|
+
* @copyright Copyright (c) 2010 PBM Web Development
|
|
7
|
+
* @license http://phamlp.googlecode.com/files/license.txt
|
|
8
|
+
* @package PHamlP
|
|
9
|
+
* @subpackage Sass.script.literals
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
require_once('SassLiteral.php');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SassBoolean class.
|
|
16
|
+
* @package PHamlP
|
|
17
|
+
* @subpackage Sass.script.literals
|
|
18
|
+
*/
|
|
19
|
+
class SassBoolean extends SassLiteral {
|
|
20
|
+
/**@#+
|
|
21
|
+
* Regex for matching and extracting booleans
|
|
22
|
+
*/
|
|
23
|
+
const MATCH = '/^(true|false)\b/';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* SassBoolean constructor
|
|
27
|
+
* @param string value of the boolean type
|
|
28
|
+
* @return SassBoolean
|
|
29
|
+
*/
|
|
30
|
+
public function __construct($value) {
|
|
31
|
+
if (is_bool($value)) {
|
|
32
|
+
$this->value = $value;
|
|
33
|
+
}
|
|
34
|
+
elseif ($value === 'true' || $value === 'false') {
|
|
35
|
+
$this->value = ($value === 'true' ? true : false);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new SassBooleanException('Invalid {what}', array('{what}'=>'SassBoolean'), SassScriptParser::$context->node);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns the value of this boolean.
|
|
44
|
+
* @return boolean the value of this boolean
|
|
45
|
+
*/
|
|
46
|
+
public function getValue() {
|
|
47
|
+
return $this->value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns a string representation of the value.
|
|
52
|
+
* @return string string representation of the value.
|
|
53
|
+
*/
|
|
54
|
+
public function toString() {
|
|
55
|
+
return $this->getValue() ? 'true' : 'false';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns a value indicating if a token of this type can be matched at
|
|
60
|
+
* the start of the subject string.
|
|
61
|
+
* @param string the subject string
|
|
62
|
+
* @return mixed match at the start of the string or false if no match
|
|
63
|
+
*/
|
|
64
|
+
public static function isa($subject) {
|
|
65
|
+
return (preg_match(self::MATCH, $subject, $matches) ? $matches[0] : false);
|
|
66
|
+
}
|
|
67
|
+
}
|