Showing preview only (1,459K chars total). Download the full file or copy to clipboard to get everything.
Repository: wellington/go-libsass
Branch: main
Commit: e1cda027356e
Files: 225
Total size: 1.4 MB
Directory structure:
gitextract_enyzzzv5/
├── .github/
│ └── workflows/
│ └── go.yml
├── .gitignore
├── .gitmodules
├── LICENSE
├── Makefile
├── README.md
├── appveyor.yml
├── blah/
│ ├── blah.go
│ ├── blah.scss
│ └── error.scss
├── compiler.go
├── compiler_test.go
├── context.go
├── context_test.go
├── doc.go
├── encoding.go
├── encoding_test.go
├── error.go
├── error_test.go
├── examples/
│ ├── basic/
│ │ ├── file.scss
│ │ └── main.go
│ ├── customfunc/
│ │ ├── README.md
│ │ └── main.go
│ ├── custompreamble/
│ │ ├── README.md
│ │ └── main.go
│ └── options/
│ ├── file.scss
│ ├── main.go
│ └── partials/
│ └── _settings.sass
├── export.go
├── export_test.go
├── file_test.go
├── func.go
├── func_test.go
├── go.mod
├── go.sum
├── header.go
├── header_test.go
├── importer.go
├── importer_test.go
├── libs/
│ ├── SharedPtr.hpp
│ ├── ast.hpp
│ ├── ast_fwd_decl.hpp
│ ├── base64vlq.hpp
│ ├── bind.hpp
│ ├── cencode.c
│ ├── check_nesting.hpp
│ ├── color_maps.hpp
│ ├── color_names.hpp
│ ├── constants.hpp
│ ├── context.hpp
│ ├── cssize.hpp
│ ├── docs.go
│ ├── emitter.hpp
│ ├── encoding.go
│ ├── environment.hpp
│ ├── error_handling.hpp
│ ├── eval.hpp
│ ├── expand.hpp
│ ├── export.go
│ ├── extend.hpp
│ ├── file.hpp
│ ├── func.go
│ ├── functions.hpp
│ ├── header.go
│ ├── helpers.go
│ ├── importer.go
│ ├── inspect.hpp
│ ├── json.hpp
│ ├── kwd_arg_macros.hpp
│ ├── lexer.hpp
│ ├── listize.hpp
│ ├── mapping.hpp
│ ├── node.hpp
│ ├── operation.hpp
│ ├── output.hpp
│ ├── parser.hpp
│ ├── paths.hpp
│ ├── plugins.hpp
│ ├── position.hpp
│ ├── prelexer.hpp
│ ├── remove_placeholders.hpp
│ ├── safemap.go
│ ├── sass_number.go
│ ├── sass_number_test.go
│ ├── sass_util.hpp
│ ├── source_map.hpp
│ ├── subset_map.hpp
│ ├── to_c.hpp
│ ├── to_string.hpp
│ ├── to_value.hpp
│ ├── toscss.go
│ ├── units.hpp
│ ├── unity.cpp
│ ├── utf8.h
│ ├── utf8_string.hpp
│ ├── util.hpp
│ ├── values.hpp
│ ├── wrap.go
│ ├── wrap_dev.go
│ └── wrap_main.go
├── libsass-build/
│ ├── ast.cpp
│ ├── ast.hpp
│ ├── ast_def_macros.hpp
│ ├── ast_fwd_decl.cpp
│ ├── ast_fwd_decl.hpp
│ ├── b64/
│ │ ├── cencode.h
│ │ └── encode.h
│ ├── backtrace.cpp
│ ├── backtrace.hpp
│ ├── base64vlq.cpp
│ ├── base64vlq.hpp
│ ├── bind.cpp
│ ├── bind.hpp
│ ├── c99func.c
│ ├── cencode.c
│ ├── check_nesting.cpp
│ ├── check_nesting.hpp
│ ├── color_maps.cpp
│ ├── color_maps.hpp
│ ├── constants.cpp
│ ├── constants.hpp
│ ├── context.cpp
│ ├── context.hpp
│ ├── cssize.cpp
│ ├── cssize.hpp
│ ├── debug.hpp
│ ├── debugger.hpp
│ ├── emitter.cpp
│ ├── emitter.hpp
│ ├── environment.cpp
│ ├── environment.hpp
│ ├── error_handling.cpp
│ ├── error_handling.hpp
│ ├── eval.cpp
│ ├── eval.hpp
│ ├── expand.cpp
│ ├── expand.hpp
│ ├── extend.cpp
│ ├── extend.hpp
│ ├── file.cpp
│ ├── file.hpp
│ ├── functions.cpp
│ ├── functions.hpp
│ ├── include/
│ │ ├── sass/
│ │ │ ├── base.h
│ │ │ ├── context.h
│ │ │ ├── functions.h
│ │ │ ├── values.h
│ │ │ ├── version.h
│ │ │ └── version.h.in
│ │ ├── sass.h
│ │ └── sass2scss.h
│ ├── inspect.cpp
│ ├── inspect.hpp
│ ├── json.cpp
│ ├── json.hpp
│ ├── kwd_arg_macros.hpp
│ ├── lexer.cpp
│ ├── lexer.hpp
│ ├── listize.cpp
│ ├── listize.hpp
│ ├── mapping.hpp
│ ├── memory/
│ │ ├── SharedPtr.cpp
│ │ └── SharedPtr.hpp
│ ├── node.cpp
│ ├── node.hpp
│ ├── operation.hpp
│ ├── operators.cpp
│ ├── operators.hpp
│ ├── output.cpp
│ ├── output.hpp
│ ├── parser.cpp
│ ├── parser.hpp
│ ├── paths.hpp
│ ├── plugins.cpp
│ ├── plugins.hpp
│ ├── position.cpp
│ ├── position.hpp
│ ├── prelexer.cpp
│ ├── prelexer.hpp
│ ├── remove_placeholders.cpp
│ ├── remove_placeholders.hpp
│ ├── sass.cpp
│ ├── sass.hpp
│ ├── sass2scss.cpp
│ ├── sass_context.cpp
│ ├── sass_context.hpp
│ ├── sass_functions.cpp
│ ├── sass_functions.hpp
│ ├── sass_util.cpp
│ ├── sass_util.hpp
│ ├── sass_values.cpp
│ ├── sass_values.hpp
│ ├── source_map.cpp
│ ├── source_map.hpp
│ ├── subset_map.cpp
│ ├── subset_map.hpp
│ ├── to_c.cpp
│ ├── to_c.hpp
│ ├── to_value.cpp
│ ├── to_value.hpp
│ ├── units.cpp
│ ├── units.hpp
│ ├── utf8/
│ │ ├── checked.h
│ │ ├── core.h
│ │ └── unchecked.h
│ ├── utf8.h
│ ├── utf8_string.cpp
│ ├── utf8_string.hpp
│ ├── util.cpp
│ ├── util.hpp
│ ├── values.cpp
│ └── values.hpp
├── mixins.go
├── options.go
├── options_test.go
├── test/
│ └── scss/
│ ├── _include.scss
│ ├── basic.scss
│ ├── file.scss
│ ├── main.scss
│ └── sprite.scss
├── toscss.go
├── toscss_test.go
├── unicode_test.go
├── version.go
└── version_test.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/go.yml
================================================
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 'stable'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -race ./...
================================================
FILE: .gitignore
================================================
*.test
lib/
libsass-tmp/
================================================
FILE: .gitmodules
================================================
[submodule "libsass-src"]
path = libsass-src
url = https://github.com/sass/libsass.git
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 Drew Wells
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
export PKG_CONFIG_PATH=$(shell pwd)/lib/pkgconfig
install: deps
deps: fetch
fetch:
git submodule sync
git submodule update --init
libsass-src: fetch
libsass-src/Makefile.conf: fetch
include libsass-src/Makefile.conf
LIBSASS_VERSION:=$(shell cd libsass-src; ./version.sh)
libsass-build/include/sass/version.h: libsass-src/include/sass/version.h.in
echo "Stamping version $(LIBSASS_VERSION)"
sed 's/@PACKAGE_VERSION@/$(LIBSASS_VERSION)/' libsass-src/include/sass/version.h.in > libsass-build/include/sass/version.h
.PHONY: libsass-build
SOURCES=libsass-build/*.cpp libsass-build/*.c libsass-build/*.h libsass-build/*.hpp
libsass-build: libsass-src
mkdir -p libsass-build/include
rm -rf $(SOURCES)
# more stuff
cp -R libsass-src/src/*.c libsass-build
cp -R libsass-src/src/*.cpp libsass-build
cp -R libsass-src/src/*.h libsass-build
cp -R libsass-src/src/*.hpp libsass-build
cp -R libsass-src/src/b64 libsass-build
cp -R libsass-src/include libsass-build
cp -R libsass-src/src/memory libsass-build
cp -R libsass-src/src/utf8 libsass-build
# hack remove the [NA] version.h
rm libsass-build/include/sass/version.h
$(MAKE) libsass-build/include/sass/version.h
touch libs/*.go
update-libsass: libsass-build
@echo "Success"
.PHONY: test
test:
go test -race .
cleanfiles:
rm -rf lib include libsass-src libsass-tmp
clean: cleanfiles
git submodule update
================================================
FILE: README.md
================================================
libsass
=========
* Deprecated
Try this project [https://github.com/bep/godartsass](https://github.com/bep/godartsass)
[](https://circleci.com/gh/wellington/go-libsass) [](https://ci.appveyor.com/project/drewwells/go-libsass/branch/master)
The only Sass compliant Go library! go-libsass is a wrapper to the [sass/libsass](http://github.com/sass/libsass) project.
To build, setup Go
go build
To test
go test
Basic example more examples found in [examples](examples)
```go
buf := bytes.NewBufferString("div { p { color: red; } }")
if err != nil {
log.Fatal(err)
}
comp, err := libsass.New(os.Stdout, buf)
if err != nil {
log.Fatal(err)
}
if err := comp.Run(); err != nil {
log.Fatal(err)
}
```
Output
```
div p {
color: red; }
```
### Updating libsass
```
cd libsass-src; git fetch; git checkout vX.X.X
git commit -m "updated libsass to vX.X.X"
make update-libsass
# iterate on includes and code changes until tests pass
```
### FAQ
* Compiling go-libsass is very slow, what can be done?
Go-libsass compiles C/C++ libsass on every build. You can install the package and speed up building `go install github.com/wellington/go-libsass`. Alternatively, it's possible to link against system libsass and forego C compiling with `go build -tags dev`.
* How do I cross compile?
Since this package uses C bindings, you will need gcc for the target platform. For windows see, https://github.com/wellington/go-libsass/issues/37
================================================
FILE: appveyor.yml
================================================
build: off
clone_folder: c:\gopath\src\github.com\wellington\go-libsass
environment:
GOPATH: c:\gopath
stack: go 1.10.0
install:
- ps: |
# Install MinGW.
$url = "https://bintray.com/artifact/download/drewwells/generic/x86_64-5.1.0-release-win32-seh-rt_v4-rev0.7z"
$strFileName="C:\mingw64\bin\mingw32-make.exe"
If (Test-Path $strFileName){
Write-Host "Using cached mingw64"
}Else{
Write-Host "Fetching mingw64"
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile ming32-64.7z
&7z x -oC:\ ming32-64.7z > $null
}
- set CC=gcc
- set CXX=g++
# why is this necessary
- set PATH=%PATH%;C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin
- echo %PATH%
- echo %GOPATH%
- dir C:\mingw-w64
- dir C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64
- dir C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin
build_script:
- go build -x -ldflags "-extldflags '-static'"
================================================
FILE: blah/blah.go
================================================
package main
import (
"fmt"
"github.com/wellington/go-libsass/libs"
)
func main() {
//run("blah.scss")
run("error.scss")
}
func run(path string) {
//cheads := libs.SassMakeImporterList(1)
gofc := libs.SassMakeFileContext(path)
// goopts := libs.SassFileContextGetOptions(gofc)
// libs.SassOptionSetCHeaders(goopts, cheads)
// libs.SassOptionSetOutputStyle(goopts, 2)
// Set options
// libs.SassFileContextSetOptions(gofc, goopts)
goctx := libs.SassFileContextGetContext(gofc)
gocomp := libs.SassMakeFileCompiler(gofc)
defer libs.SassDeleteCompiler(gocomp)
libs.SassCompilerParse(gocomp)
libs.SassCompilerExecute(gocomp)
gostr := libs.SassContextGetOutputString(goctx)
fmt.Println(gostr)
errStatus := libs.SassContextGetErrorStatus(goctx)
if errStatus > 0 {
fmt.Println("error:", libs.SassContextGetErrorJSON(goctx))
}
}
================================================
FILE: blah/blah.scss
================================================
div { p { color: red; } }
================================================
FILE: blah/error.scss
================================================
p {
================================================
FILE: compiler.go
================================================
package libsass
import (
"errors"
"io"
"context"
)
var (
ErrPayloadEmpty = errors.New("empty payload")
ErrNoCompile = errors.New("No compile has occurred")
_ Pather = &sass{}
_ Compiler = &sass{}
)
// Pather describes the file system paths necessary for a project
type Pather interface {
ImgDir() string
BuildDir() string
HTTPPath() string
ImgBuildDir() string
FontDir() string
}
// Compiler interface is used to translate input Sass network, filepath,
// or otherwise and transforms it to CSS. The interface includes methods
// for adding imports and specifying build options necessary to do the
// transformation.
//
type Compiler interface {
// Run does a synchronous build via cgo. It is thread safe, but there is
// no guarantee that the cgo calls will always be that way.
Run() error
// Imports returns the imports used for a compile. This is built
// at parser time in libsass
Imports() []string
// Option allows the configuration of the compiler. The option is
// unexported to encourage use of preconfigured option functions.
Option(...FuncOpt) error
// CacheBust specifies the cache bust method used by the compiler
// Available options: ts, sum
CacheBust() string
// LineComments specifies whether line comments were inserted into
// output CSS
LineComments() bool
// Payload returns the attached spritewell information attached
// to the compiler context
Payload() context.Context
// Syntax represents the style of code Sass or SCSS
Syntax() Syntax
}
func New(dst io.Writer, src io.Reader, opts ...FuncOpt) (Compiler, error) {
c := &sass{
dst: dst,
src: src,
ctx: newContext(),
}
c.ctx.in = src
c.ctx.out = dst
c.ctx.compiler = c
err := c.Option(opts...)
return c, err
}
// sass implements compiler interface for Sass and Scss stylesheets. To
// configure the compiler, use the option method.
type sass struct {
// FIXME: old context for storing state, use compiler instead
ctx *compctx
dst io.Writer
mappath string
// src is the input stream to compile
src io.Reader
// path to the input file
srcFile string
// cachebust instructs the compiler to generate new paths
// preventing browser caching
cachebust string
httpPath string
includePaths []string
imports []string
cmt bool
sourceMapRoot string
// payload is passed around for handlers to have context
payload context.Context
// current syntax of the compiler, Sass or SCSS
syntax Syntax
}
var _ Compiler = &sass{}
func (c *sass) run() error {
defer func() {
c.imports = c.ctx.ResolvedImports
}()
if len(c.srcFile) > 0 {
return c.ctx.fileCompile(c.srcFile, c.dst, c.mappath, c.sourceMapRoot)
}
return c.ctx.compile(c.dst, c.src)
}
// BuildDir is where CSS is written to disk
func (s *sass) BuildDir() string {
return s.ctx.BuildDir
}
// CacheBust reveals the current cache busting state
func (c *sass) CacheBust() string {
return c.cachebust
}
func (s *sass) HTTPPath() string {
return s.ctx.HTTPPath
}
// ImgBuildDir fetch the image build directory
func (s *sass) ImgBuildDir() string {
return s.ctx.GenImgDir
}
// ImgDir returns the Image Directory used for locating images
func (c *sass) ImgDir() string {
return c.ctx.ImageDir
}
// Imports returns the full list of partials used to build the
// output stylesheet.
func (c *sass) Imports() []string {
return c.imports
}
// FontDir returns the font directory option
func (c *sass) FontDir() string {
return c.ctx.FontDir
}
// LineComments returns the source comment status
func (c *sass) LineComments() bool {
return c.cmt
}
func (c *sass) Payload() context.Context {
return c.ctx.Payload
}
// Run starts transforming S[c|a]ss to CSS
func (c *sass) Run() error {
return c.run()
}
func (c *sass) Syntax() Syntax {
return c.syntax
}
================================================
FILE: compiler_test.go
================================================
package libsass
import (
"bytes"
"fmt"
"log"
"os"
"path/filepath"
"testing"
)
func ExampleCompiler_stdin() {
src := bytes.NewBufferString(`div { p { color: red; } }`)
comp, err := New(os.Stdout, src)
if err != nil {
log.Fatal(err)
}
err = comp.Run()
if err != nil {
log.Fatal(err)
}
// Output:
// div p {
// color: red; }
//
}
func ExampleComipler_sass() {
src := bytes.NewBufferString(`
html
font-family: 'MonoSocial'
`)
comp, err := New(os.Stdout, src, WithSyntax(SassSyntax))
if err != nil {
log.Fatal(err)
}
err = comp.Run()
if err != nil {
log.Fatal(err)
}
// Output:
// html {
// font-family: 'MonoSocial'; }
}
func TestCompiler_path(t *testing.T) {
var dst bytes.Buffer
comp, err := New(&dst, nil, Path("test/scss/basic.scss"))
if err != nil {
t.Fatal(err)
}
err = comp.Run()
if err != nil {
t.Fatal(err)
}
e := `div p {
color: red; }
`
if e != dst.String() {
t.Errorf("got: %s wanted: %s", dst.String(), e)
}
if e := 1; len(comp.Imports()) != e {
t.Errorf("got: %d wanted: %d", len(comp.Imports()), e)
}
}
func TestCompiler_path_withpathsresolver(t *testing.T) {
var dst bytes.Buffer
absArgs := [][]string{}
comp, err := New(
&dst,
nil,
Path("test/scss/file.scss"),
ImportsOption(NewImportsWithResolver(func(importedUrl string, importerAbsPath string) (string, string, bool) {
absArgs = append(absArgs, []string{importedUrl, importerAbsPath})
if importedUrl == "a" {
return "test/scss/a.scss", ".a { color: #aaaaaa }\n@import 'b';", true
} else if importedUrl == "b" {
return "test/scss/b.scss", ".b { color: #bbbbbb }", true
}
return "", "", false
})),
)
if err != nil {
t.Fatal(err)
}
err = comp.Run()
if err != nil {
t.Fatal(err)
}
e := `.a {
color: #aaaaaa; }
.b {
color: #bbbbbb; }
`
if e != dst.String() {
t.Errorf("got: %s wanted: %s", dst.String(), e)
}
if e := 3; len(comp.Imports()) != e {
t.Errorf("got: %d wanted: %d", len(comp.Imports()), e)
}
expectedAbsArgs := `[[a test/scss/file.scss] [b a]]`
if absArgsStr := fmt.Sprintf("%+v", absArgs); expectedAbsArgs != absArgsStr {
t.Errorf("abs args got: %s wanted: %s", absArgsStr, expectedAbsArgs)
}
}
func TestCompiler_path_withabsresolver(t *testing.T) {
var dst bytes.Buffer
absArgs := [][]string{}
wd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
comp, err := New(
&dst,
nil,
Path("test/scss/file.scss"),
ImportsOption(NewImportsWithAbsResolver(func(importedUrl string, importerAbsPath string) (string, string, bool) {
// convert the path to a stable representation
// (convert abs path to a relative path, with the prefix $CWD/)
var pathToSave string
if filepath.IsAbs(importerAbsPath) {
pathToSave, err = filepath.Rel(wd, importerAbsPath)
if err != nil {
t.Fatal(err)
}
pathToSave = "$CWD/" + pathToSave
} else {
pathToSave = importerAbsPath
}
// save the args
absArgs = append(absArgs, []string{
importedUrl,
filepath.ToSlash(pathToSave),
})
// handle magic modules "a" and "b"
if importedUrl == "a" {
return wd + filepath.FromSlash("/test/scss/a.scss"), ".a { color: #aaaaaa }\n@import 'b';", true
} else if importedUrl == "b" {
return wd + filepath.FromSlash("/test/scss/b.scss"), ".b { color: #bbbbbb }", true
}
return "", "", false
})),
)
if err != nil {
t.Fatal(err)
}
err = comp.Run()
if err != nil {
t.Fatal(err)
}
e := `.a {
color: #aaaaaa; }
.b {
color: #bbbbbb; }
`
if e != dst.String() {
t.Errorf("got: %s wanted: %s", dst.String(), e)
}
if e := 3; len(comp.Imports()) != e {
t.Errorf("got: %d wanted: %d", len(comp.Imports()), e)
}
expectedAbsArgs := `[[a $CWD/test/scss/file.scss] [b $CWD/test/scss/a.scss]]`
if absArgsStr := fmt.Sprintf("%+v", absArgs); expectedAbsArgs != absArgsStr {
t.Errorf("abs args got: %s wanted: %s", absArgsStr, expectedAbsArgs)
}
}
================================================
FILE: context.go
================================================
package libsass
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/wellington/go-libsass/libs"
)
// Context handles the interactions with libsass. Context
// exposes libsass options that are available.
type compctx struct {
// TODO: hack to give handlers Access to the Compiler
compiler Compiler
options libs.SassOptions
context libs.SassContext
includeMap bool
// Options
OutputStyle int
Precision int
Comments bool
IncludePaths []string
// Input directories
FontDir string
ImageDir string
// Output/build directories
BuildDir string
GenImgDir string
// HTTP supporting code
HTTPPath string
In, Src, Out, Map, MainFile string
Status int //libsass status code
// many error parameters some are unnecessary and should be removed
errorString string
err SassError
in io.Reader
out io.Writer
// Funcs is a slice of Sass function handlers. Registry these globally
// by calling RegisterHandler
Funcs *Funcs
// Imports is a map of overridden imports. When Sass attempts to
// import a path matching on in this map, it will include the import
// found in the map before looking for a file on the system.
Imports *Imports
// Headers are a map of strings to start any Sass project with. Any
// header listed here will be present before any other Sass code is
// compiled.
Headers *Headers
// ResolvedImports is the list of files libsass used to compile this
// Sass sheet.
ResolvedImports []string
// Attach additional data to a context for use by custom
// handlers/mixins
Payload context.Context
}
// Constants/enums for the output style.
const (
NESTED_STYLE = iota
EXPANDED_STYLE
COMPACT_STYLE
COMPRESSED_STYLE
)
var Style map[string]int
func init() {
Style = make(map[string]int)
Style["nested"] = NESTED_STYLE
Style["expanded"] = EXPANDED_STYLE
Style["compact"] = COMPACT_STYLE
Style["compressed"] = COMPRESSED_STYLE
}
func newContext() *compctx {
c := &compctx{
Headers: NewHeaders(),
Imports: NewImports(),
}
// FIXME: this doesn't actually work for new options being added
// to just the compiler
c.compiler = &sass{ctx: c}
c.Funcs = NewFuncs(c)
return c
}
// Init validates options in the struct and returns a Sass Options.
func (ctx *compctx) Init(goopts libs.SassOptions) libs.SassOptions {
if ctx.Precision == 0 {
ctx.Precision = 5
}
ctx.options = goopts
ctx.Headers.Bind(goopts)
ctx.Imports.Bind(goopts)
ctx.Funcs.Bind(goopts)
libs.SassOptionSetSourceComments(goopts, ctx.compiler.LineComments())
//os.PathListSeparator
incs := strings.Join(ctx.IncludePaths, string(os.PathListSeparator))
libs.SassOptionSetIncludePath(goopts, incs)
libs.SassOptionSetPrecision(goopts, ctx.Precision)
libs.SassOptionSetOutputStyle(goopts, ctx.OutputStyle)
libs.SassOptionSetSourceComments(goopts, ctx.Comments)
if ctx.includeMap {
libs.SassOptionSetSourceMapEmbed(goopts, true)
}
return goopts
}
func (ctx *compctx) fileCompile(path string, out io.Writer, mappath, sourceMapRoot string) error {
defer ctx.Reset()
gofc := libs.SassMakeFileContext(path)
goopts := libs.SassFileContextGetOptions(gofc)
ctx.Init(goopts)
var fpath string
// libSass won't create a source map unless you ask it to
// embed one or give it a file path. It won't actually write
// to this file, but it will add this filename into the
// css output.
if len(mappath) > 0 {
libs.SassOptionSetSourceMapFile(goopts, mappath)
// Output path must be set for libSass to build relative
// paths between the source map and the source files
if f, ok := out.(*os.File); ok {
fpath = f.Name()
}
// without this, the sourceMappingURL in the out file
// creates strange relative paths
libs.SassOptionSetOutputPath(goopts, fpath)
}
// write source map paths relative to this path
if len(sourceMapRoot) > 0 {
libs.SassOptionSetSourceMapRoot(goopts, sourceMapRoot)
}
// Set options to the sass context
libs.SassFileContextSetOptions(gofc, goopts)
gocc := libs.SassFileContextGetContext(gofc)
ctx.context = gocc
gocompiler := libs.SassMakeFileCompiler(gofc)
libs.SassCompilerParse(gocompiler)
ctx.ResolvedImports = libs.GetImportList(gocc)
libs.SassCompilerExecute(gocompiler)
defer libs.SassDeleteCompiler(gocompiler)
goout := libs.SassContextGetOutputString(gocc)
if out == nil {
return errors.New("out writer required")
}
_, err := io.WriteString(out, goout)
if err != nil {
return err
}
ctx.Status = libs.SassContextGetErrorStatus(gocc)
errJSON := libs.SassContextGetErrorJSON(gocc)
mapout := libs.SassContextGetSourceMapString(gocc)
if len(mappath) > 0 && len(mapout) > 0 {
err := ioutil.WriteFile(mappath, []byte(mapout), 0666)
if err != nil {
return err
}
}
// Yet another property for storing errors
err = ctx.ProcessSassError([]byte(errJSON))
if err != nil {
return err
}
if ctx.Error() != "" {
// TODO: this is weird, make something more idiomatic*/
return errors.New(ctx.Error())
}
return nil
}
// compile reads in and writes the libsass compiled result to out.
// Options and custom functions are applied as specified in Context.
func (ctx *compctx) compile(out io.Writer, in io.Reader) error {
defer ctx.Reset()
var (
bs []byte
err error
)
// libSass will fail on Sass syntax given as non-file input
// convert the input on its behalf
if ctx.compiler.Syntax() == SassSyntax {
// this is memory intensive
var buf bytes.Buffer
err := ToScss(in, &buf)
if err != nil {
return err
}
bs = buf.Bytes()
} else {
// ScssSyntax
bs, err = ioutil.ReadAll(in)
if err != nil {
return err
}
}
if len(bs) == 0 {
return errors.New("No input provided")
}
godc := libs.SassMakeDataContext(string(bs))
goopts := libs.SassDataContextGetOptions(godc)
libs.SassOptionSetSourceComments(goopts, true)
ctx.Init(goopts)
libs.SassDataContextSetOptions(godc, goopts)
goctx := libs.SassDataContextGetContext(godc)
ctx.context = goctx
gocompiler := libs.SassMakeDataCompiler(godc)
libs.SassCompilerParse(gocompiler)
libs.SassCompilerExecute(gocompiler)
defer libs.SassDeleteCompiler(gocompiler)
goout := libs.SassContextGetOutputString(goctx)
io.WriteString(out, goout)
ctx.Status = libs.SassContextGetErrorStatus(goctx)
errJSON := libs.SassContextGetErrorJSON(goctx)
err = ctx.ProcessSassError([]byte(errJSON))
if err != nil {
return err
}
if ctx.Error() != "" {
lines := bytes.Split(bs, []byte("\n"))
var out string
for i := -7; i < 7; i++ {
if i+ctx.err.Line >= 0 && i+ctx.err.Line < len(lines) {
out += fmt.Sprintf("%s\n", string(lines[i+ctx.err.Line]))
}
}
// TODO: this is weird, make something more idiomatic
return errors.New(ctx.Error() + "\n" + out)
}
return nil
}
// Rel creates relative paths between the build directory where the CSS lives
// and the image directory that is being linked. This is not compatible
// with generated images like sprites.
func (p *compctx) RelativeImage() string {
rel, _ := filepath.Rel(p.BuildDir, p.ImageDir)
return filepath.ToSlash(filepath.Clean(rel))
}
================================================
FILE: context_test.go
================================================
package libsass
import (
"bytes"
"log"
"os"
"testing"
"github.com/wellington/go-libsass/libs"
)
func TestContextFile(t *testing.T) {
in := bytes.NewBufferString(`div {
span {
color: black;
}
width: 100px;
height: 100px;
}
p {
background: red;
}`)
var out bytes.Buffer
ctx := newContext()
err := ctx.compile(&out, in)
if err != nil {
panic(err)
}
e := `div {
width: 100px;
height: 100px; }
div span {
color: black; }
p {
background: red; }
`
if e != out.String() {
t.Errorf("wanted:\n%s\n"+
"got:\n%s\n", e, out.String())
}
}
func TestContextNilRun(t *testing.T) {
var in, out bytes.Buffer
ctx := newContext()
err := ctx.compile(&out, &in)
if err == nil {
t.Error("No error returned")
}
if e := "No input provided"; e != err.Error() {
t.Errorf("wanted:\n%s\ngot:\n%s", e, err)
}
}
func TestContextRun(t *testing.T) {
in := bytes.NewBufferString(`$red-var: red;
$hex: #00FF00;
div {
background: $hex;
$hex: #00DD00;
font-size: 10pt;
}
`)
var out bytes.Buffer
ctx := newContext()
err := ctx.compile(&out, in)
if err != nil {
panic(err)
}
e := `div {
background: #00FF00;
font-size: 10pt; }
`
if e != out.String() {
t.Errorf("wanted:\n%s\n"+
"got:\n%s\n", e, out.String())
}
}
func TestLibsassError(t *testing.T) {
in := bytes.NewBufferString(`div {
color: red(blue, purple);
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Funcs.Add(Func{
Sign: "foo()",
Fn: TestCallback,
Ctx: &ctx,
})
err := ctx.compile(&out, in)
if err == nil {
t.Error("No error thrown for incorrect arity")
}
if e := "wrong number of arguments (2 for 1) for `red'"; e != ctx.err.Message {
t.Errorf("wanted:%s\ngot:%s\n", e, ctx.err.Message)
}
e := `Error > stdin:2
wrong number of arguments (2 for 1) for ` + "`" + `red'
div {
color: red(blue, purple);
}
`
if e != err.Error() {
t.Errorf("wanted:\n%s\ngot:\n%s\n", e, err)
}
}
func ExampleContext_Compile() {
in := bytes.NewBufferString(`div {
color: red(blue);
background: foo();
}`)
ctx := newContext()
ctx.Funcs.Add(Func{
Sign: "foo()",
Fn: func(v interface{}, usv libs.UnionSassValue, rsv *libs.UnionSassValue) error {
res, _ := Marshal("no-repeat")
*rsv = res.Val()
return nil
},
Ctx: &ctx,
})
err := ctx.compile(os.Stdout, in)
if err != nil {
log.Fatal(err)
}
// Output:
// div {
// color: 0;
// background: no-repeat; }
}
func BenchmarkContextCompile(b *testing.B) {
bits := []byte(`div { color: #005500; }`)
big := []byte(`div { color: #005500; } `)
ctx := newContext()
out := bytes.NewBuffer(big)
for i := 0; i < b.N; i++ {
in := bytes.NewBuffer(bits)
out.Reset()
err := ctx.compile(out, in)
if err != nil {
b.Error(err)
}
}
}
================================================
FILE: doc.go
================================================
// Package context wraps access to libsass. Higher level abstractions
// are used to make the package more like Go than C. For low level
// access see: http://godoc.org/github.com/wellington/go-libsass/libs
//
// For more info, see https://github.com/sass/libsass
package libsass
================================================
FILE: encoding.go
================================================
package libsass
import (
"errors"
"fmt"
"image/color"
"reflect"
"strconv"
"strings"
"github.com/wellington/go-libsass/libs"
)
var (
ErrSassNumberNoUnit = errors.New("SassNumber has no units")
)
type SassValue struct {
value libs.UnionSassValue
}
func (sv SassValue) Val() libs.UnionSassValue {
return sv.value
}
func NewSassValue() SassValue {
return SassValue{value: libs.NewUnionSassValue()}
}
func unmarshal(arg SassValue, v interface{}) error {
sv := arg.Val()
//Get the underlying value of v and its kind
f := reflect.ValueOf(v)
if f.Kind() == reflect.Ptr {
f = f.Elem()
}
k := f.Kind()
t := f.Type()
if k == reflect.Interface {
switch {
case libs.IsNil(sv):
f.Set(reflect.ValueOf("<nil>"))
return nil
case libs.IsString(sv):
k = reflect.String
case libs.IsBool(sv):
k = reflect.Bool
case libs.IsNumber(sv):
k = reflect.Struct
case libs.IsList(sv):
k = reflect.Slice
t = reflect.SliceOf(t)
case libs.IsError(sv):
// This should get implemented as type error
k = reflect.String
case libs.IsColor(sv):
k = reflect.Struct
default:
return errors.New("Uncovertable interface value.")
}
}
switch k {
case reflect.Invalid:
return errors.New("Invalid SASS Value - Taylor Swift")
case reflect.String:
if libs.IsString(sv) || libs.IsError(sv) {
var gc string
if libs.IsString(sv) {
gc = libs.String(sv)
} else {
gc = libs.Error(sv)
}
//drop quotes
if t, err := strconv.Unquote(gc); err == nil {
gc = t
}
if strings.HasPrefix(gc, "'") && strings.HasSuffix(gc, "'") {
gc = gc[1 : len(gc)-1]
}
if !f.CanSet() {
return errors.New("Can not set string")
}
switch t := f.Kind(); t {
case reflect.String:
f.SetString(gc)
case reflect.Interface:
f.Set(reflect.ValueOf(gc))
}
} else {
return throwMisMatchTypeError(arg, "string")
}
case reflect.Bool:
if libs.IsBool(sv) {
b := libs.Bool(sv)
f.Set(reflect.ValueOf(b))
} else {
return throwMisMatchTypeError(arg, "bool")
}
case reflect.Struct:
switch {
case libs.IsColor(sv):
col := libs.Color(sv)
f.Set(reflect.ValueOf(col))
case libs.IsNumber(sv):
u, err := getSassNumberUnit(arg)
if err != nil {
return err
}
sn := libs.SassNumber{
Value: libs.Float(sv),
Unit: u,
}
f.Set(reflect.ValueOf(sn))
default:
return throwMisMatchTypeError(arg, "color.RGBA or SassNumber")
}
case reflect.Slice:
if !libs.IsList(sv) {
return throwMisMatchTypeError(arg, "slice")
}
libs.Slice(arg.Val(), v)
default:
return errors.New("Unsupported SassValue")
}
return nil
}
// Decode converts Sass Value to Go compatible data types.
func Unmarshal(arg SassValue, v ...interface{}) error {
var err error
sv := arg.Val()
var l int
if libs.IsList(sv) {
l = libs.Len(sv)
}
if arg.Val() == nil {
return errors.New("I can't work with this. arg UnionSassValue must not be nil. - Unmarshaller")
} else if len(v) == 0 {
return errors.New("Cannot Unmarshal an empty value - Michael Scott")
} else if len(v) > 1 {
if len(v) < l { //check for optional arguements that are not passed and pad with nil
return fmt.Errorf(
"Arguments mismatch %d C arguments did not match %d",
l, len(v))
}
for i := 0; i < l; i++ {
val := libs.Index(sv, i)
err = unmarshal(SassValue{value: val}, v[i])
if err != nil {
return err
}
}
return err
} else if libs.IsList(sv) &&
getKind(v[0]) != reflect.Slice &&
l == 1 { //arg is a slice of 1 but we want back a non slice
val := libs.Index(sv, 0)
return unmarshal(SassValue{value: val}, v[0])
} else if libs.IsList(sv) &&
getKind(v[0]) == reflect.Slice &&
libs.IsList(libs.Index(sv, 0)) &&
l == 1 { //arg is a list of single list and we only want back a list so we need to unwrap
val := libs.Index(sv, 0)
return unmarshal(SassValue{value: val}, v[0])
//return unmarshal(C.sass_list_get_value(arg, C.size_t(0)), v[0])
} else {
return unmarshal(arg, v[0])
}
}
func getKind(v interface{}) reflect.Kind {
f := reflect.ValueOf(v)
if f.Kind() == reflect.Ptr {
f = f.Elem()
}
return f.Kind()
}
func noSassNumberUnit(arg SassValue) bool {
u := libs.Unit(arg.Val())
return u == "" || u == "none"
}
func getSassNumberUnit(arg SassValue) (string, error) {
u := libs.Unit(arg.Val())
var err error
if noSassNumberUnit(arg) {
return u, ErrSassNumberNoUnit
}
if _, ok := libs.SassUnitConversions[u]; !ok {
return u, fmt.Errorf("SassNumber units %s are unsupported", u)
}
return u, err
}
func Marshal(v interface{}) (SassValue, error) {
return makevalue(v)
}
// make is needed to create types for use by test
func makevalue(v interface{}) (SassValue, error) {
f := reflect.ValueOf(v)
var err error
switch f.Kind() {
default:
return SassValue{value: libs.MakeNil()}, nil
case reflect.Bool:
b := v.(bool)
return SassValue{value: libs.MakeBool(b)}, nil
case reflect.String:
s := v.(string)
return SassValue{value: libs.MakeString(s)}, nil
case reflect.Struct: //only SassNumber and color.RGBA are supported
if sn, ok := v.(libs.SassNumber); ok {
return SassValue{
value: libs.MakeNumber(sn.Float(), sn.UnitOf()),
}, err
} else if sc, ok := v.(color.RGBA); ok {
return SassValue{value: libs.MakeColor(sc)}, nil
} else {
err = errors.New(fmt.Sprintf("The struct type %s is unsupported for marshalling", reflect.TypeOf(v).String()))
return SassValue{value: libs.MakeNil()}, err
}
case reflect.Slice:
// Initialize the list
lst := libs.MakeList(f.Len())
for i := 0; i < f.Len(); i++ {
t, er := makevalue(f.Index(i).Interface())
if err == nil && er != nil {
err = er
}
libs.SetIndex(lst, i, t.Val())
}
return SassValue{value: lst}, err
}
}
func throwMisMatchTypeError(arg SassValue, expectedType string) error {
var intf interface{}
unmarshal(arg, &intf)
svinf := libs.Interface(arg.Val())
return fmt.Errorf("Invalid Sass type expected: %s got: %T value: %v",
expectedType, svinf, svinf)
}
================================================
FILE: encoding_test.go
================================================
package libsass
import (
"fmt"
"image/color"
"reflect"
"testing"
"github.com/wellington/go-libsass/libs"
)
type unsupportedStruct struct {
value float64
}
type TestError interface {
Error(...interface{})
}
func testMarshal(t TestError, v interface{}) SassValue {
res, err := Marshal(v)
if err != nil {
t.Error(err)
}
return res
}
func TestUnmarshalNumber(t *testing.T) {
c := libs.SassNumber{1.0, "mm"}
sv, _ := makevalue(c)
var i libs.SassNumber
Unmarshal(sv, &i)
if c != i {
t.Errorf("got: %v wanted: %v", i, c)
}
d := libs.SassNumber{1.5, "pt"}
dv, _ := makevalue(d)
var ed libs.SassNumber
Unmarshal(dv, &ed)
if d != ed {
t.Errorf("got: %v wanted: %v", ed, d)
}
d = libs.SassNumber{2.0, "TaylorSwifts"}
dv, _ = makevalue(d)
var ei libs.SassNumber
err := Unmarshal(dv, &ei)
if err == nil {
t.Error("No error thrown for invalid type")
}
if e := fmt.Sprintf("SassNumber units %s are unsupported", d.Unit); e != err.Error() {
t.Errorf("got:\n%s\nwanted:\n%s\n", err.Error(), e)
}
}
func TestUnmarshalStringValue(t *testing.T) {
e := "example"
input, _ := makevalue(e)
var s string
Unmarshal(input, &s)
if e != s {
t.Errorf("got: % #v\nwanted: %s", s, e)
}
}
func TestUnmarshalError(t *testing.T) {
e := "error message"
obj := Error(fmt.Errorf("%s", e))
var s string
err := Unmarshal(obj, &s)
if err != nil {
t.Error(err)
}
if e != s {
t.Errorf("got: %s wanted: %s", s, e)
}
}
func TestUnmarshal_complex(t *testing.T) {
// Only interfaces supported for lists, is this ok?
e := []string{"ex1", "ex2"}
list, _ := makevalue(e)
var s []string
Unmarshal(list, &s)
if len(s) != len(e) {
t.Error("Length mismatch")
return
}
for i := range e {
if e[i] != s[i] {
t.Errorf("got: %v wanted %v", s, e)
}
}
}
// Can't import C in the test package, so this is how to test cgo code
func TestUnmarshal_unknown(t *testing.T) {
// Test for nil (no value, pointer, or empty error)
var unk interface{}
res, err := Marshal(unk)
if err != nil {
t.Fatal(err)
}
var v interface{}
_ = Unmarshal(res, &v)
if v != "<nil>" {
t.Error("non-nil returned")
}
// Need a test for non-supported type
}
func TestMarshalInvalidUnitSassNumber(t *testing.T) {
num := libs.SassNumber{45, "em"}
var num2 libs.SassNumber
x := testMarshal(t, num)
error := Unmarshal(x, &num2)
if error.Error() != "SassNumber units em are unsupported" {
t.Errorf("got: %s wanted: %s", error.Error(), "SassNumber units em are unsupported")
}
}
func TestMarshal_list(t *testing.T) {
lst1 := []libs.SassNumber{
libs.SassNumber{Value: 1, Unit: "px"},
libs.SassNumber{Value: 2, Unit: "rad"},
libs.SassNumber{Value: 3, Unit: "grad"},
libs.SassNumber{Value: 4, Unit: "deg"}}
var lst2 []libs.SassNumber
x := testMarshal(t, lst1)
_ = Unmarshal(x, &lst2)
if len(lst1) != len(lst2) {
t.Error("List length mismatch")
}
for i := range lst1 {
if lst1[i] != lst2[i] {
t.Errorf("wanted: %v got: %v", lst1[i], lst2[i])
}
}
}
func TestMarshal_number_interface(t *testing.T) {
var fl = libs.SassNumber{Value: 3, Unit: "turn"}
var intf interface{}
x := testMarshal(t, fl)
_ = Unmarshal(x, &intf)
if fl != intf {
t.Errorf("got: %v wanted: %v", intf, fl)
}
}
func TestMarshalBool(t *testing.T) {
var b = bool(true)
var be bool
bm := testMarshal(t, b)
Unmarshal(bm, &be)
if b != be {
t.Errorf("got: %t wanted: %t", be, b)
}
}
func TestMarshalInterfaceListToMultiVariable(t *testing.T) {
var lst = []interface{}{libs.SassNumber{Value: 5, Unit: "pt"}, "a", true}
var i libs.SassNumber
var s string
var b bool
var ir = libs.SassNumber{5, "pt"}
var sr = string("a")
var br = bool(true)
lstm := testMarshal(t, lst)
_ = Unmarshal(lstm, &i, &s, &b)
if !reflect.DeepEqual(i, ir) {
t.Errorf("got: %v wanted: %v", i, ir)
}
if s != sr {
t.Errorf("got: %s wanted: %s", s, sr)
}
if b != br {
t.Errorf("got: %t wanted: %t", b, br)
}
}
func TestMarshalInterfaceListToMultiVariablewList(t *testing.T) {
var lst = []interface{}{
libs.SassNumber{Value: 5, Unit: "pt"}, "a", true,
[]string{"a", "b", "c", "d"}}
var i libs.SassNumber
var s string
var b bool
var sl []string
var ir = libs.SassNumber{Value: 5, Unit: "pt"}
var sr = string("a")
var br = bool(true)
var slr = []string{"a", "b", "c", "d"}
lstm := testMarshal(t, lst)
_ = Unmarshal(lstm, &i, &s, &b, &sl)
if !reflect.DeepEqual(i, ir) {
t.Errorf("got: %v wanted: %v", i, ir)
}
if s != sr {
t.Errorf("got: %s wanted: %s", s, sr)
}
if b != br {
t.Errorf("got: %t wanted: %t", b, br)
}
if !reflect.DeepEqual(sl, slr) {
t.Errorf("got: %s wanted: %s", sl, slr)
}
}
func TestMarshalInterfaceListSingleVariable(t *testing.T) {
var lst = []interface{}{libs.SassNumber{Value: 5, Unit: "mm"}}
var i libs.SassNumber
var ir = libs.SassNumber{5, "mm"}
lstm := testMarshal(t, lst)
_ = Unmarshal(lstm, &i)
if !reflect.DeepEqual(i, ir) {
t.Errorf("got: %v wanted: %v", i, ir)
}
}
func TestMarshalSassNumber(t *testing.T) {
sn := libs.SassNumber{
Value: float64(3.5),
Unit: "px",
}
var sne = libs.SassNumber{}
snm := testMarshal(t, sn)
_ = Unmarshal(snm, &sne)
if !reflect.DeepEqual(sne, sn) {
t.Errorf("wanted:\n%#v\ngot:\n% #v", sn, sne)
}
}
func TestMarshalError(t *testing.T) {
e := "error has been thrown"
err := fmt.Errorf(e)
eusv := Error(err)
var s string
Unmarshal(eusv, &s)
if s != e {
t.Errorf("got:\n%s\nwanted:\n%s", s, e)
}
}
func TestMarshalColor(t *testing.T) {
c := color.RGBA{
R: uint8(5),
G: uint8(6),
B: uint8(7),
A: uint8(8),
}
var ce = color.RGBA{}
cm := testMarshal(t, c)
_ = Unmarshal(cm, &ce)
if !reflect.DeepEqual(ce, c) {
t.Errorf("What the damn hell. Wanted:\n%#v\ngot:\n% #v", c, ce)
}
}
func TestListListtoInterfaceList(t *testing.T) {
var lst = []interface{}{"a", "b"}
var lstlst = []interface{}{lst}
var lst2 []interface{}
var elst = []interface{}{"a", "b"}
x := testMarshal(t, lstlst)
_ = Unmarshal(x, &lst2)
if len(lst2) != len(elst) {
t.Error("List length mismatch")
}
if !reflect.DeepEqual(lst2, elst) {
t.Errorf("What the damn hell. Wanted:\n%#v\ngot:\n% #v", elst, lst2)
}
}
func TestSlice_make(t *testing.T) {
l := []string{"a", "b"}
x := testMarshal(t, l)
var res []string
err := Unmarshal(x, &res)
if err != nil {
t.Fatal(err)
}
if e := len(l); e != len(res) {
t.Errorf("got: %d wanted: %d", len(res), e)
}
if e := l[0]; e != res[0] {
t.Fatalf("got: %s wanted: %s", res[0], e)
}
// Now test new fancy libs.Slice()
res = []string{}
libs.Slice(x.Val(), &res)
if e := len(l); e != len(res) {
t.Errorf("got: %d wanted: %d", len(res), e)
}
if e := l[0]; e != res[0] {
t.Fatalf("got: %s wanted: %s", res[0], e)
}
}
func TestSlice_mixedtypes(t *testing.T) {
infs := []interface{}{"a", "b", libs.SassNumber{Value: 1, Unit: "mm"}}
sv := testMarshal(t, infs)
var res []interface{}
libs.Slice(sv.Val(), &res)
if !reflect.DeepEqual(res, infs) {
t.Errorf("got: % #v wanted: % #v\n", res, infs)
}
}
func TestSV_equal(t *testing.T) {
b := libs.MakeBool(true)
bb := libs.MakeBool(true)
if libs.Interface(b) != libs.Interface(bb) {
t.Fatal("equal failed")
}
c := libs.MakeColor(color.RGBA{})
cc := libs.MakeColor(color.RGBA{})
if libs.Interface(c) != libs.Interface(cc) {
t.Fatal("equal failed")
}
s := libs.MakeString("hi")
ss := libs.MakeString("hi")
if libs.Interface(s) != libs.Interface(ss) {
t.Fatal("equal failed")
}
}
func TestMarshal_map_set(t *testing.T) {
t.Skip("maps are not supported")
m := map[string]string{"key": "val"}
x := testMarshal(t, m)
var mm map[string]string
err := Unmarshal(x, &mm)
if err != nil {
t.Fatal(err)
}
fmt.Printf("% #v\n", mm)
}
func TestMarshalUnsupportedStruct(t *testing.T) {
us := unsupportedStruct{
value: 5.5,
}
_, err := Marshal(us)
expectedErr := fmt.Errorf(
"The struct type %s is unsupported for marshalling",
reflect.TypeOf(us).String())
if !reflect.DeepEqual(expectedErr, err) {
t.Errorf("Marshalling of unsupported struct did not return an error")
}
}
func TestQuotedStringUnmarshal(t *testing.T) {
testmap := []string{
"\"Taylor Swift\"",
"'Taylor Swift'",
}
e := "Taylor Swift"
var se string
for _, s := range testmap {
sm := testMarshal(t, s)
Unmarshal(sm, &se)
if e != se {
t.Errorf("What the damn hell. Got: %s wanted: %s", se, e)
}
}
}
func TestOptionalParameters(t *testing.T) {
var lst = []interface{}{libs.SassNumber{Value: 5, Unit: "px"}, "a", true}
var i libs.SassNumber
var s string
var b bool
var s2 string
var i2 float64
var ir = libs.SassNumber{Value: 5, Unit: "px"}
var sr = string("a")
var br = bool(true)
lstm := testMarshal(t, lst)
_ = Unmarshal(lstm, &i, &s, &b, &s2, &i2)
if !reflect.DeepEqual(i, ir) {
t.Errorf("got: %v wanted: %v", i, ir)
}
if s != sr {
t.Errorf("got: %s wanted: %s", s, sr)
}
if b != br {
t.Errorf("got: %t wanted: %t", b, br)
}
if s2 != "" {
t.Errorf("got: %s wanted empty string", s)
}
if i2 != 0 {
t.Errorf("got: %f wanted: 0", i2)
}
}
func TestNullUnionSassValue(t *testing.T) {
usv := NewSassValue()
var inf interface{}
err := Unmarshal(usv, &inf)
e := "I can't work with this. arg UnionSassValue must not be nil. - Unmarshaller"
if err != nil {
t.Errorf("got: %s wanted: %s", err, e)
}
}
func TestWrongUnmarshalToFloatType(t *testing.T) {
s := "Taylor Swift"
var ie libs.SassNumber
sm := testMarshal(t, s)
err := Unmarshal(sm, &ie)
e := "Invalid Sass type expected: color.RGBA or SassNumber got: string value: Taylor Swift"
if err.Error() != e {
t.Errorf("got:\n%s \nwanted:\n%s", err, e)
}
}
================================================
FILE: error.go
================================================
package libsass
import (
"encoding/json"
"fmt"
)
// SassError represents an error object returned from Sass. SassError
// stores useful information for bubbling up libsass errors.
type SassError struct {
Status, Line, Column int
File, Message string
}
// ProcessSassError reads the original libsass error and creates helpful debuggin
// information for debuggin that error.
func (ctx *compctx) ProcessSassError(bs []byte) error {
if len(bs) == 0 {
return nil
}
err := json.Unmarshal(bs, &ctx.err)
if err != nil {
return err
}
errors := ctx.err
ctx.errorString = fmt.Sprintf("Error > %s:%d\n%s",
errors.File, errors.Line, errors.Message)
return nil
}
func (ctx *compctx) Error() string {
return ctx.errorString
}
// Reset returns removes all error state information.
func (ctx *compctx) Reset() {
ctx.errorString = ""
}
// ErrorLine attempts to resolve the file associated with
// a stdin:#
func (ctx *compctx) ErrorLine() int {
var n int
fmt.Sscanf(ctx.Error(), "Error > stdin:%d", &n)
return n
}
================================================
FILE: error_test.go
================================================
package libsass
import (
"bytes"
"strings"
"testing"
)
type ErrorMap struct {
line int
message string
}
func TestError_basic(t *testing.T) {
in := bytes.NewBufferString(`div {
@include invalid-function('');
}`)
out := bytes.NewBuffer([]byte(""))
ctx := newContext()
err := ctx.compile(out, in)
if err == nil {
t.Error("No error returned")
}
e := ErrorMap{2, "no mixin named invalid-function"}
if e.line != ctx.err.Line {
t.Errorf("wanted: %d\ngot: %d", e.line, ctx.err.Line)
}
if !strings.Contains(ctx.err.Message, e.message) {
t.Errorf("%q does not contain %q", ctx.err.Message, e.message)
}
if ctx.errorString != ctx.Error() {
t.Errorf("wanted: %s got: %s", ctx.errorString, ctx.Error())
}
}
func TestError_JSON(t *testing.T) {
in := bytes.NewBufferString(`div {
height: 10px;`)
out := &bytes.Buffer{}
ctx := newContext()
err := ctx.compile(out, in)
e := `Error > stdin:2
Invalid CSS after " height: 10px;": expected "}", was ""
div {
height: 10px;
`
if err == nil {
t.Fatal("no error thrown")
}
if e != err.Error() {
t.Fatalf("got: %s\nwanted: %s", err, e)
}
}
func TestError_unbound(t *testing.T) {
in := bytes.NewBufferString(`div {
background: map-get($sprite,139);
}`)
out := bytes.NewBuffer([]byte(""))
ctx := newContext()
err := ctx.compile(out, in)
if err == nil {
t.Error("No error returned")
}
e := ErrorMap{2, "unbound variable $sprite"}
if e.line != ctx.err.Line {
t.Errorf("wanted:\n%d\ngot:\n%d", e.line, ctx.err.Line)
}
}
func TestError_function(t *testing.T) {
in := bytes.NewBufferString(`// Empty line
@function uniqueFnName($file) {
@return map-get($file,prop);
}
div {
background: uniqueFnName(randfile);
}`)
out := bytes.NewBuffer([]byte(""))
ctx := newContext()
err := ctx.compile(out, in)
if err == nil {
t.Error("No error returned")
}
e := ErrorMap{3, "argument `$map` of `map-get($map, $key)` must be a map"}
if e.line != ctx.err.Line {
t.Errorf("wanted:\n%d\ngot:\n%d", e.line, ctx.err.Line)
}
if !strings.Contains(ctx.err.Message, e.message) {
t.Errorf("%q does not contain %q", ctx.err.Message, e.message)
}
}
func TestError_import(t *testing.T) {
in := bytes.NewBufferString(`span {}
@import "fail";
`)
out := bytes.NewBuffer([]byte(""))
ctx := newContext()
err := ctx.compile(out, in)
if err == nil {
t.Error("No error returned")
}
e := ErrorMap{2, `File to import not found or unreadable: fail.`}
if e.line != ctx.err.Line {
t.Errorf("wanted:\n%d\ngot:\n%d", e.line, ctx.err.Line)
}
if !strings.Contains(ctx.err.Message, e.message) {
t.Errorf("%q does not contain %q", ctx.err.Message, e.message)
}
}
func TestError_processsass(t *testing.T) {
in := []byte(`{
"status": 1,
"file": "stdin",
"line": 3100,
"column": 20,
"message": "error in C function inline-image: format: .svg not supported\nBacktrace:\n\tstdin:3100, in function inline-image\n\tstdin:3100, in mixin printCSSImg\n\tstdin:3117"
}`)
ctx := newContext()
err := ctx.ProcessSassError(in)
if err != nil {
t.Error(err)
}
e := `Error > stdin:3100
error in C function inline-image: format: .svg not supported
Backtrace:
stdin:3100, in function inline-image
stdin:3100, in mixin printCSSImg
stdin:3117`
if e != ctx.Error() {
t.Errorf("got:\n%s\nwanted:\n%s", err.Error(), e)
}
}
func TestError_invalid(t *testing.T) {
ctx := newContext()
err := ctx.ProcessSassError([]byte("/a"))
if len(err.Error()) == 0 {
t.Error("No error thrown on invalid sass json package")
}
}
func TestError_line(t *testing.T) {
ctx := newContext()
ctx.errorString = "Error > stdin:1000"
if e := 1000; e != ctx.ErrorLine() {
t.Errorf("got: %d wanted: %d", ctx.ErrorLine(), e)
}
}
================================================
FILE: examples/basic/file.scss
================================================
div {
p { color: black; }
}
================================================
FILE: examples/basic/main.go
================================================
package main
import (
"log"
"os"
libsass "github.com/wellington/go-libsass"
)
func main() {
r, err := os.Open("file.scss")
if err != nil {
log.Fatal(err)
}
comp, err := libsass.New(os.Stdout, r)
if err != nil {
log.Fatal(err)
}
if err := comp.Run(); err != nil {
log.Fatal(err)
}
}
================================================
FILE: examples/customfunc/README.md
================================================
Cryptographically secure pseudorandom number generator in Sass. Well that is easy to do with this custom `crypto()` handler!
Start by registering a Sass function with the name `crypto()`. Now when `crypto()` is found in Sass, the cryptotext Go function will be called.
Input
``` sass
div { text: crypto(); }
```
Output
``` css
div {
text: 'c91db27d5e580ef4292e'; }
```
Sass function written in Go
``` go
func cryptotext(ctx context.Context, usv libsass.SassValue) (*libsass.SassValue, error) {
c := 10
b := make([]byte, c)
_, err := rand.Read(b)
if err != nil {
return nil, err
}
res, err := libsass.Marshal(fmt.Sprintf("'%x'", b))
return &res, err
}
```
================================================
FILE: examples/customfunc/main.go
================================================
package main
import (
"bytes"
"context"
"crypto/rand"
"fmt"
"log"
"os"
"github.com/wellington/go-libsass"
)
// cryptotext is of type libsass.SassFunc. As libsass compiles the
// source Sass, it will look for `crypto()` then call this function.
func cryptotext(ctx context.Context, usv libsass.SassValue) (*libsass.SassValue, error) {
c := 10
b := make([]byte, c)
_, err := rand.Read(b)
if err != nil {
return nil, err
}
res, err := libsass.Marshal(fmt.Sprintf("'%x'", b))
return &res, err
}
func main() {
// Register a custom Sass func crypto
libsass.RegisterSassFunc("crypto()", cryptotext)
// Input Sass source
input := `div { text: crypto(); }`
buf := bytes.NewBufferString(input)
// Starts a compiler writing to Stdout and reading from
// a bytes buffer of the input source
comp, err := libsass.New(os.Stdout, buf)
if err != nil {
log.Fatal(err)
}
// Run() kicks off the compiler and instructs libsass how
// to read our input, handling the output from libsass
if err := comp.Run(); err != nil {
log.Fatal(err)
}
// Output:
// div {
// text: 'c91db27d5e580ef4292e'; }
}
================================================
FILE: examples/custompreamble/README.md
================================================
Example using libSass Headers. Headers include Sass code at the top of every file. It is used by Wellington to include mixins like sprite-dimensions. In this example, we add a preamble to every file. It could be used to add license notes or include base styles that are shared everywhere.
================================================
FILE: examples/custompreamble/main.go
================================================
// Create a preamble for every CSS file
package main
import (
"bytes"
"log"
"os"
"github.com/wellington/go-libsass"
)
func main() {
libsass.RegisterHeader(`
/*
* This is a preamble which will be added to every CSS file generated.
* It uses the libSass header which includes the text on every file.
*
*/`)
// Input Sass source
input := `div {}`
buf := bytes.NewBufferString(input)
// Starts a compiler writing to Stdout and reading from
// a bytes buffer of the input source
comp, err := libsass.New(os.Stdout, buf)
if err != nil {
log.Fatal(err)
}
// Run() kicks off the compiler and instructs libsass how
// to read our input, handling the output from libsass
if err := comp.Run(); err != nil {
log.Fatal(err)
}
// Output:
// /*
// * This is a preamble which will be added to every CSS file generated.
// * It uses the libSass header which includes the text on every file.
// *
// */
//
}
================================================
FILE: examples/options/file.scss
================================================
@import "settings"
html {
background-color: $bg;
}
================================================
FILE: examples/options/main.go
================================================
package main
import (
"log"
"os"
libsass "github.com/wellington/go-libsass"
)
func main() {
r, err := os.Open("file.scss")
if err != nil {
log.Fatal(err)
}
comp, err := libsass.New(os.Stdout, r)
if err != nil {
log.Fatal(err)
}
// configure @import paths
includePaths := []string{"partials"}
err = comp.Option(libsass.IncludePaths(includePaths))
if err != nil {
log.Fatal(err)
}
if err := comp.Run(); err != nil {
log.Fatal(err)
}
}
================================================
FILE: examples/options/partials/_settings.sass
================================================
$bg: red
================================================
FILE: export.go
================================================
package libsass
import "github.com/wellington/go-libsass/libs"
// Error takes a Go error and returns a libsass Error
func Error(err error) SassValue {
return SassValue{value: libs.MakeError(err.Error())}
}
// Warn takes a string and causes a warning in libsass
func Warn(s string) SassValue {
return SassValue{value: libs.MakeWarning(s)}
}
================================================
FILE: export_test.go
================================================
package libsass
import (
"errors"
"testing"
)
func TestRegisterHandler(t *testing.T) {
l := len(globalHandlers)
RegisterHandler("foo",
func(v interface{}, csv SassValue, rsv *SassValue) error {
u, _ := Marshal(false)
*rsv = u
return nil
})
if e := l + 1; len(globalHandlers) != e {
t.Errorf("got: %d wanted: %d", len(globalHandlers), e)
}
}
func TestError_simple(t *testing.T) {
err := errors.New("help me")
sv := Error(err)
var s string
Unmarshal(sv, &s)
if err.Error() != s {
t.Errorf("got: %s wanted: %s", s, err)
}
}
================================================
FILE: file_test.go
================================================
package libsass
import (
"bytes"
"path/filepath"
"strings"
"testing"
)
func TestFile_resolved(t *testing.T) {
path := "test/scss/main.scss"
var out bytes.Buffer
ctx := newContext()
err := ctx.fileCompile(path, &out, "", "")
if err != nil {
panic(err)
}
e := ``
if e != out.String() {
t.Errorf("wanted:\n%s\n"+
"got:\n%s\n", e, out.String())
}
if e := 1; len(ctx.ResolvedImports) != e {
t.Errorf("got: %d wanted: %d", len(ctx.ResolvedImports), e)
}
abs, err := filepath.Abs(".")
if err != nil {
t.Fatal(err)
}
relPath := strings.TrimPrefix(ctx.ResolvedImports[0], abs)
if !strings.HasSuffix(relPath, path) {
t.Errorf("got: %s wanted: %s", relPath, e)
}
}
================================================
FILE: func.go
================================================
package libsass
import (
"context"
"errors"
"fmt"
"sync"
"github.com/wellington/go-libsass/libs"
)
var ghMu sync.RWMutex
// globalHandlers is the list of handlers registered externally
var globalHandlers []handler
// RegisterSassFunc assigns the passed Func to the specified signature sign
func RegisterSassFunc(sign string, fn SassFunc) {
ghMu.Lock()
globalHandlers = append(globalHandlers, handler{
sign: sign,
callback: SassHandler(fn),
})
ghMu.Unlock()
}
type key int
const (
compkey key = iota
)
func NewCompilerContext(c Compiler) context.Context {
return context.WithValue(context.TODO(), compkey, c)
}
var ErrCompilerNotFound = errors.New("compiler not found")
// CompFromCtx retrieves a compiler from a passed context
func CompFromCtx(ctx context.Context) (Compiler, error) {
v := ctx.Value(compkey)
comp, ok := v.(Compiler)
if !ok {
return comp, ErrCompilerNotFound
}
return comp, nil
}
// SassFunc describes func for handling Sass Values
type SassFunc func(ctx context.Context, in SassValue) (*SassValue, error)
// SassHandler contains callback context for running code within
// a libsass handler
func SassHandler(h SassFunc) libs.SassCallback {
return func(v interface{}, usv libs.UnionSassValue, rsv *libs.UnionSassValue) error {
if *rsv == nil {
*rsv = libs.MakeNil()
}
libCtx, ok := v.(*compctx)
if !ok {
return errors.New("libsass Context not found")
}
ctx := NewCompilerContext(libCtx.compiler)
// Cast to exported Go types
req := SassValue{value: usv}
res, err := h(ctx, req)
if err != nil {
// Returns the error to libsass Compiler
*rsv = libs.MakeError(err.Error())
// Returning an error does nothing as libsass is in charge of
// reporting error to user
return err
}
*rsv = res.Val()
return err
}
}
// RegisterHandler sets the passed signature and callback to the
// handlers array.
func RegisterHandler(sign string, callback HandlerFunc) {
ghMu.Lock()
globalHandlers = append(globalHandlers, handler{
sign: sign,
callback: Handler(callback),
})
ghMu.Unlock()
}
// HandlerFunc describes the method signature for registering
// a Go function to be called by libsass.
type HandlerFunc func(v interface{}, req SassValue, res *SassValue) error
// Handler accepts a HandlerFunc and returns SassCallback for sending
// to libsass. The third argument must be a pointer and the function
// must return an error.
func Handler(h HandlerFunc) libs.SassCallback {
return func(v interface{}, usv libs.UnionSassValue, rsv *libs.UnionSassValue) error {
if *rsv == nil {
*rsv = libs.MakeNil()
}
req := SassValue{value: usv}
res := SassValue{value: *rsv}
err := h(v, req, &res)
if rsv != nil {
*rsv = res.Val()
}
return err
}
}
type handler struct {
sign string
callback libs.SassCallback
}
var _ libs.SassCallback = TestCallback
func testCallback(h HandlerFunc) libs.SassCallback {
return func(v interface{}, _ libs.UnionSassValue, _ *libs.UnionSassValue) error {
return nil
}
}
// TestCallback implements libs.SassCallback. TestCallback is a useful
// place to start when developing new handlers.
var TestCallback = testCallback(func(_ interface{}, _ SassValue, _ *SassValue) error {
return nil
})
// Cookie is used for passing context information to libsass. Cookie is
// passed to custom handlers when libsass executes them through the go
// bridge.
type Func struct {
Sign string
Fn libs.SassCallback
Ctx interface{}
}
type Funcs struct {
sync.RWMutex
wg sync.WaitGroup
closing chan struct{}
f []Func
idx []int
// Func are complex, we need a reference to the entire context to
// successfully execute them.
ctx *compctx
}
func NewFuncs(ctx *compctx) *Funcs {
return &Funcs{
closing: make(chan struct{}),
ctx: ctx,
}
}
func (fs *Funcs) Add(f Func) {
fs.Lock()
defer fs.Unlock()
fs.f = append(fs.f, f)
}
// SetFunc assigns the registered methods to SassOptions. Functions
// are called when the compiler encounters the registered signature.
func (fs *Funcs) Bind(goopts libs.SassOptions) {
ghMu.RLock()
cookies := make([]libs.Cookie, len(globalHandlers)+len(fs.f))
// Append registered handlers to cookie array
for i, h := range globalHandlers {
cookies[i] = libs.Cookie{
Sign: h.sign,
Fn: h.callback,
Ctx: fs.ctx,
}
}
l := len(globalHandlers)
ghMu.RUnlock()
for i, h := range fs.f {
cookies[i+l] = libs.Cookie{
Sign: h.Sign,
Fn: h.Fn,
Ctx: fs.ctx,
}
}
fs.idx = libs.BindFuncs(goopts, cookies)
}
func (fs *Funcs) Close() {
err := libs.RemoveFuncs(fs.idx)
if err != nil {
fmt.Println("error cleaning up funcs", err)
}
close(fs.closing)
fs.wg.Wait()
}
================================================
FILE: func_test.go
================================================
package libsass
import (
"bytes"
"image/color"
"reflect"
"testing"
"time"
"github.com/wellington/go-libsass/libs"
)
func TestFunc_simpletypes(t *testing.T) {
in := bytes.NewBufferString(`div {
background: foo(null, 3px, asdf, false);
}`)
//var out bytes.Buffer
ctx := newContext()
// Communication channel for the C Sass callback function
ch := make(chan []interface{}, 1)
ctx.Funcs.Add(Func{
Sign: "foo($null, $num, $str, $bool)",
Fn: Handler(func(v interface{}, req SassValue, res *SassValue) error {
var n interface{}
var num libs.SassNumber
var s string
var b bool
var intf = []interface{}{n, num, s, b}
err := Unmarshal(req, &intf)
if err != nil {
t.Fatal(err)
}
// Send the interface fn arguments to the ch channel
ch <- intf
return nil
}),
Ctx: &ctx,
})
var out bytes.Buffer
err := ctx.compile(&out, in)
if err != nil {
t.Error(err)
}
e := []interface{}{
"<nil>",
libs.SassNumber{Value: 3.0, Unit: "px"},
"asdf",
false,
}
var args []interface{}
select {
case <-time.After(10 * time.Millisecond):
t.Fatal("timeout")
case args = <-ch:
}
if !reflect.DeepEqual(e, args) {
t.Errorf("wanted:\n% #v\ngot:\n% #v", e, args)
}
}
func TestFunc_colortype(t *testing.T) {
in := bytes.NewBufferString(`div {
background: foo(#005500);
}`)
//var out bytes.Buffer
ctx := newContext()
// Communication channel for the C Sass callback function
ch := make(chan []interface{}, 1)
ctx.Funcs.Add(Func{
Sign: "foo($color)",
Fn: func(v interface{}, usv libs.UnionSassValue, rsv *libs.UnionSassValue) error {
// Send the interface fn arguments to the ch channel
var infs = []interface{}{color.RGBA{}}
err := Unmarshal(SassValue{value: usv}, &infs)
if err != nil {
t.Fatal(err)
}
ch <- infs
res, _ := Marshal(false)
*rsv = res.Val()
return nil
},
Ctx: &ctx,
})
var out bytes.Buffer
err := ctx.compile(&out, in)
if err != nil {
t.Error(err)
}
e := []interface{}{
color.RGBA{R: 0x0, G: 0x55, B: 0x0, A: 0x1},
}
var args []interface{}
select {
case <-time.After(100 * time.Millisecond):
t.Fatal("timeout")
case args = <-ch:
}
if !reflect.DeepEqual(e, args) {
t.Errorf("wanted:\n% #v\ngot:\n% #v", e, args)
}
}
func TestFunc_complextypes(t *testing.T) {
in := bytes.NewBufferString(`div {
background: foo((a,b,1mm,#003300));
}`)
var out bytes.Buffer
ctx := newContext()
ch := make(chan interface{}, 1)
ctx.Funcs.Add(Func{
Sign: "foo($list)",
Fn: func(v interface{}, usv libs.UnionSassValue, rsv *libs.UnionSassValue) error {
var sv interface{}
Unmarshal(SassValue{value: usv}, &sv)
ch <- sv
res, _ := Marshal(false)
*rsv = res.Val()
return nil
},
Ctx: &ctx,
})
err := ctx.compile(&out, in)
if err != nil {
t.Error(err)
}
e := []interface{}{
"a",
"b",
libs.SassNumber{Value: 1, Unit: "mm"},
color.RGBA{R: 0x0, G: 0x33, B: 0x0, A: 0x1},
}
var args interface{}
select {
case <-time.After(100 * time.Millisecond):
t.Fatal("timeout")
case args = <-ch:
}
if !reflect.DeepEqual(e, args) {
t.Errorf("wanted:\n%#v\ngot:\n% #v", e, args)
}
}
func TestFunc_customarity(t *testing.T) {
in := bytes.NewBufferString(`div {
color: red(blue);
background: foo(1pt, 2cm);
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Funcs.Add(Func{
Sign: "foo()",
Fn: TestCallback,
Ctx: &ctx,
})
err := ctx.compile(&out, in)
if err == nil {
t.Error("No error thrown for incorrect arity")
}
e := "wrong number of arguments (2 for 0) for `foo'"
if e != ctx.err.Message {
t.Errorf("wanted:\n%s\ngot:\n%s\n", e, ctx.err.Message)
}
e = `Error > stdin:3
wrong number of arguments (2 for 0) for ` + "`" + `foo'
div {
color: red(blue);
background: foo(1pt, 2cm);
}
`
if e != err.Error() {
t.Errorf("wanted:\n%s\ngot:\n%s\n", e, err)
}
}
================================================
FILE: go.mod
================================================
module github.com/wellington/go-libsass
go 1.18
require golang.org/x/net v0.0.0-20220921203646-d300de134e69
================================================
FILE: go.sum
================================================
golang.org/x/net v0.0.0-20220921203646-d300de134e69 h1:hUJpGDpnfwdJW8iNypFjmSY0sCBEL+spFTZ2eO+Sfps=
golang.org/x/net v0.0.0-20220921203646-d300de134e69/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
================================================
FILE: header.go
================================================
package libsass
import (
"strconv"
"sync"
"github.com/wellington/go-libsass/libs"
)
var globalHeaders []string
// RegisterHeader fifo
func RegisterHeader(body string) {
ghMu.Lock()
globalHeaders = append(globalHeaders, body)
ghMu.Unlock()
}
type Header struct {
idx *string
Content string
}
type Headers struct {
wg sync.WaitGroup
closing chan struct{}
sync.RWMutex
h []Header
// idx is a pointer for libsass to lookup these Headers
idx int
}
// NewHeaders instantiates a Headers for prefixing Sass to input
// See: https://github.com/sass/libsass/wiki/API-Sass-Importer
func NewHeaders() *Headers {
h := &Headers{
closing: make(chan struct{}),
}
return h
}
func (hdrs *Headers) Bind(opts libs.SassOptions) {
// Push the headers into the local array
ghMu.RLock()
for _, gh := range globalHeaders {
if !hdrs.Has(gh) {
hdrs.Add(gh)
}
}
ghMu.RUnlock()
// Loop through headers creating ImportEntry
entries := make([]libs.ImportEntry, hdrs.Len())
hdrs.RLock()
for i, ent := range hdrs.h {
uniquename := "hdr" + strconv.FormatInt(int64(i), 10)
entries[i] = libs.ImportEntry{
// Each entry requires a unique identifier
// https://github.com/sass/libsass/issues/1292
Path: uniquename,
Source: ent.Content,
SrcMap: "",
}
}
hdrs.RUnlock()
// Preserve reference to libs address to these entries
hdrs.idx = libs.BindHeader(opts, entries)
}
func (hdrs *Headers) Close() {
// Clean up memory reserved for headers
libs.RemoveHeaders(hdrs.idx)
close(hdrs.closing)
hdrs.wg.Wait()
}
func (h *Headers) Add(s string) {
h.Lock()
defer h.Unlock()
h.h = append(h.h, Header{
Content: s,
})
}
func (h *Headers) Has(s string) bool {
for _, c := range h.h {
if s == c.Content {
return true
}
}
return false
}
func (h *Headers) Len() int {
return len(h.h)
}
================================================
FILE: header_test.go
================================================
package libsass
import (
"bytes"
"testing"
)
func TestSassHeader_single(t *testing.T) {
in := bytes.NewBufferString(`div {
@include mix();
}
`)
var out bytes.Buffer
ctx := newContext()
ctx.Headers.Add(`@mixin mix() {
width: 50px;
}
`)
err := ctx.compile(&out, in)
if err != nil {
for _, h := range ctx.Headers.h {
t.Logf("% #v\n", h)
}
t.Fatal(err)
}
e := `div {
width: 50px; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassHeader_multi(t *testing.T) {
in := bytes.NewBufferString(`div {
@include mix();
color: red();
}
`)
var out bytes.Buffer
ctx := newContext()
ctx.Headers.Add(`@mixin mix() {
width: 50px;
}
`)
ctx.Headers.Add(`@function red() { @return red; }`)
err := ctx.compile(&out, in)
if err != nil {
t.Fatal(err)
}
e := `div {
width: 50px;
color: red; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
================================================
FILE: importer.go
================================================
package libsass
import (
"errors"
"io"
"sync"
"time"
"github.com/wellington/go-libsass/libs"
)
var (
ErrImportNotFound = errors.New("Import unreachable or not found")
)
// Import contains Rel and Abs path and a string of the contents
// representing an import.
type Import struct {
Body io.ReadCloser
bytes []byte
mod time.Time
Prev string
Path string
}
// ModTime returns modification time
func (i Import) ModTime() time.Time {
return i.mod
}
// Imports is a map with key of "path/to/file"
type Imports struct {
wg sync.WaitGroup
closing chan struct{}
sync.RWMutex
m map[string]Import
resolver ResolverCallback
idx int
}
type ResolverCallback struct {
resolverMode libs.ResolverMode
resolverFn libs.ImportResolver
}
func NewImports() *Imports {
return &Imports{
closing: make(chan struct{}),
}
}
func NewImportsWithResolver(resolver libs.ImportResolver) *Imports {
return &Imports{
closing: make(chan struct{}),
resolver: ResolverCallback{
resolverMode: libs.ResolverModeImporterUrl,
resolverFn: resolver,
},
}
}
func NewImportsWithAbsResolver(resolver libs.ImportResolver) *Imports {
return &Imports{
closing: make(chan struct{}),
resolver: ResolverCallback{
resolverMode: libs.ResolverModeImporterAbsPath,
resolverFn: resolver,
},
}
}
func (i *Imports) Close() {
close(i.closing)
i.wg.Wait()
}
// Init sets up a new Imports map
func (p *Imports) Init() {
p.m = make(map[string]Import)
}
// Add registers an import in the context.Imports
func (p *Imports) Add(prev string, path string, bs []byte) error {
p.Lock()
defer p.Unlock()
// TODO: align these with libsass name "stdin"
if len(prev) == 0 || prev == "string" {
prev = "stdin"
}
im := Import{
bytes: bs,
mod: time.Now(),
Prev: prev,
Path: path,
}
p.m[prev+":"+path] = im
return nil
}
// Del removes the import from the context.Imports
func (p *Imports) Del(path string) {
p.Lock()
defer p.Unlock()
delete(p.m, path)
}
// Get retrieves import bytes by path
func (p *Imports) Get(prev, path string) ([]byte, error) {
p.RLock()
defer p.RUnlock()
for _, imp := range p.m {
if imp.Prev == prev && imp.Path == path {
return imp.bytes, nil
}
}
return nil, ErrImportNotFound
}
// Update attempts to create a fresh Body from the given path
// Files last modified stamps are compared against import timestamp
func (p *Imports) Update(name string) {
p.Lock()
defer p.Unlock()
}
// Len counts the number of entries in context.Imports
func (p *Imports) Len() int {
return len(p.m)
}
// Bind accepts a SassOptions and adds the registered
// importers in the context.
func (p *Imports) Bind(opts libs.SassOptions) {
entries := make([]libs.ImportEntry, p.Len())
i := 0
p.RLock()
for _, ent := range p.m {
bs := ent.bytes
entries[i] = libs.ImportEntry{
Parent: ent.Prev,
Path: ent.Path,
Source: string(bs),
}
i++
}
p.RUnlock()
wrappedResolverFn := func(url string, prev string) (newURL string, body string, resolved bool) {
if p.resolver.resolverFn != nil {
newURL, body, resolved = p.resolver.resolverFn(url, prev)
if resolved {
return
}
}
entry, err := libs.GetEntry(entries, prev, url)
if err == nil {
return url, entry, true
}
return "", "", false
}
// set entries somewhere so GC doesn't collect it
p.idx = libs.BindImporter(opts, p.resolver.resolverMode, wrappedResolverFn)
}
================================================
FILE: importer_test.go
================================================
package libsass
import (
"bytes"
"strings"
"testing"
)
func TestSassImport_single(t *testing.T) {
in := bytes.NewBufferString(`@import "a";`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("", "a", []byte("a { color: blue; }"))
err := ctx.compile(&out, in)
if err != nil {
t.Fatal(err)
}
e := `a {
color: blue; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassImport_file(t *testing.T) {
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("test/scss/file.scss", "a", []byte("a { color: blue; }"))
err := ctx.fileCompile("test/scss/file.scss", &out, "", "")
if err != nil {
t.Fatal(err)
}
e := `a {
color: blue; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassImport_multi(t *testing.T) {
in := bytes.NewBufferString(`@import "a";
@import "b";`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("", "a", []byte("a { color: blue; }"))
ctx.Imports.Add("", "b", []byte("b { font-weight: bold; }"))
err := ctx.compile(&out, in)
if err != nil {
t.Fatal(err)
}
e := `a {
color: blue; }
b {
font-weight: bold; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassImporter_placeholder(t *testing.T) {
in := bytes.NewBufferString(`@import "branch";
div.branch {
@extend %branch;
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("", "branch", []byte(`%branch { color: brown; }`))
err := ctx.compile(&out, in)
if err != nil {
t.Fatal(err)
}
e := `div.branch {
color: brown; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassImporter_nested_placeholder(t *testing.T) {
in := bytes.NewBufferString(`@import "branch";
div.branch {
@extend %branch;
div.leaf {
@extend %leaf;
}
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("", "branch", []byte(`@import "leaf";
%branch { color: brown; }`))
ctx.Imports.Add("branch", "leaf", []byte("%leaf { color: green; }"))
err := ctx.compile(&out, in)
if err != nil {
t.Fatal(err)
}
e := `div.branch div.leaf {
color: green; }
div.branch {
color: brown; }
`
if e != out.String() {
t.Fatalf("got:\n%s\nwanted:\n%s", out.String(), e)
}
}
func TestSassImporter_invalidimport(t *testing.T) {
in := bytes.NewBufferString(`@import "branch";
div.branch {
@extend %branch;
div.leaf {
@extend %leaf;
}
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
err := ctx.compile(&out, in)
if err == nil {
t.Fatal("No error thrown for missing import")
}
msg := "File to import not found or unreadable: branch."
if !strings.Contains(err.Error(), msg) {
t.Errorf("%q does not contain %q", err.Error(), msg)
}
}
func TestSassImporter_notfound(t *testing.T) {
in := bytes.NewBufferString(`@import "branch";
div.branch {
@extend %branch;
div.leaf {
@extend %leaf;
}
}`)
var out bytes.Buffer
ctx := newContext()
ctx.Imports.m = make(map[string]Import)
ctx.Imports.Add("", "nope", []byte(`@import "leaf";
%branch { color: brown; }`))
err := ctx.compile(&out, in)
msg := "File to import not found or unreadable: branch."
if !strings.Contains(err.Error(), msg) {
t.Errorf("%q does not contain %q", err.Error(), msg)
}
}
================================================
FILE: libs/SharedPtr.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/memory/SharedPtr.hpp"
#endif
================================================
FILE: libs/ast.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/ast.hpp"
#endif
================================================
FILE: libs/ast_fwd_decl.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/ast_fwd_decl.hpp"
#endif
================================================
FILE: libs/base64vlq.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/base64vlq.hpp"
#endif
================================================
FILE: libs/bind.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/bind.hpp"
#endif
================================================
FILE: libs/cencode.c
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/cencode.c"
#endif
================================================
FILE: libs/check_nesting.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/check_nesting.hpp"
#endif
================================================
FILE: libs/color_maps.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/color_maps.hpp"
#endif
================================================
FILE: libs/color_names.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/color_names.hpp"
#endif
================================================
FILE: libs/constants.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/constants.hpp"
#endif
================================================
FILE: libs/context.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/context.hpp"
#endif
================================================
FILE: libs/cssize.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/cssize.hpp"
#endif
================================================
FILE: libs/docs.go
================================================
// libs is a direct mapping to libsass C API. This package should not be
// necessary to do any high level operations. It is instead intended
// that go-libsass handles everything needed in your project.
//
// In case where low level API calls are necessary, use this package
// to do so. For more details on what these methods do see:
// https://github.com/sass/libsass/wiki/API-Documentation
//
// For the most part, consider this a hand curated SWIG of libsass C API.
package libs
================================================
FILE: libs/emitter.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/emitter.hpp"
#endif
================================================
FILE: libs/encoding.go
================================================
package libs
// #include <stdlib.h>
// #include "sass/context.h"
import "C"
import (
"image/color"
"reflect"
"unsafe"
)
type UnionSassValue *C.union_Sass_Value
// NewUnionSassValue creates a new empty UnionSassValue
func NewUnionSassValue() UnionSassValue {
return MakeNil()
}
func CloneValue(usv UnionSassValue) UnionSassValue {
return C.sass_clone_value(usv)
}
func DeleteValue(usv UnionSassValue) {
C.sass_delete_value(usv)
}
// MakeNil creates Sass nil
func MakeNil() UnionSassValue {
return C.sass_make_null()
}
// MakeBool creates Sass bool from a bool
func MakeBool(b bool) UnionSassValue {
return C.sass_make_boolean(C.bool(b))
}
// MakeError creates Sass error from a string
func MakeError(s string) UnionSassValue {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
return C.sass_make_error(cs)
}
// MakeWarning creates Sass warning from a string
func MakeWarning(s string) UnionSassValue {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
return C.sass_make_warning(cs)
}
func MakeString(s string) UnionSassValue {
str := C.CString(s)
defer C.free(unsafe.Pointer(str))
return C.sass_make_string(str)
}
// TODO: validate unit
func MakeNumber(f float64, unit string) UnionSassValue {
cunit := C.CString(unit)
cf := C.double(f)
defer C.free(unsafe.Pointer(cunit))
return C.sass_make_number(cf, cunit)
}
// MakeColor creates a Sass color from color.RGBA
func MakeColor(c color.RGBA) UnionSassValue {
r := C.double(c.R)
g := C.double(c.G)
b := C.double(c.B)
a := C.double(c.A)
return C.sass_make_color(r, g, b, a)
}
// MakeList creates a Sass List
func MakeList(len int) UnionSassValue {
return C.sass_make_list(C.size_t(len), C.SASS_COMMA, false)
}
// MakeMap cretes a new Sass Map
func MakeMap(len int) UnionSassValue {
return C.sass_make_map(C.size_t(len))
}
// Slice creates a Sass List from a Go slice. Reflection is used.
func Slice(usv UnionSassValue, inf interface{}) {
if !IsList(usv) {
panic("sass value is not a list")
}
l := Len(usv)
r := reflect.ValueOf(inf)
if r.Kind() == reflect.Ptr {
r = r.Elem()
}
if !r.CanSet() {
panic("value is not addressable")
}
// if a non-slice is passed, make a slice
t := r.Type()
if r.Kind() != reflect.Slice {
t = reflect.SliceOf(t)
}
d := reflect.MakeSlice(t, l, l)
for i := 0; i < l; i++ {
sv := Index(usv, i)
inf := Interface(sv)
rf := reflect.ValueOf(inf)
// Special case for nil
if inf == nil {
d.Index(i).Set(reflect.ValueOf("<nil>"))
continue
}
d.Index(i).Set(rf)
}
r.Set(d)
}
func IsNil(usv UnionSassValue) bool {
return bool(C.sass_value_is_null(usv))
}
func IsBool(usv UnionSassValue) bool {
return bool(C.sass_value_is_boolean(usv))
}
func IsString(usv UnionSassValue) bool {
return bool(C.sass_value_is_string(usv))
}
func IsColor(usv UnionSassValue) bool {
return bool(C.sass_value_is_color(usv))
}
func IsNumber(usv UnionSassValue) bool {
return bool(C.sass_value_is_number(usv))
}
func IsList(usv UnionSassValue) bool {
return bool(C.sass_value_is_list(usv))
}
func IsMap(usv UnionSassValue) bool {
return bool(C.sass_value_is_map(usv))
}
func IsError(usv UnionSassValue) bool {
return bool(C.sass_value_is_error(usv))
}
// Interface creates Go types from union sass_value
func Interface(usv UnionSassValue) interface{} {
switch {
case IsNil(usv):
return nil
case IsBool(usv):
return Bool(usv)
case IsString(usv):
return String(usv)
case IsColor(usv):
return Color(usv)
case IsNumber(usv):
return Number(usv)
case IsList(usv):
fallthrough
//return List(usv)
case IsMap(usv):
fallthrough
//return Map(usv)
default:
return nil
}
panic("call of interface not supported on type")
}
func Len(usv UnionSassValue) int {
switch {
case IsList(usv):
return int(C.sass_list_get_length(usv))
case IsMap(usv):
return int(C.sass_map_get_length(usv))
}
panic("call of len on unknown type")
}
func Error(usv UnionSassValue) string {
c := C.sass_error_get_message(usv)
gc := C.GoString(c)
return gc
}
func String(usv UnionSassValue) string {
c := C.sass_string_get_value(usv)
gc := C.GoString(c)
return gc
}
type SassNumber struct {
Value float64
Unit string
}
func (n SassNumber) Float() float64 {
return n.Value
}
func (n SassNumber) UnitOf() string {
return n.Unit
}
func Number(usv UnionSassValue) SassNumber {
return SassNumber{
Value: Float(usv),
Unit: Unit(usv),
}
}
func Float(usv UnionSassValue) float64 {
f := C.sass_number_get_value(usv)
return float64(f)
}
func Unit(usv UnionSassValue) string {
c := C.sass_number_get_unit(usv)
return C.GoString(c)
}
func Bool(usv UnionSassValue) bool {
b := C.sass_boolean_get_value(usv)
return bool(b)
}
func Color(usv UnionSassValue) color.Color {
return color.RGBA{
R: uint8(C.sass_color_get_r(usv)),
G: uint8(C.sass_color_get_g(usv)),
B: uint8(C.sass_color_get_b(usv)),
A: uint8(C.sass_color_get_a(usv)),
}
}
func Index(usv UnionSassValue, i int) UnionSassValue {
switch {
case IsList(usv):
return C.sass_list_get_value(usv, C.size_t(i))
default:
panic("call of index on unknown type")
}
return NewUnionSassValue()
}
func SetIndex(usv UnionSassValue, i int, item UnionSassValue) {
switch {
case IsList(usv):
C.sass_list_set_value(usv, C.size_t(i), item)
return
default:
}
panic("call of setindex on unknown type")
}
func MapKeys(m UnionSassValue) []UnionSassValue {
res := make([]UnionSassValue, Len(m))
for i := range res {
res[i] = C.sass_map_get_key(m, C.size_t(i))
}
return res
}
func mapVals(m UnionSassValue) []UnionSassValue {
res := make([]UnionSassValue, Len(m))
for i := range res {
res[i] = C.sass_map_get_value(m, C.size_t(i))
}
return res
}
// TODO: support maps
// func MapIndex(m UnionSassValue, key UnionSassValue) UnionSassValue {
// keys := MapKeys(m)
// }
================================================
FILE: libs/environment.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/environment.hpp"
#endif
================================================
FILE: libs/error_handling.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/error_handling.hpp"
#endif
================================================
FILE: libs/eval.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/eval.hpp"
#endif
================================================
FILE: libs/expand.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/expand.hpp"
#endif
================================================
FILE: libs/export.go
================================================
package libs
// #include "sass/context.h"
//
import "C"
import (
"fmt"
"sync"
)
// SassCallback defines the callback libsass eventually executes in
// sprite_sass
type SassCallback func(v interface{}, csv UnionSassValue, rsv *UnionSassValue) error
// Cookie is used for passing context information to libsass. Cookie is
// passed to custom handlers when libsass executes them through the go
// bridge.
type Cookie struct {
Sign string
Fn SassCallback
Ctx interface{}
}
// gate gobridge, it has some unknown race conditions
var gobridgeMu sync.Mutex
// GoBridge is exported to C for linking libsass to Go. This function
// adheres to the interface provided by libsass.
//
//export GoBridge
func GoBridge(cargs UnionSassValue, cidx C.int) UnionSassValue {
// Recover the Cookie struct passed in
idx := int(cidx)
ck, ok := globalFuncs.Get(idx).(Cookie)
if !ok {
fmt.Printf("failed to resolve Cookie %d\n", idx)
return MakeNil()
}
// ck := *(*Cookie)(ptr)
var usv UnionSassValue
err := ck.Fn(ck.Ctx, cargs, &usv)
_ = err
return usv
}
================================================
FILE: libs/extend.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/extend.hpp"
#endif
================================================
FILE: libs/file.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/file.hpp"
#endif
================================================
FILE: libs/func.go
================================================
package libs
// #include <stdint.h>
// #include <stdlib.h>
// #include "sass/context.h"
//
// extern union Sass_Value* GoBridge( union Sass_Value* s_args, uintptr_t idx);
//
// union Sass_Value* CallSassFunction( union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Options* opts ) {
// void* cookie = sass_function_get_cookie(cb);
// union Sass_Value* ret;
// uintptr_t idx = (uintptr_t)cookie;
// ret = GoBridge(s_args, idx);
// return ret;
// }
//
import "C"
import "unsafe"
type SassFunc C.Sass_Function_Entry
// SassMakeFunction binds a Go pointer to a Sass function signature
func SassMakeFunction(signature string, idx int) SassFunc {
csign := C.CString(signature)
ptr := unsafe.Pointer(uintptr(idx))
fn := C.sass_make_function(
csign,
C.Sass_Function_Fn(C.CallSassFunction),
ptr)
return (SassFunc)(fn)
}
var globalFuncs SafeMap
func init() {
globalFuncs.init()
}
// BindFuncs attaches a slice of Functions to a sass options. Signatures
// are already defined in the SassFunc.
func BindFuncs(opts SassOptions, cookies []Cookie) []int {
funcs := make([]SassFunc, len(cookies))
ids := make([]int, len(cookies))
for i, cookie := range cookies {
idx := globalFuncs.Set(cookies[i])
fn := SassMakeFunction(cookie.Sign, idx)
funcs[i] = fn
ids[i] = idx
}
sz := C.size_t(len(funcs))
cfuncs := C.sass_make_function_list(sz)
for i, cfn := range funcs {
C.sass_function_set_list_entry(cfuncs, C.size_t(i), C.Sass_Function_Entry(cfn))
}
C.sass_option_set_c_functions(opts, cfuncs)
return ids
}
func RemoveFuncs(ids []int) error {
for _, idx := range ids {
globalFuncs.Del(idx)
}
return nil
}
================================================
FILE: libs/functions.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/functions.hpp"
#endif
================================================
FILE: libs/header.go
================================================
package libs
// #include <stdint.h>
// #include <string.h>
// #include "sass/context.h"
//
// extern struct Sass_Import** HeaderBridge(uintptr_t idx);
//
// Sass_Import_List SassHeaders(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
// {
// void* cookie = sass_importer_get_cookie(cb);
// uintptr_t idx = (uintptr_t)cookie;
// Sass_Import_List list = HeaderBridge(idx);
// return list;
//
// }
//
import "C"
import "unsafe"
var globalHeaders SafeMap
func init() {
globalHeaders.init()
}
// BindHeader attaches the header to a libsass context ensuring
// gc does not delete the pointers necessary to make this happen.
func BindHeader(opts SassOptions, entries []ImportEntry) int {
idx := globalHeaders.Set(entries)
// ptr := unsafe.Pointer(idx)
czero := C.double(0)
imper := C.sass_make_importer(
C.Sass_Importer_Fn(C.SassHeaders),
czero,
unsafe.Pointer(uintptr(idx)),
)
impers := C.sass_make_importer_list(1)
C.sass_importer_set_list_entry(impers, 0, imper)
C.sass_option_set_c_headers(
(*C.struct_Sass_Options)(unsafe.Pointer(opts)),
impers)
return idx
}
func RemoveHeaders(idx int) error {
globalHeaders.Del(idx)
return nil
}
================================================
FILE: libs/helpers.go
================================================
package libs
// #include <stdlib.h>
// #include "sass/context.h"
import "C"
import (
"reflect"
"unsafe"
)
func GetImportList(ctx SassContext) []string {
cctx := (*C.struct_Sass_Context)(ctx)
len := int(C.sass_context_get_included_files_size(cctx))
imps := C.sass_context_get_included_files(cctx)
list := make([]string, len, len)
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(imps)),
Len: len, Cap: len,
}
goimps := *(*[]*C.char)(unsafe.Pointer(&hdr))
for i := range goimps {
list[i] = C.GoString(goimps[i])
}
return list
}
func Version() string {
s := C.libsass_version()
return C.GoString(s)
}
================================================
FILE: libs/importer.go
================================================
package libs
// #include <stdint.h>
// #include <stdlib.h>
// #include <string.h>
// #include "sass/context.h"
//
// extern struct Sass_Import** ImporterBridge(const char* url, const char* prev, uintptr_t idx);
//
// Sass_Import_List SassImporterPathsHandler(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
// {
// void* cookie = sass_importer_get_cookie(cb);
// struct Sass_Import* previous = sass_compiler_get_last_import(comp);
// const char* prev_path = sass_import_get_imp_path(previous);
// uintptr_t idx = (uintptr_t)cookie;
// Sass_Import_List list = ImporterBridge(cur_path, prev_path, idx);
// return list;
// }
//
// Sass_Import_List SassImporterAbsHandler(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
// {
// void* cookie = sass_importer_get_cookie(cb);
// struct Sass_Import* previous = sass_compiler_get_last_import(comp);
// const char* prev_abs_path = sass_import_get_abs_path(previous);
// uintptr_t idx = (uintptr_t)cookie;
// Sass_Import_List list = ImporterBridge(cur_path, prev_abs_path, idx);
// return list;
// }
//
//
// #ifndef UINTMAX_MAX
// # ifdef __UINTMAX_MAX__
// # define UINTMAX_MAX __UINTMAX_MAX__
// # endif
// #endif
//
// //size_t max_size = UINTMAX_MAX;
import "C"
import "unsafe"
var globalImports SafeMap
// ImportResolver can be used as a custom import resolver. Return an empty body to
// signal loading the import body from the URL.
type ImportResolver func(url string, prev string) (newURL string, body string, resolved bool)
type ResolverMode int
const (
ResolverModeImporterUrl ResolverMode = iota
ResolverModeImporterAbsPath
)
func init() {
globalImports.init()
}
// BindImporter attaches a custom importer Go function to an import in Sass
func BindImporter(opts SassOptions, resolverMode ResolverMode, resolver ImportResolver) int {
idx := globalImports.Set(resolver)
ptr := unsafe.Pointer(uintptr(idx))
var handler unsafe.Pointer
if resolverMode == ResolverModeImporterAbsPath {
handler = C.SassImporterAbsHandler
} else {
handler = C.SassImporterPathsHandler
}
imper := C.sass_make_importer(
C.Sass_Importer_Fn(handler),
C.double(0),
ptr,
)
impers := C.sass_make_importer_list(1)
C.sass_importer_set_list_entry(impers, 0, imper)
C.sass_option_set_c_importers(
(*C.struct_Sass_Options)(unsafe.Pointer(opts)),
impers,
)
return idx
}
func RemoveImporter(idx int) error {
globalImports.Del(idx)
return nil
}
================================================
FILE: libs/inspect.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/inspect.hpp"
#endif
================================================
FILE: libs/json.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/json.hpp"
#endif
================================================
FILE: libs/kwd_arg_macros.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/kwd_arg_macros.hpp"
#endif
================================================
FILE: libs/lexer.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/lexer.hpp"
#endif
================================================
FILE: libs/listize.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/listize.hpp"
#endif
================================================
FILE: libs/mapping.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/mapping.hpp"
#endif
================================================
FILE: libs/node.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/node.hpp"
#endif
================================================
FILE: libs/operation.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/operation.hpp"
#endif
================================================
FILE: libs/output.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/output.hpp"
#endif
================================================
FILE: libs/parser.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/parser.hpp"
#endif
================================================
FILE: libs/paths.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/paths.hpp"
#endif
================================================
FILE: libs/plugins.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/plugins.hpp"
#endif
================================================
FILE: libs/position.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/position.hpp"
#endif
================================================
FILE: libs/prelexer.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/prelexer.hpp"
#endif
================================================
FILE: libs/remove_placeholders.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/remove_placeholders.hpp"
#endif
================================================
FILE: libs/safemap.go
================================================
package libs
import "sync"
// globalImports stores []ImportEntry in a place where GC won't
// delete it
type SafeMap struct {
sync.RWMutex
idx int
m map[int]interface{}
}
func (s *SafeMap) nextidx() int {
s.Lock()
defer s.Unlock()
s.idx++
return s.idx
}
func (s *SafeMap) init() {
s.m = make(map[int]interface{})
}
func (s *SafeMap) Get(idx int) interface{} {
s.RLock()
defer s.RUnlock()
return s.m[idx]
}
func (s *SafeMap) Del(idx int) {
s.Lock()
delete(s.m, idx)
s.Unlock()
}
// set accepts an entry and returns an index for it
func (s *SafeMap) Set(ie interface{}) int {
idx := s.nextidx()
s.Lock()
s.m[idx] = ie
defer s.Unlock()
return idx
}
================================================
FILE: libs/sass_number.go
================================================
package libs
import (
"math"
"strconv"
)
func (s SassNumber) String() string {
return strconv.FormatFloat(s.Value, 'f', -1, 64) + s.Unit
}
var sassUnitConversions = map[string]map[string]float64{
"in": {
"in": 1,
"cm": 2.54,
"pc": 6,
"mm": 25.4,
"pt": 72,
"px": 96,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"cm": {
"in": 1.0 / 2.54,
"cm": 1,
"pc": 6.0 / 2.54,
"mm": 10,
"pt": 72.0 / 2.54,
"px": 96.0 / 2.54,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"pc": {
"in": 1.0 / 6.0,
"cm": 2.54 / 6.0,
"pc": 1,
"mm": 25.4 / 6.0,
"pt": 72.0 / 6.0,
"px": 96.0 / 6.0,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"mm": {
"in": 1.0 / 25.4,
"cm": 1.0 / 10.0,
"pc": 6.0 / 25.4,
"mm": 1,
"pt": 72.0 / 25.4,
"px": 96.0 / 25.4,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"pt": {
"in": 1.0 / 72.0,
"cm": 2.54 / 72.0,
"pc": 6.0 / 72.0,
"mm": 25.4 / 72.0,
"pt": 1,
"px": 96.0 / 72.0,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"px": {
"in": 1.0 / 96.0,
"cm": 2.54 / 96.0,
"pc": 6.0 / 96.0,
"mm": 25.4 / 96.0,
"pt": 72.0 / 96.0,
"px": 1,
"deg": 1,
"grad": 1,
"rad": 1,
"turn": 1,
},
"deg": {
"in": 1,
"cm": 1,
"pc": 1,
"mm": 1,
"pt": 1,
"px": 1,
"deg": 1,
"grad": 40.0 / 36.0,
"rad": math.Pi / 180.0,
"turn": 1.0 / 360.0,
},
"grad": {
"in": 1,
"cm": 1,
"pc": 1,
"mm": 1,
"pt": 1,
"px": 1,
"deg": 36.0 / 40.0,
"grad": 1,
"rad": math.Pi / 200.0,
"turn": 1.0 / 400.0,
},
"rad": {
"in": 1,
"cm": 1,
"pc": 1,
"mm": 1,
"pt": 1,
"px": 1,
"deg": 180.0 / math.Pi,
"grad": 200.0 / math.Pi,
"rad": 1,
"turn": math.Pi / 2.0,
},
"turn": {
"in": 1,
"cm": 1,
"pc": 1,
"mm": 1,
"pt": 1,
"px": 1,
"deg": 360.0,
"grad": 400.0,
"rad": 2.0 * math.Pi,
"turn": 1,
},
}
var SassUnitConversions map[string]map[string]float64 = sassUnitConversions
var sassUnitTypes = map[string]string{
"in": "distance",
"cm": "distance",
"pc": "distance",
"mm": "distance",
"pt": "distance",
"px": "distance",
"deg": "angle",
"grad": "angle",
"rad": "angle",
"turn": "angle",
}
// Add sums the two numbers in the first numbers units
func (sn SassNumber) Add(sn2 SassNumber) SassNumber {
sn1Value, sn2Value := getConvertedUnits(sn, sn2)
return SassNumber{Value: sn1Value + sn2Value, Unit: sn.Unit}
}
// Subtract minuses the two numbers in the first numbers units
func (sn SassNumber) Subtract(sn2 SassNumber) SassNumber {
sn1Value, sn2Value := getConvertedUnits(sn, sn2)
return SassNumber{Value: sn1Value - sn2Value, Unit: sn.Unit}
}
// Multiply takes the multiplication of the two numbers
// in the first numbers units
func (sn SassNumber) Multiply(sn2 SassNumber) SassNumber {
sn1Value, sn2Value := getConvertedUnits(sn, sn2)
return SassNumber{Value: sn1Value * sn2Value, Unit: sn.Unit}
}
// Divide takes the quotient of the two numbers in the first unit
func (sn SassNumber) Divide(sn2 SassNumber) SassNumber {
sn1Value, sn2Value := getConvertedUnits(sn, sn2)
return SassNumber{Value: sn1Value / sn2Value, Unit: sn.Unit}
}
func getConvertedUnits(sn1 SassNumber, sn2 SassNumber) (float64, float64) {
var sn2Value float64
if sn2.Unit != sn1.Unit {
sn2Value = convertUnits(sn2, sn1)
} else {
sn2Value = sn2.Value
}
return sn1.Value, sn2Value
}
func convertUnits(from SassNumber, to SassNumber) float64 {
return sassUnitConversions[from.Unit][to.Unit] * from.Value
}
================================================
FILE: libs/sass_number_test.go
================================================
package libs
import (
"math"
"testing"
)
var tolerance = float64(0.00001)
func TestSassNumberAddDifferentUnits(t *testing.T) {
var sn1 = SassNumber{50, "px"}
var sn2 = SassNumber{15, "cm"}
res := sn1.Add(sn2)
expectedValue := 50 + ((96.0 / 2.54) * 15)
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Add result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Add result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberAddSameUnits(t *testing.T) {
var sn1 = SassNumber{80.0, "mm"}
var sn2 = SassNumber{25.0, "mm"}
res := sn1.Add(sn2)
expectedValue := 80.0 + 25.0
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Add result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Add result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberSubstractDifferentUnits(t *testing.T) {
var sn1 = SassNumber{60, "grad"}
var sn2 = SassNumber{25, "deg"}
res := sn1.Subtract(sn2)
expectedValue := 60 - ((40.0 / 36.0) * 25.0)
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Subtract result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Subtract result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberSubtractSameUnits(t *testing.T) {
var sn1 = SassNumber{80.0, "mm"}
var sn2 = SassNumber{25.0, "mm"}
res := sn1.Subtract(sn2)
expectedValue := 80.0 - 25.0
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Subtract result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Subtract result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberMultiplyDifferentUnits(t *testing.T) {
var sn1 = SassNumber{15, "mm"}
var sn2 = SassNumber{5, "pt"}
res := sn1.Multiply(sn2)
expectedValue := 15 * ((25.4 / 72.0) * 5)
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Multiply result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Multiply result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberMultiplySameUnits(t *testing.T) {
var sn1 = SassNumber{.4, "rad"}
var sn2 = SassNumber{.7, "rad"}
res := sn1.Multiply(sn2)
expectedValue := .4 * .7
if res.Unit != sn1.Unit {
t.Errorf("SassNumber add result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Add result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberDivideDifferentUnits(t *testing.T) {
var sn1 = SassNumber{5, "in"}
var sn2 = SassNumber{15, "px"}
res := sn1.Divide(sn2)
expectedValue := 5 / ((1.0 / 96.0) * 15)
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Divide result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Divide result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func TestSassNumberDivideSameUnits(t *testing.T) {
var sn1 = SassNumber{80.0, "cm"}
var sn2 = SassNumber{25.0, "cm"}
res := sn1.Divide(sn2)
expectedValue := 80.0 / 25.0
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Divide result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber Divide result Value expected: %f, got %f", expectedValue, res.Value)
}
}
/*
func TestUnknownUnit(t *testing.T) {
var sn1 = SassNumber{80.0, "mm"}
var sn2 = SassNumber{25.0, "TalorSwift"}
_, err := sn1.Divide(sn2)
if err == nil {
t.Errorf("Wanted: %s but did not get an error", fmt.Sprintf("Can not convert from %s to %s", sn2.Unit, sn1.Unit))
} else if err.Error() != fmt.Sprintf("Can not convert from %s to %s", sn2.Unit, sn1.Unit) {
t.Errorf("Wanted: %s got: %s", fmt.Sprintf("Can not convert from %s to %s", sn2.Unit, sn1.Unit), err.Error())
}
}
func TestDistanceToAngleConversion(t *testing.T) {
var sn1 = SassNumber{80.0, "mm"}
var sn2 = SassNumber{25.0, "rad"}
_, err := sn1.Divide(sn2)
if err == nil {
t.Errorf("Wanted: %s but did not get an error", fmt.Sprintf("Can not convert sass Units between angles and distances: %s, %s", sn2.Unit, sn1.Unit))
} else if err.Error() != fmt.Sprintf("Can not convert sass Units between angles and distances: %s, %s", sn2.Unit, sn1.Unit) {
t.Errorf("Wanted: %s got: %s", fmt.Sprintf("Can not convert sass Units between angles and distances: %s, %s", sn2.Unit, sn1.Unit), err.Error())
}
}
*/
func TestChainedOperation(t *testing.T) {
var sn1 = SassNumber{5, "in"}
var sn2 = SassNumber{15, "px"}
var sn3 = SassNumber{55, "px"}
var sn4 = SassNumber{75, "mm"}
var sn5 = SassNumber{25, "pt"}
res := sn1.Add(sn2).Subtract(sn3).Multiply(sn4).Divide(sn5)
expectedValue := (((5.0 + ((1.0 / 96.0) * 15)) - ((1.0 / 96.0) * 55)) * ((1.0 / 25.4) * 75)) / ((1.0 / 72.0) * 25)
if res.Unit != sn1.Unit {
t.Errorf("SassNumber Divide result Units are: %s, wanted %s", res.Unit, sn1.Unit)
} else if !compareFloats(res.Value, expectedValue) {
t.Errorf("SassNumber chained operation result Value expected: %f, got %f", expectedValue, res.Value)
}
}
func compareFloats(f1 float64, f2 float64) bool {
if math.Abs(f1-f2) < tolerance {
return true
}
return false
}
================================================
FILE: libs/sass_util.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/sass_util.hpp"
#endif
================================================
FILE: libs/source_map.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/source_map.hpp"
#endif
================================================
FILE: libs/subset_map.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/subset_map.hpp"
#endif
================================================
FILE: libs/to_c.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/to_c.hpp"
#endif
================================================
FILE: libs/to_string.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/to_string.hpp"
#endif
================================================
FILE: libs/to_value.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/to_value.hpp"
#endif
================================================
FILE: libs/toscss.go
================================================
package libs
// #include <stdlib.h>
// #include "sass2scss.h"
import "C"
import (
"io"
"io/ioutil"
"unsafe"
)
// ToScss converts Sass to Scss using sass2scss. Readers and Writers are
// used, but libsass does not support streaming.
func ToScss(r io.Reader, w io.Writer) error {
bs, _ := ioutil.ReadAll(r)
in := C.CString(string(bs))
defer C.free(unsafe.Pointer(in))
chars := C.sass2scss(
// FIXME: readers would be much more efficient
in,
// SASS2SCSS_PRETTIFY_1 Egyptian brackets
C.int(1),
)
_, err := io.WriteString(w, C.GoString(chars))
return err
}
================================================
FILE: libs/units.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/units.hpp"
#endif
================================================
FILE: libs/unity.cpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/ast.cpp"
#include "../libsass-build/ast_fwd_decl.cpp"
#include "../libsass-build/backtrace.cpp"
#include "../libsass-build/base64vlq.cpp"
#include "../libsass-build/bind.cpp"
#include "../libsass-build/check_nesting.cpp"
#include "../libsass-build/color_maps.cpp"
#include "../libsass-build/constants.cpp"
#include "../libsass-build/context.cpp"
#include "../libsass-build/cssize.cpp"
#include "../libsass-build/emitter.cpp"
#include "../libsass-build/environment.cpp"
#include "../libsass-build/error_handling.cpp"
#include "../libsass-build/eval.cpp"
#include "../libsass-build/expand.cpp"
#include "../libsass-build/extend.cpp"
#include "../libsass-build/file.cpp"
#include "../libsass-build/functions.cpp"
#include "../libsass-build/inspect.cpp"
#include "../libsass-build/json.cpp"
#include "../libsass-build/lexer.cpp"
#include "../libsass-build/listize.cpp"
#include "../libsass-build/node.cpp"
#include "../libsass-build/operators.cpp"
#include "../libsass-build/output.cpp"
#include "../libsass-build/parser.cpp"
#include "../libsass-build/plugins.cpp"
#include "../libsass-build/position.cpp"
#include "../libsass-build/prelexer.cpp"
#include "../libsass-build/remove_placeholders.cpp"
#include "../libsass-build/sass2scss.cpp"
#include "../libsass-build/sass_context.cpp"
#include "../libsass-build/sass.cpp"
#include "../libsass-build/sass_functions.cpp"
#include "../libsass-build/sass_util.cpp"
#include "../libsass-build/sass_values.cpp"
#include "../libsass-build/source_map.cpp"
#include "../libsass-build/subset_map.cpp"
#include "../libsass-build/to_c.cpp"
#include "../libsass-build/to_value.cpp"
#include "../libsass-build/units.cpp"
#include "../libsass-build/utf8_string.cpp"
#include "../libsass-build/util.cpp"
#include "../libsass-build/values.cpp"
#include "../libsass-build/memory/SharedPtr.cpp"
#endif
================================================
FILE: libs/utf8.h
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/utf8.h"
#endif
================================================
FILE: libs/utf8_string.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/utf8_string.hpp"
#endif
================================================
FILE: libs/util.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/util.hpp"
#endif
================================================
FILE: libs/values.hpp
================================================
#ifndef USE_LIBSASS
#include "../libsass-build/values.hpp"
#endif
================================================
FILE: libs/wrap.go
================================================
package libs
// #include "stdint.h"
//
// extern struct Sass_Import** HeaderBridge(uintptr_t idx);
//
// #//for C.free
// #include "stdlib.h"
//
// #include "sass/context.h"
//
import "C"
import (
"errors"
"fmt"
"reflect"
"strings"
"unsafe"
)
type SassImporter *C.struct_Sass_Importer
type SassImporterList C.Sass_Importer_List
// SassMakeImporterList maps to C.sass_make_importer_list
func SassMakeImporterList(gol int) SassImporterList {
l := C.size_t(gol)
cimp := C.sass_make_importer_list(l)
return (SassImporterList)(cimp)
}
type ImportEntry struct {
Parent string
Path string
Source string
SrcMap string
}
//export HeaderBridge
func HeaderBridge(cint C.uintptr_t) C.Sass_Import_List {
idx := int(cint)
entries, ok := globalHeaders.Get(idx).([]ImportEntry)
if !ok {
fmt.Printf("failed to resolve header slice: %d\n", idx)
return C.sass_make_import_list(C.size_t(1))
}
cents := C.sass_make_import_list(C.size_t(len(entries)))
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cents)),
Len: len(entries), Cap: len(entries),
}
goents := *(*[]C.Sass_Import_Entry)(unsafe.Pointer(&hdr))
for i, ent := range entries {
// Each entry needs a unique name
cent := C.sass_make_import_entry(
C.CString(ent.Path),
C.CString(ent.Source),
C.CString(ent.SrcMap))
// There is a function for modifying an import list, but a proper
// slice might be more useful.
// C.sass_import_set_list_entry(cents, C.size_t(i), cent)
goents[i] = cent
}
return cents
}
func GetEntry(es []ImportEntry, parent string, path string) (string, error) {
for _, e := range es {
if parent == e.Parent && path == e.Path {
return e.Source, nil
}
}
return "", errors.New("entry not found")
}
// ImporterBridge is called by C to pass Importer arguments into Go land. A
// Sass_Import is returned for libsass to resolve.
//
//export ImporterBridge
func ImporterBridge(url *C.char, prev *C.char, cidx C.uintptr_t) C.Sass_Import_List {
var importResolver ImportResolver
// Retrieve the index
idx := int(cidx)
importResolver, ok := globalImports.Get(idx).(ImportResolver)
if !ok {
fmt.Printf("failed to resolve import handler: %d\n", idx)
}
parent := C.GoString(prev)
rel := C.GoString(url)
list := C.sass_make_import_list(1)
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(list)),
Len: 1, Cap: 1,
}
golist := *(*[]C.Sass_Import_Entry)(unsafe.Pointer(&hdr))
if importResolver != nil {
newURL, body, resolved := importResolver(rel, parent)
if resolved {
// Passing a nil as body is a signal to load the import from the URL.
var bodyv *C.char
if body != "" {
bodyv = C.CString(body)
}
ent := C.sass_make_import_entry(C.CString(newURL), bodyv, nil)
cent := (C.Sass_Import_Entry)(ent)
golist[0] = cent
return list
}
}
if strings.HasPrefix(rel, "compass") {
ent := C.sass_make_import_entry(url, C.CString(""), nil)
cent := (C.Sass_Import_Entry)(ent)
golist[0] = cent
} else {
ent := C.sass_make_import_entry(url, nil, nil)
cent := (C.Sass_Import_Entry)(ent)
golist[0] = cent
}
return list
}
type SassImportList C.Sass_Import_List
type SassFileContext *C.struct_Sass_File_Context
// SassMakeFileContext maps to C.sass_make_file_context
func SassMakeFileContext(gos string) SassFileContext {
s := C.CString(gos)
fctx := C.sass_make_file_context(s)
return (SassFileContext)(fctx)
}
// SassDeleteFileContext frees memory used for a file context
func SassDeleteFileContext(fc SassFileContext) {
C.sass_delete_file_context(fc)
}
type SassDataContext *C.struct_Sass_Data_Context
// SassMakeDataContext creates a data context from a source string
func SassMakeDataContext(gos string) SassDataContext {
s := C.CString(gos)
dctx := C.sass_make_data_context(s)
return (SassDataContext)(dctx)
}
// SassDeleteDataContext frees the memory used for a data context
func SassDeleteDataContext(dc SassDataContext) {
C.sass_delete_data_context(dc)
}
type SassContext *C.struct_Sass_Context
// SassDataContextGetContext returns a context from a data context.
// These are useful for calling generic methods like compiling.
func SassDataContextGetContext(godc SassDataContext) SassContext {
opts := C.sass_data_context_get_context(godc)
return (SassContext)(opts)
}
// SassFileContextGetContext returns a context from a file context.
// These are useful for calling generic methods like compiling.
func SassFileContextGetContext(gofc SassFileContext) SassContext {
opts := C.sass_file_context_get_context(gofc)
return (SassContext)(opts)
}
// SassOptions is a wrapper to C.struct_Sass_Options
type SassOptions *C.struct_Sass_Options
// SassMakeOptions creates a new SassOptions object
func SassMakeOptions() SassOptions {
opts := C.sass_make_options()
return (SassOptions)(opts)
}
// SassFileContextGetOptions returns the sass options in a file context
func SassFileContextGetOptions(gofc SassFileContext) SassOptions {
fcopts := C.sass_file_context_get_options(gofc)
return (SassOptions)(fcopts)
}
// SassFileContextGetOptions sets a sass options to a file context
func SassFileContextSetOptions(gofc SassFileContext, goopts SassOptions) {
C.sass_file_context_set_options(gofc, goopts)
}
// SassDataContextGetOptions returns the Sass options in a data context
func SassDataContextGetOptions(godc SassDataContext) SassOptions {
dcopts := C.sass_data_context_get_options(godc)
return (SassOptions)(dcopts)
}
// SassDataContextGetOptions sets a Sass options to a data context
func SassDataContextSetOptions(godc SassDataContext, goopts SassOptions) {
C.sass_data_context_set_options(godc, goopts)
}
type SassCompiler *C.struct_Sass_Compiler
// SassMakeFileCompiler returns a compiler from a file context
func SassMakeFileCompiler(gofc SassFileContext) SassCompiler {
sc := C.sass_make_file_compiler(gofc)
return (SassCompiler)(sc)
}
// SassMakeDataCompiler returns a compiler from a data context
func SassMakeDataCompiler(godc SassDataContext) SassCompiler {
dc := C.sass_make_data_compiler(godc)
return (SassCompiler)(dc)
}
// SassCompileFileContext compile from file context
func SassCompileFileContext(gofc SassFileContext) int {
cstatus := C.sass_compile_file_context(gofc)
return int(cstatus)
}
// SassCompilerParse prepares a compiler for execution
func SassCompilerParse(c SassCompiler) {
C.sass_compiler_parse(c)
}
// SassCompilerExecute compiles a compiler
func SassCompilerExecute(c SassCompiler) {
C.sass_compiler_execute(c)
}
// SassDeleteCompiler frees memory for the Sass compiler
func SassDeleteCompiler(c SassCompiler) {
C.sass_delete_compiler(c)
}
// SassOptionSetCHeaders adds custom C headers to a SassOptions
func SassOptionSetCHeaders(gofc SassOptions, goimp SassImporterList) {
C.sass_option_set_c_headers(gofc, C.Sass_Importer_List(goimp))
}
// SassContextGetOutputString retrieves the final compiled CSS after
// compiler parses and executes.
func SassContextGetOutputString(goctx SassContext) string {
cstr := C.sass_context_get_output_string(goctx)
defer C.free(unsafe.Pointer(cstr))
return C.GoString(cstr)
}
// SassContextGetErrorJSON requests an error in JSON format from libsass
func SassContextGetErrorJSON(goctx SassContext) string {
cstr := C.sass_context_get_error_json(goctx)
defer C.free(unsafe.Pointer(cstr))
return C.GoString(cstr)
}
// SassContextGetErrorStatus requests error status
func SassContextGetErrorStatus(goctx SassContext) int {
return int(C.sass_context_get_error_status(goctx))
}
// SassOptionGetSourceMapFile retrieves the source map file
func SassOptionGetSourceMapFile(goopts SassOptions) string {
p := C.sass_option_get_source_map_file(goopts)
return C.GoString(p)
}
// SassContextGetSourceMapString retrieves the contents of a
// source map
func SassContextGetSourceMapString(goctx SassContext) string {
s := C.sass_context_get_source_map_string(goctx)
return C.GoString(s)
}
// SassOptionSetPrecision sets the precision of floating point math
// ie. 3.2222px. This is currently bugged and does not work.
func SassOptionSetPrecision(goopts SassOptions, i int) {
C.sass_option_set_precision(goopts, C.int(i))
}
// SassOptionSetOutputStyle sets the output format of CSS see: http://godoc.org/github.com/wellington/go-libsass#pkg-constants
func SassOptionSetOutputStyle(goopts SassOptions, i int) {
C.sass_option_set_output_style(goopts, uint32(i))
}
// SassOptionSetSourceComments toggles the output of line comments in CSS
func SassOptionSetSourceComments(goopts SassOptions, b bool) {
C.sass_option_set_source_comments(goopts, C.bool(b))
}
// SassOptionSetOutputPath is used for output path.
// Output path is used for source map generating. LibSass will
// not write to this file, it is just used to create
// information in source-maps etc.
func SassOptionSetOutputPath(goopts SassOptions, path string) {
C.sass_option_set_output_path(goopts, C.CString(path))
}
// SassOptionSetInputPath is used for input path.
// The input path is used for source map generating. It can be used to define
// something with string compilation or to overload the input file path. It is
// set to "stdin" for data contexts and to the input file on file contexts.
func SassOptionSetInputPath(goopts SassOptions, path string) {
C.sass_option_set_input_path(goopts, C.CString(path))
}
// SassOptionSetIncludePaths adds additional paths to look for input Sass
func SassOptionSetIncludePath(goopts SassOptions, path string) {
C.sass_option_set_include_path(goopts, C.CString(path))
}
func SassOptionSetSourceMapEmbed(goopts SassOptions, b bool) {
C.sass_option_set_source_map_embed(goopts, C.bool(b))
}
func SassOptionSetSourceMapContents(goopts SassOptions, b bool) {
C.sass_option_set_source_map_contents(goopts, C.bool(b))
}
func SassOptionSetSourceMapFile(goopts SassOptions, path string) {
C.sass_option_set_source_map_file(goopts, C.CString(path))
}
// SassOptionSetSourceMapRoot sets the sourceRoot in the resulting
// source map. sourceRoot is prepended to the sources referenced
// in the map. More Info: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.75yo6yoyk7x5
func SassOptionSetSourceMapRoot(goopts SassOptions, path string) {
C.sass_option_set_source_map_root(goopts, C.CString(path))
}
func SassOptionSetOmitSourceMapURL(goopts SassOptions, b bool) {
C.sass_option_set_omit_source_map_url(goopts, C.bool(b))
}
type SassImportEntry C.Sass_Import_Entry
// SassMakeImport creates an import for overriding behavior when
// certain imports are called.
func SassMakeImport(path string, base string, source string, srcmap string) SassImportEntry {
impent := C.sass_make_import(C.CString(path), C.CString(base),
C.CString(source), C.CString(srcmap))
return (SassImportEntry)(impent)
}
type SassImporterFN C.Sass_Importer_Fn
func SassImporterGetFunction(goimp SassImporter) SassImporterFN {
impfn := C.sass_importer_get_function(C.Sass_Importer_Entry(goimp))
return (SassImporterFN)(impfn)
}
func SassImporterGetListEntry() {}
// SassMakeImport attaches a Go pointer to a Sass function. Go will
// eventually kill this behavior and we should find a new way to do this.
func SassMakeImporter(fn SassImporterFN, priority int, v interface{}) (SassImporter, error) {
vv := reflect.ValueOf(v).Elem()
if !vv.CanAddr() {
return nil, errors.New("can not take address of")
}
// TODO: this will leak memory, the interface must be freed manually
lst := C.sass_make_importer(C.Sass_Importer_Fn(fn), C.double(priority), unsafe.Pointer(vv.Addr().Pointer()))
return (SassImporter)(lst), nil
}
// SassImporterSetListEntry updates an import list with a new entry. The
// index must exist in the importer list.
func SassImporterSetListEntry(golst SassImporterList, idx int, ent SassImporter) {
C.sass_importer_set_list_entry(C.Sass_Importer_List(golst), C.size_t(idx), C.Sass_Importer_Entry(ent))
}
func SassOptionSetCImporters(goopts SassOptions, golst SassImporterList) {
C.sass_option_set_c_importers(goopts, C.Sass_Importer_List(golst))
}
func SassOptionSetCFunctions() {
}
================================================
FILE: libs/wrap_dev.go
================================================
// +build dev
package libs
// #cgo CPPFLAGS: -DUSE_LIBSASS
// #cgo CPPFLAGS: -I../libsass-build -I../libsass-build/include
// #cgo LDFLAGS: -lsass
// #cgo darwin linux LDFLAGS: -ldl
//
import "C"
================================================
FILE: libs/wrap_main.go
================================================
// +build !dev
package libs
// #cgo CFLAGS: -O2 -fPIC
// #cgo CPPFLAGS: -I../libsass-build -I../libsass-build/include
// #cgo CXXFLAGS: -g -std=c++0x -O2 -fPIC
// #cgo LDFLAGS: -lstdc++ -lm
// #cgo darwin linux LDFLAGS: -ldl
//
import "C"
================================================
FILE: libsass-build/ast.cpp
================================================
#include "sass.hpp"
#include "ast.hpp"
#include "context.hpp"
#include "node.hpp"
#include "eval.hpp"
#include "extend.hpp"
#include "emitter.hpp"
#include "color_maps.hpp"
#include "ast_fwd_decl.hpp"
#include <set>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
namespace Sass {
static Null sass_null(ParserState("null"));
bool Wrapped_Selector::find ( bool (*f)(AST_Node_Obj) )
{
// check children first
if (selector_) {
if (selector_->find(f)) return true;
}
// execute last
return f(this);
}
bool Selector_List::find ( bool (*f)(AST_Node_Obj) )
{
// check children first
for (Complex_Selector_Obj sel : elements()) {
if (sel->find(f)) return true;
}
// execute last
return f(this);
}
bool Compound_Selector::find ( bool (*f)(AST_Node_Obj) )
{
// check children first
for (Simple_Selector_Obj sel : elements()) {
if (sel->find(f)) return true;
}
// execute last
return f(this);
}
bool Complex_Selector::find ( bool (*f)(AST_Node_Obj) )
{
// check children first
if (head_ && head_->find(f)) return true;
if (tail_ && tail_->find(f)) return true;
// execute last
return f(this);
}
bool Supports_Operator::needs_parens(Supports_Condition_Obj cond) const {
if (Supports_Operator_Obj op = Cast<Supports_Operator>(cond)) {
return op->operand() != operand();
}
return Cast<Supports_Negation>(cond) != NULL;
}
bool Supports_Negation::needs_parens(Supports_Condition_Obj cond) const {
return Cast<Supports_Negation>(cond) ||
Cast<Supports_Operator>(cond);
}
void str_rtrim(std::string& str, const std::string& delimiters = " \f\n\r\t\v")
{
str.erase( str.find_last_not_of( delimiters ) + 1 );
}
void String_Constant::rtrim()
{
str_rtrim(value_);
}
void String_Schema::rtrim()
{
if (!empty()) {
if (String_Ptr str = Cast<String>(last())) str->rtrim();
}
}
void Argument::set_delayed(bool delayed)
{
if (value_) value_->set_delayed(delayed);
is_delayed(delayed);
}
void Arguments::set_delayed(bool delayed)
{
for (Argument_Obj arg : elements()) {
if (arg) arg->set_delayed(delayed);
}
is_delayed(delayed);
}
bool At_Root_Query::exclude(std::string str)
{
bool with = feature() && unquote(feature()->to_string()).compare("with") == 0;
List_Ptr l = static_cast<List_Ptr>(value().ptr());
std::string v;
if (with)
{
if (!l || l->length() == 0) return str.compare("rule") != 0;
for (size_t i = 0, L = l->length(); i < L; ++i)
{
v = unquote((*l)[i]->to_string());
if (v.compare("all") == 0 || v == str) return false;
}
return true;
}
else
{
if (!l || !l->length()) return str.compare("rule") == 0;
for (size_t i = 0, L = l->length(); i < L; ++i)
{
v = unquote((*l)[i]->to_string());
if (v.compare("all") == 0 || v == str) return true;
}
return false;
}
}
void AST_Node::update_pstate(const ParserState& pstate)
{
pstate_.offset += pstate - pstate_ + pstate.offset;
}
bool Simple_Selector::is_ns_eq(const Simple_Selector& r) const
{
// https://github.com/sass/sass/issues/2229
if ((has_ns_ == r.has_ns_) ||
(has_ns_ && ns_.empty()) ||
(r.has_ns_ && r.ns_.empty())
) {
if (ns_.empty() && r.ns() == "*") return false;
else if (r.ns().empty() && ns() == "*") return false;
else return ns() == r.ns();
}
return false;
}
bool Compound_Selector::operator< (const Compound_Selector& rhs) const
{
size_t L = std::min(length(), rhs.length());
for (size_t i = 0; i < L; ++i)
{
Simple_Selector_Obj l = (*this)[i];
Simple_Selector_Obj r = rhs[i];
if (!l && !r) return false;
else if (!r) return false;
else if (!l) return true;
else if (*l != *r)
{ return *l < *r; }
}
// just compare the length now
return length() < rhs.length();
}
bool Compound_Selector::has_parent_ref() const
{
for (Simple_Selector_Obj s : *this) {
if (s && s->has_parent_ref()) return true;
}
return false;
}
bool Compound_Selector::has_real_parent_ref() const
{
for (Simple_Selector_Obj s : *this) {
if (s && s->has_real_parent_ref()) return true;
}
return false;
}
bool Complex_Selector::has_parent_ref() const
{
return (head() && head()->has_parent_ref()) ||
(tail() && tail()->has_parent_ref());
}
bool Complex_Selector::has_real_parent_ref() const
{
return (head() && head()->has_real_parent_ref()) ||
(tail() && tail()->has_real_parent_ref());
}
bool Complex_Selector::operator< (const Complex_Selector& rhs) const
{
// const iterators for tails
Complex_Selector_Ptr_Const l = this;
Complex_Selector_Ptr_Const r = &rhs;
Compound_Selector_Ptr l_h = NULL;
Compound_Selector_Ptr r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
// process all tails
while (true)
{
#ifdef DEBUG
// skip empty ancestor first
if (l && l->is_empty_ancestor())
{
l_h = NULL;
l = l->tail();
if(l) l_h = l->head();
continue;
}
// skip empty ancestor first
if (r && r->is_empty_ancestor())
{
r_h = NULL;
r = r->tail();
if (r) r_h = r->head();
continue;
}
#endif
// check for valid selectors
if (!l) return !!r;
if (!r) return false;
// both are null
else if (!l_h && !r_h)
{
// check combinator after heads
if (l->combinator() != r->combinator())
{ return l->combinator() < r->combinator(); }
// advance to next tails
l = l->tail();
r = r->tail();
// fetch the next headers
l_h = NULL; r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
}
// one side is null
else if (!r_h) return true;
else if (!l_h) return false;
// heads ok and equal
else if (*l_h == *r_h)
{
// check combinator after heads
if (l->combinator() != r->combinator())
{ return l->combinator() < r->combinator(); }
// advance to next tails
l = l->tail();
r = r->tail();
// fetch the next headers
l_h = NULL; r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
}
// heads are not equal
else return *l_h < *r_h;
}
}
bool Complex_Selector::operator== (const Complex_Selector& rhs) const
{
// const iterators for tails
Complex_Selector_Ptr_Const l = this;
Complex_Selector_Ptr_Const r = &rhs;
Compound_Selector_Ptr l_h = NULL;
Compound_Selector_Ptr r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
// process all tails
while (true)
{
#ifdef DEBUG
// skip empty ancestor first
if (l && l->is_empty_ancestor())
{
l_h = NULL;
l = l->tail();
if (l) l_h = l->head();
continue;
}
// skip empty ancestor first
if (r && r->is_empty_ancestor())
{
r_h = NULL;
r = r->tail();
if (r) r_h = r->head();
continue;
}
#endif
// check the pointers
if (!r) return !l;
if (!l) return !r;
// both are null
if (!l_h && !r_h)
{
// check combinator after heads
if (l->combinator() != r->combinator())
{ return l->combinator() < r->combinator(); }
// advance to next tails
l = l->tail();
r = r->tail();
// fetch the next heads
l_h = NULL; r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
}
// equals if other head is empty
else if ((!l_h && !r_h) ||
(!l_h && r_h->empty()) ||
(!r_h && l_h->empty()) ||
(l_h && r_h && *l_h == *r_h))
{
// check combinator after heads
if (l->combinator() != r->combinator())
{ return l->combinator() == r->combinator(); }
// advance to next tails
l = l->tail();
r = r->tail();
// fetch the next heads
l_h = NULL; r_h = NULL;
if (l) l_h = l->head();
if (r) r_h = r->head();
}
// abort
else break;
}
// unreachable
return false;
}
Compound_Selector_Ptr Compound_Selector::unify_with(Compound_Selector_Ptr rhs)
{
if (empty()) return rhs;
Compound_Selector_Obj unified = SASS_MEMORY_COPY(rhs);
for (size_t i = 0, L = length(); i < L; ++i)
{
if (unified.isNull()) break;
unified = at(i)->unify_with(unified);
}
return unified.detach();
}
bool Complex_Selector::operator== (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Complex_Selector::operator< (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Compound_Selector::operator== (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Compound_Selector::operator< (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Selector_Schema::operator== (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this == *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this == *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this == *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Selector_Schema::operator< (const Selector& rhs) const
{
if (const Selector_List* sl = Cast<Selector_List>(&rhs)) return *this < *sl;
if (const Simple_Selector* sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
if (const Complex_Selector* cs = Cast<Complex_Selector>(&rhs)) return *this < *cs;
if (const Compound_Selector* ch = Cast<Compound_Selector>(&rhs)) return *this < *ch;
throw std::runtime_error("invalid selector base classes to compare");
}
bool Simple_Selector::operator== (const Selector& rhs) const
{
if (Simple_Selector_Ptr_Const sp = Cast<Simple_Selector>(&rhs)) return *this == *sp;
return false;
}
bool Simple_Selector::operator< (const Selector& rhs) const
{
if (Simple_Selector_Ptr_Const sp = Cast<Simple_Selector>(&rhs)) return *this < *sp;
return false;
}
bool Simple_Selector::operator== (const Simple_Selector& rhs) const
{
// solve the double dispatch problem by using RTTI information via dynamic cast
if (const Pseudo_Selector* lhs = Cast<Pseudo_Selector>(this)) {return *lhs == rhs; }
else if (const Wrapped_Selector* lhs = Cast<Wrapped_Selector>(this)) {return *lhs == rhs; }
else if (const Element_Selector* lhs = Cast<Element_Selector>(this)) {return *lhs == rhs; }
else if (const Attribute_Selector* lhs = Cast<Attribute_Selector>(this)) {return *lhs == rhs; }
else if (name_ == rhs.name_)
{ return is_ns_eq(rhs); }
else return false;
}
bool Simple_Selector::operator< (const Simple_Selector& rhs) const
{
// solve the double dispatch problem by using RTTI information via dynamic cast
if (const Pseudo_Selector* lhs = Cast<Pseudo_Selector>(this)) {return *lhs < rhs; }
else if (const Wrapped_Selector* lhs = Cast<Wrapped_Selector>(this)) {return *lhs < rhs; }
else if (const Element_Selector* lhs = Cast<Element_Selector>(this)) {return *lhs < rhs; }
else if (const Attribute_Selector* lhs = Cast<Attribute_Selector>(this)) {return *lhs < rhs; }
if (is_ns_eq(rhs))
{ return name_ < rhs.name_; }
return ns_ < rhs.ns_;
}
bool Selector_List::operator== (const Selector& rhs) const
{
// solve the double dispatch problem by using RTTI information via dynamic cast
if (Selector_List_Ptr_Const sl = Cast<Selector_List>(&rhs)) { return *this == *sl; }
else if (Complex_Selector_Ptr_Const cpx = Cast<Complex_Selector>(&rhs)) { return *this == *cpx; }
else if (Compound_Selector_Ptr_Const cpd = Cast<Compound_Selector>(&rhs)) { return *this == *cpd; }
// no compare method
return this == &rhs;
}
// Selector lists can be compared to comma lists
bool Selector_List::operator== (const Expression& rhs) const
{
// solve the double dispatch problem by using RTTI information via dynamic cast
if (List_Ptr_Const ls = Cast<List>(&rhs)) { return *ls == *this; }
if (Selector_Ptr_Const ls = Cast<Selector>(&rhs)) { return *this == *ls; }
// compare invalid (maybe we should error?)
return false;
}
bool Selector_List::operator== (const Selector_List& rhs) const
{
// for array access
size_t i = 0, n = 0;
size_t iL = length();
size_t nL = rhs.length();
// create temporary vectors and sort them
std::vector<Complex_Selector_Obj> l_lst = this->elements();
std::vector<Complex_Selector_Obj> r_lst = rhs.elements();
std::sort(l_lst.begin(), l_lst.end(), OrderNodes());
std::sort(r_lst.begin(), r_lst.end(), OrderNodes());
// process loop
while (true)
{
// first check for valid index
if (i == iL) return iL == nL;
else if (n == nL) return iL == nL;
// the access the vector items
Complex_Selector_Obj l = l_lst[i];
Complex_Selector_Obj r = r_lst[n];
// skip nulls
if (!l) ++i;
else if (!r) ++n;
// do the check
else if (*l != *r)
{ return false; }
// advance
++i; ++n;
}
// there is no break?!
}
bool Selector_List::operator< (const Selector& rhs) const
{
if (Selector_List_Ptr_Const sp = Cast<Selector_List>(&rhs)) return *this < *sp;
return false;
}
bool Selector_List::operator< (const Selector_List& rhs) const
{
size_t l = rhs.length();
if (length() < l) l = length();
for (size_t i = 0; i < l; i ++) {
if (*at(i) < *rhs.at(i)) return true;
}
return false;
}
Compound_Selector_Ptr Simple_Selector::unify_with(Compound_Selector_Ptr rhs)
{
for (size_t i = 0, L = rhs->length(); i < L; ++i)
{ if (to_string() == rhs->at(i)->to_string()) return rhs; }
// check for pseudo elements because they are always last
size_t i, L;
bool found = false;
if (typeid(*this) == typeid(Pseudo_Selector) || typeid(*this) == typeid(Wrapped_Selector) || typeid(*this) == typeid(Attribute_Selector))
{
for (i = 0, L = rhs->length(); i < L; ++i)
{
if ((Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i]) || Cast<Attribute_Selector>((*rhs)[i])) && (*rhs)[L-1]->is_pseudo_element())
{ found = true; break; }
}
}
else
{
for (i = 0, L = rhs->length(); i < L; ++i)
{
if (Cast<Pseudo_Selector>((*rhs)[i]) || Cast<Wrapped_Selector>((*rhs)[i]) || Cast<Attribute_Selector>((*rhs)[i]))
{ found = true; break; }
}
}
if (!found)
{
rhs->append(this);
} else {
rhs->elements().insert(rhs->elements().begin() + i, this);
}
return rhs;
}
Simple_Selector_Ptr Element_Selector::unify_with(Simple_Selector_Ptr rhs)
{
// check if ns can be extended
// true for no ns or universal
if (has_universal_ns())
{
// but dont extend with universal
// true for valid ns and universal
if (!rhs->is_universal_ns())
{
// overwrite the name if star is given as name
if (this->name() == "*") { this->name(rhs->name()); }
// now overwrite the namespace name and flag
this->ns(rhs->ns()); this->has_ns(rhs->has_ns());
// return copy
return this;
}
}
// namespace may changed, check the name now
// overwrite star (but not with another star)
if (name() == "*" && rhs->name() != "*")
{
// simply set the new name
this->name(rhs->name());
// return copy
return this;
}
// return original
return this;
}
Compound_Selector_Ptr Element_Selector::unify_with(Compound_Selector_Ptr rhs)
{
// TODO: handle namespaces
// if the rhs is empty, just return a copy of this
if (rhs->length() == 0) {
rhs->append(this);
return rhs;
}
Simple_Selector_Ptr rhs_0 = rhs->at(0);
// otherwise, this is a tag name
if (name() == "*")
{
if (typeid(*rhs_0) == typeid(Element_Selector))
{
// if rhs is universal, just return this tagname + rhs's qualifiers
Element_Selector_Ptr ts = Cast<Element_Selector>(rhs_0);
rhs->at(0) = this->unify_with(ts);
return rhs;
}
else if (Cast<Class_Selector>(rhs_0) || Cast<Id_Selector>(rhs_0)) {
// qualifier is `.class`, so we can prefix with `ns|*.class`
if (has_ns() && !rhs_0->has_ns()) {
if (ns() != "*") rhs->elements().insert(rhs->begin(), this);
}
return rhs;
}
return rhs;
}
if (typeid(*rhs_0) == typeid(Element_Selector))
{
// if rhs is universal, just return this tagname + rhs's qualifiers
if (rhs_0->name() != "*" && rhs_0->ns() != "*" && rhs_0->name() != name()) return 0;
// otherwise create new compound and unify first simple selector
rhs->at(0) = this->unify_with(rhs_0);
return rhs;
}
// else it's a tag name and a bunch of qualifiers -- just append them
if (name() != "*") rhs->elements().insert(rhs->begin(), this);
return rhs;
}
Compound_Selector_Ptr Class_Selector::unify_with(Compound_Selector_Ptr rhs)
{
rhs->has_line_break(has_line_break());
return Simple_Selector::unify_with(rhs);
}
Compound_Selector_Ptr Id_Selector::unify_with(Compound_Selector_Ptr rhs)
{
for (size_t i = 0, L = rhs->length(); i < L; ++i)
{
if (Id_Selector_Ptr sel = Cast<Id_Selector>(rhs->at(i))) {
if (sel->name() != name()) return 0;
}
}
rhs->has_line_break(has_line_break());
return Simple_Selector::unify_with(rhs);
}
Compound_Selector_Ptr Pseudo_Selector::unify_with(Compound_Selector_Ptr rhs)
{
if (is_pseudo_element())
{
for (size_t i = 0, L = rhs->length(); i < L; ++i)
{
if (Pseudo_Selector_Ptr sel = Cast<Pseudo_Selector>(rhs->at(i))) {
if (sel->is_pseudo_element() && sel->name() != name()) return 0;
}
}
}
return Simple_Selector::unify_with(rhs);
}
bool Attribute_Selector::operator< (const Attribute_Selector& rhs) const
{
if (is_ns_eq(rhs)) {
if (name() == rhs.name()) {
if (matcher() == rhs.matcher()) {
bool no_lhs_val = value().isNull();
bool no_rhs_val = rhs.value().isNull();
if (no_lhs_val && no_rhs_val) return false; // equal
else if (no_lhs_val) return true; // lhs is null
else if (no_rhs_val) return false; // rhs is null
return *value() < *rhs.value(); // both are given
} else { return matcher() < rhs.matcher(); }
} else { return name() < rhs.name(); }
} else { return ns() < rhs.ns(); }
}
bool Attribute_Selector::operator< (const Simple_Selector& rhs) const
{
if (Attribute_Selector_Ptr_Const w = Cast<Attribute_Selector>(&rhs))
{
return *this < *w;
}
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Attribute_Selector::operator== (const Attribute_Selector& rhs) const
{
// get optional value state
bool no_lhs_val = value().isNull();
bool no_rhs_val = rhs.value().isNull();
// both are null, therefore equal
if (no_lhs_val && no_rhs_val) {
return (name() == rhs.name())
&& (matcher() == rhs.matcher())
&& (is_ns_eq(rhs));
}
// both are defined, evaluate
if (no_lhs_val == no_rhs_val) {
return (name() == rhs.name())
&& (matcher() == rhs.matcher())
&& (is_ns_eq(rhs))
&& (*value() == *rhs.value());
}
// not equal
return false;
}
bool Attribute_Selector::operator== (const Simple_Selector& rhs) const
{
if (Attribute_Selector_Ptr_Const w = Cast<Attribute_Selector>(&rhs))
{
return is_ns_eq(rhs) &&
name() == rhs.name() &&
*this == *w;
}
return false;
}
bool Element_Selector::operator< (const Element_Selector& rhs) const
{
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Element_Selector::operator< (const Simple_Selector& rhs) const
{
if (Element_Selector_Ptr_Const w = Cast<Element_Selector>(&rhs))
{
return *this < *w;
}
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Element_Selector::operator== (const Element_Selector& rhs) const
{
return is_ns_eq(rhs) &&
name() == rhs.name();
}
bool Element_Selector::operator== (const Simple_Selector& rhs) const
{
if (Element_Selector_Ptr_Const w = Cast<Element_Selector>(&rhs))
{
return is_ns_eq(rhs) &&
name() == rhs.name() &&
*this == *w;
}
return false;
}
bool Pseudo_Selector::operator== (const Pseudo_Selector& rhs) const
{
if (is_ns_eq(rhs) && name() == rhs.name())
{
String_Obj lhs_ex = expression();
String_Obj rhs_ex = rhs.expression();
if (rhs_ex && lhs_ex) return *lhs_ex == *rhs_ex;
else return lhs_ex.ptr() == rhs_ex.ptr();
}
else return false;
}
bool Pseudo_Selector::operator== (const Simple_Selector& rhs) const
{
if (Pseudo_Selector_Ptr_Const w = Cast<Pseudo_Selector>(&rhs))
{
return *this == *w;
}
return is_ns_eq(rhs) &&
name() == rhs.name();
}
bool Pseudo_Selector::operator< (const Pseudo_Selector& rhs) const
{
if (is_ns_eq(rhs) && name() == rhs.name())
{
String_Obj lhs_ex = expression();
String_Obj rhs_ex = rhs.expression();
if (rhs_ex && lhs_ex) return *lhs_ex < *rhs_ex;
else return lhs_ex.ptr() < rhs_ex.ptr();
}
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Pseudo_Selector::operator< (const Simple_Selector& rhs) const
{
if (Pseudo_Selector_Ptr_Const w = Cast<Pseudo_Selector>(&rhs))
{
return *this < *w;
}
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Wrapped_Selector::operator== (const Wrapped_Selector& rhs) const
{
if (is_ns_eq(rhs) && name() == rhs.name())
{ return *(selector()) == *(rhs.selector()); }
else return false;
}
bool Wrapped_Selector::operator== (const Simple_Selector& rhs) const
{
if (Wrapped_Selector_Ptr_Const w = Cast<Wrapped_Selector>(&rhs))
{
return *this == *w;
}
return is_ns_eq(rhs) &&
name() == rhs.name();
}
bool Wrapped_Selector::operator< (const Wrapped_Selector& rhs) const
{
if (is_ns_eq(rhs) && name() == rhs.name())
{ return *(selector()) < *(rhs.selector()); }
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Wrapped_Selector::operator< (const Simple_Selector& rhs) const
{
if (Wrapped_Selector_Ptr_Const w = Cast<Wrapped_Selector>(&rhs))
{
return *this < *w;
}
if (is_ns_eq(rhs))
{ return name() < rhs.name(); }
return ns() < rhs.ns();
}
bool Wrapped_Selector::is_superselector_of(Wrapped_Selector_Obj sub)
{
if (this->name() != sub->name()) return false;
if (this->name() == ":current") return false;
if (Selector_List_Obj rhs_list = Cast<Selector_List>(sub->selector())) {
if (Selector_List_Obj lhs_list = Cast<Selector_List>(selector())) {
return lhs_list->is_superselector_of(rhs_list);
}
}
coreError("is_superselector expected a Selector_List", sub->pstate());
return false;
}
bool Compound_Selector::is_superselector_of(Selector_List_Obj rhs, std::string wrapped)
{
for (Complex_Selector_Obj item : rhs->elements()) {
if (is_superselector_of(item, wrapped)) return true;
}
return false;
}
bool Compound_Selector::is_superselector_of(Complex_Selector_Obj rhs, std::string wrapped)
{
if (rhs->head()) return is_superselector_of(rhs->head(), wrapped);
return false;
}
bool Compound_Selector::is_superselector_of(Compound_Selector_Obj rhs, std::string wrapping)
{
Compound_Selector_Ptr lhs = this;
Simple_Selector_Ptr lbase = lhs->base();
Simple_Selector_Ptr rbase = rhs->base();
// Check if pseudo-elements are the same between the selectors
std::set<std::string> lpsuedoset, rpsuedoset;
for (size_t i = 0, L = length(); i < L; ++i)
{
if ((*this)[i]->is_pseudo_element()) {
std::string pseudo((*this)[i]->to_string());
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
lpsuedoset.insert(pseudo);
}
}
for (size_t i = 0, L = rhs->length(); i < L; ++i)
{
if ((*rhs)[i]->is_pseudo_element()) {
std::string pseudo((*rhs)[i]->to_string());
pseudo = pseudo.substr(pseudo.find_first_not_of(":")); // strip off colons to ensure :after matches ::after since ruby sass is forgiving
rpsuedoset.insert(pseudo);
}
}
if (lpsuedoset != rpsuedoset) {
return false;
}
// would like to replace this without stringification
// https://github.com/sass/sass/issues/2229
// SimpleSelectorSet lset, rset;
std::set<std::string> lset, rset;
if (lbase && rbase)
{
if (lbase->to_string() == rbase->to_string()) {
for (size_t i = 1, L = length(); i < L; ++i)
{ lset.insert((*this)[i]->to_string()); }
for (size_t i = 1, L = rhs->length(); i < L; ++i)
{ rset.insert((*rhs)[i]->to_string()); }
return includes(rset.begin(), rset.end(), lset.begin(), lset.end());
}
return false;
}
for (size_t i = 0, iL = length(); i < iL; ++i)
{
Selector_Obj wlhs = (*this)[i];
// very special case for wrapped matches selector
if (Wrapped_Selector_Obj wrapped = Cast<Wrapped_Selector>(wlhs)) {
if (wrapped->name() == ":not") {
if (Selector_List_Obj not_list = Cast<Selector_List>(wrapped->selector())) {
if (not_list->is_superselector_of(rhs, wrapped->name())) return false;
} else {
throw std::runtime_error("wrapped not selector is not a list");
}
}
if (wrapped->name() == ":matches" || wrapped->name() == ":-moz-any") {
wlhs = wrapped->selector();
if (Selector_List_Obj list = Cast<Selector_List>(wrapped->selector())) {
if (Compound_Selector_Obj comp = Cast<Compound_Selector>(rhs)) {
if (!wrapping.empty() && wrapping != wrapped->name()) return false;
if (wrapping.empty() || wrapping != wrapped->name()) {;
if (list->is_superselector_of(comp, wrapped->name())) return true;
}
}
}
}
Simple_Selector_Ptr rhs_sel = NULL;
if (rhs->elements().size() > i) rhs_sel = (*rhs)[i];
if (Wrapped_Selector_Ptr wrapped_r = Cast<Wrapped_Selector>(rhs_sel)) {
if (wrapped->name() == wrapped_r->name()) {
if (wrapped->is_superselector_of(wrapped_r)) {
continue;
}}
}
}
// match from here on as strings
lset.insert(wlhs->to_string());
}
for (size_t n = 0, nL = rhs->length(); n < nL; ++n)
{
Selector_Obj r = (*rhs)[n];
if (Wrapped_Selector_Obj wrapped = Cast<Wrapped_Selector>(r)) {
if (wrapped->name() == ":not") {
if (Selector_List_Obj ls = Cast<Selector_List>(wrapped->selector())) {
ls->remove_parent_selectors();
if (is_superselector_of(ls, wrapped->name())) return false;
}
}
if (wrapped->name() == ":matches" || wrapped->name() == ":-moz-any") {
if (!wrapping.empty()) {
if (wrapping != wrapped->name()) return false;
}
if (Selector_List_Obj ls = Cast<Selector_List>(wrapped->selector())) {
ls->remove_parent_selectors();
return (is_superselector_of(ls, wrapped->name()));
}
}
}
rset.insert(r->to_string());
}
//for (auto l : lset) { cerr << "l: " << l << endl; }
//for (auto r : rset) { cerr << "r: " << r << endl; }
if (lset.empty()) return true;
// return true if rset contains all the elements of lset
return includes(rset.begin(), rset.end(), lset.begin(), lset.end());
}
// create complex selector (ancestor of) from compound selector
Complex_Selector_Obj Compound_Selector::to_complex()
{
// create an intermediate complex selector
return SASS_MEMORY_NEW(Complex_Selector,
pstate(),
Complex_Selector::ANCESTOR_OF,
this,
0);
}
Selector_List_Ptr Complex_Selector::unify_with(Complex_Selector_Ptr other)
{
// get last tails (on the right side)
Complex_Selector_Obj l_last = this->last();
Complex_Selector_Obj r_last = other->last();
// check valid pointers (assertion)
SASS_ASSERT(l_last, "lhs is null");
SASS_ASSERT(r_last, "rhs is null");
// Not sure about this check, but closest way I could check
// was to see if this is a ruby 'SimpleSequence' equivalent.
// It seems to do the job correctly as some specs react to this
if (l_last->combinator() != Combinator::ANCESTOR_OF) return 0;
if (r_last->combinator() != Combinator::ANCESTOR_OF ) return 0;
// get the headers for the last tails
Compound_Selector_Obj l_last_head = l_last->head();
Compound_Selector_Obj r_last_head = r_last->head();
// check valid head pointers (assertion)
SASS_ASSERT(l_last_head, "lhs head is null");
SASS_ASSERT(r_last_head, "rhs head is null");
// get the unification of the last compound selectors
Compound_Selector_Obj unified = r_last_head->unify_with(l_last_head);
// abort if we could not unify heads
if (unified == 0) return 0;
// check for universal (star: `*`) selector
bool is_universal = l_last_head->is_universal() ||
r_last_head->is_universal();
if (is_universal)
{
// move the head
l_last->head(0);
r_last->head(unified);
}
// create nodes from both selectors
Node lhsNode = complexSelectorToNode(this);
Node rhsNode = complexSelectorToNode(other);
// overwrite universal base
if (!is_universal)
{
// create some temporaries to convert to node
Complex_Selector_Obj fake = unified->to_complex();
Node unified_node = complexSelectorToNode(fake);
// add to permutate the list?
rhsNode.plus(unified_node);
}
// do some magic we inherit from node and extend
Node node = subweave(lhsNode, rhsNode);
Selector_List_Obj result = SASS_MEMORY_NEW(Selector_List, pstate());
NodeDequePtr col = node.collection(); // move from collection to list
for (NodeDeque::iterator it = col->begin(), end = col->end(); it != end; it++)
{ result->append(nodeToComplexSelector(Node::naiveTrim(*it))); }
// only return if list has some entries
return result->length() ? result.detach() : 0;
}
bool Compound_Selector::operator== (const Compound_Selector& rhs) const
{
// for array access
size_t i = 0, n = 0;
size_t iL = length();
size_t nL = rhs.length();
// create temporary vectors and sort them
std::vector<Simple_Selector_Obj> l_lst = this->elements();
std::vector<Simple_Selector_Obj> r_lst = rhs.elements();
std::sort(l_lst.begin(), l_lst.end(), OrderNodes());
std::sort(r_lst.begin(), r_lst.end(), OrderNodes());
// process loop
while (true)
{
// first check for valid index
if (i == iL) return iL == nL;
else if (n == nL) return iL == nL;
// the access the vector items
Simple_Selector_Obj l = l_lst[i];
Simple_Selector_Obj r = r_lst[n];
// skip nulls
if (!l) ++i;
if (!r) ++n;
// do the check now
else if (*l != *r)
{ return false; }
// advance now
++i; ++n;
}
// there is no break?!
}
bool Complex_Selector::is_superselector_of(Compound_Selector_Obj rhs, std::string wrapping)
{
return last()->head() && last()->head()->is_superselector_of(rhs, wrapping);
}
bool Complex_Selector::is_superselector_of(Complex_Selector_Obj rhs, std::string wrapping)
{
Complex_Selector_Ptr lhs = this;
// check for selectors with leading or trailing combinators
if (!lhs->head() || !rhs->head())
{ return false; }
Complex_Selector_Obj l_innermost = lhs->innermost();
if (l_innermost->combinator() != Complex_Selector::ANCESTOR_OF)
{ return false; }
Complex_Selector_Obj r_innermost = rhs->innermost();
if (r_innermost->combinator() != Complex_Selector::ANCESTOR_OF)
{ return false; }
// more complex (i.e., longer) selectors are always more specific
size_t l_len = lhs->length(), r_len = rhs->length();
if (l_len > r_len)
{ return false; }
if (l_len == 1)
{ return lhs->head()->is_superselector_of(rhs->last()->head(), wrapping); }
// we have to look one tail deeper, since we cary the
// combinator around for it (which is important here)
if (rhs->tail() && lhs->tail() && combinator() != Complex_Selector::ANCESTOR_OF) {
Complex_Selector_Obj lhs_tail = lhs->tail();
Complex_Selector_Obj rhs_tail = rhs->tail();
if (lhs_tail->combinator() != rhs_tail->combinator()) return false;
if (lhs_tail->head() && !rhs_tail->head()) return false;
if (!lhs_tail->head() && rhs_tail->head()) return false;
if (lhs_tail->head() && rhs_tail->head()) {
if (!lhs_tail->head()->is_superselector_of(rhs_tail->head())) return false;
}
}
bool found = false;
Complex_Selector_Obj marker = rhs;
for (size_t i = 0, L = rhs->length(); i < L; ++i) {
if (i == L-1)
{ return false; }
if (lhs->head() && marker->head() && lhs->head()->is_superselector_of(marker->head(), wrapping))
{ found = true; break; }
marker = marker->tail();
}
if (!found)
{ return false; }
/*
Hmm, I hope I have the logic right:
if lhs has a combinator:
if !(marker has a combinator) return false
if !(lhs.combinator == '~' ? marker.combinator != '>' : lhs.combinator == marker.combinator) return false
return lhs.tail-without-innermost.is_superselector_of(marker.tail-without-innermost)
else if marker has a combinator:
if !(marker.combinator == ">") return false
return lhs.tail.is_superselector_of(marker.tail)
else
return lhs.tail.is_superselector_of(marker.tail)
*/
if (lhs->combinator() != Complex_Selector::ANCESTOR_OF)
{
if (marker->combinator() == Complex_Selector::ANCESTOR_OF)
{ return false; }
if (!(lhs->combinator() == Complex_Selector::PRECEDES ? marker->combinator() != Complex_Selector::PARENT_OF : lhs->combinator() == marker->combinator()))
{ return false; }
return lhs->tail()->is_superselector_of(marker->tail());
}
else if (marker->combinator() != Complex_Selector::ANCESTOR_OF)
{
if (marker->combinator() != Complex_Selector::PARENT_OF)
{ return false; }
return lhs->tail()->is_superselector_of(marker->tail());
}
return lhs->tail()->is_superselector_of(marker->tail());
}
size_t Complex_Selector::length() const
{
// TODO: make this iterative
if (!tail()) return 1;
return 1 + tail()->length();
}
// append another complex selector at the end
// check if we need to append some headers
// then we need to check for the combinator
// only then we can safely set the new tail
void Complex_Selector::append(Complex_Selector_Obj ss, Backtraces& traces)
{
Complex_Selector_Obj t = ss->tail();
Combinator c = ss->combinator();
String_Obj r = ss->reference();
Compound_Selector_Obj h = ss->head();
if (ss->has_line_feed()) has_line_feed(true);
if (ss->has_line_break()) has_line_break(true);
// append old headers
if (h && h->length()) {
if (last()->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) {
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(this, traces, ss);
} else if (last()->head_ && last()->head_->length()) {
Compound_Selector_Obj rh = last()->head();
size_t i;
size_t L = h->length();
if (Cast<Element_Selector>(h->first())) {
if (Class_Selector_Ptr cs = Cast<Class_Selector>(rh->last())) {
Class_Selector_Ptr sqs = SASS_MEMORY_COPY(cs);
sqs->name(sqs->name() + (*h)[0]->name());
sqs->pstate((*h)[0]->pstate());
(*rh)[rh->length()-1] = sqs;
rh->pstate(h->pstate());
for (i = 1; i < L; ++i) rh->append((*h)[i]);
} else if (Id_Selector_Ptr is = Cast<Id_Selector>(rh->last())) {
Id_Selector_Ptr sqs = SASS_MEMORY_COPY(is);
sqs->name(sqs->name() + (*h)[0]->name());
sqs->pstate((*h)[0]->pstate());
(*rh)[rh->length()-1] = sqs;
rh->pstate(h->pstate());
for (i = 1; i < L; ++i) rh->append((*h)[i]);
} else if (Element_Selector_Ptr ts = Cast<Element_Selector>(rh->last())) {
Element_Selector_Ptr tss = SASS_MEMORY_COPY(ts);
tss->name(tss->name() + (*h)[0]->name());
tss->pstate((*h)[0]->pstate());
(*rh)[rh->length()-1] = tss;
rh->pstate(h->pstate());
for (i = 1; i < L; ++i) rh->append((*h)[i]);
} else if (Placeholder_Selector_Ptr ps = Cast<Placeholder_Selector>(rh->last())) {
Placeholder_Selector_Ptr pss = SASS_MEMORY_COPY(ps);
pss->name(pss->name() + (*h)[0]->name());
pss->pstate((*h)[0]->pstate());
(*rh)[rh->length()-1] = pss;
rh->pstate(h->pstate());
for (i = 1; i < L; ++i) rh->append((*h)[i]);
} else {
last()->head_->concat(h);
}
} else {
last()->head_->concat(h);
}
} else if (last()->head_) {
last()->head_->concat(h);
}
} else {
// std::cerr << "has no or empty head\n";
}
if (last()) {
if (last()->combinator() != ANCESTOR_OF && c != ANCESTOR_OF) {
Complex_Selector_Ptr inter = SASS_MEMORY_NEW(Complex_Selector, pstate());
inter->reference(r);
inter->combinator(c);
inter->tail(t);
last()->tail(inter);
} else {
if (last()->combinator() == ANCESTOR_OF) {
last()->combinator(c);
last()->reference(r);
}
last()->tail(t);
}
}
}
Selector_List_Obj Selector_List::eval(Eval& eval)
{
Selector_List_Obj list = schema() ?
eval(schema()) : eval(this);
list->schema(schema());
return list;
}
Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
if (!this->has_parent_ref()) return this;
Selector_List_Ptr ss = SASS_MEMORY_NEW(Selector_List, pstate());
Selector_List_Ptr ps = pstack.back();
for (size_t pi = 0, pL = ps->length(); pi < pL; ++pi) {
for (size_t si = 0, sL = this->length(); si < sL; ++si) {
Selector_List_Obj rv = at(si)->resolve_parent_refs(pstack, traces, implicit_parent);
ss->concat(rv);
}
}
return ss;
}
Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Selector_List_Obj>& pstack, Backtraces& traces, bool implicit_parent)
{
Complex_Selector_Obj tail = this->tail();
Compound_Selector_Obj head = this->head();
Selector_List_Ptr parents = pstack.back();
if (!this->has_real_parent_ref() && !implicit_parent) {
Selector_List_Ptr retval = SASS_MEMORY_NEW(Selector_List, pstate());
retval->append(this);
return retval;
}
// first resolve_parent_refs the tail (which may return an expanded list)
Selector_List_Obj tails = tail ? tail->resolve_parent_refs(pstack, traces, implicit_parent) : 0;
if (head && head->length() > 0) {
Selector_List_Obj retval;
// we have a parent selector in a simple compound list
// mix parent complex selector into the compound list
if (Cast<Parent_Selector>((*head)[0])) {
retval = SASS_MEMORY_NEW(Selector_List, pstate());
// it turns out that real parent references reach
// across @at-root rules, which comes unexpected
if (parents == NULL && head->has_real_parent_ref()) {
int i = pstack.size() - 1;
while (!parents && i > -1) {
parents = pstack.at(i--);
}
}
if (parents && parents->length()) {
if (tails && tails->length() > 0) {
for (size_t n = 0, nL = tails->length(); n < nL; ++n) {
for (size_t i = 0, iL = parents->length(); i < iL; ++i) {
Complex_Selector_Obj t = (*tails)[n];
Complex_Selector_Obj parent = (*parents)[i];
Complex_Selector_Obj s = SASS_MEMORY_CLONE(parent);
Complex_Selector_Obj ss = SASS_MEMORY_CLONE(this);
ss->tail(t ? SASS_MEMORY_CLONE(t) : NULL);
Compound_Selector_Obj h = SASS_MEMORY_COPY(head_);
// remove parent selector from sequence
if (h->length()) {
h->erase(h->begin());
ss->head(h);
} else {
ss->head(NULL);
}
// adjust for parent selector (1 char)
// if (h->length()) {
// ParserState state(h->at(0)->pstate());
// state.offset.column += 1;
// state.column -= 1;
// (*h)[0]->pstate(state);
// }
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss, traces);
retval->append(s);
}
}
}
// have no tails but parents
// loop above is inside out
else {
for (size_t i = 0, iL = parents->length(); i < iL; ++i) {
Complex_Selector_Obj parent = (*parents)[i];
Complex_Selector_Obj s = SASS_MEMORY_CLONE(parent);
Complex_Selector_Obj ss = SASS_MEMORY_CLONE(this);
// this is only if valid if the parent has no trailing op
// otherwise we cannot append more simple selectors to head
if (parent->last()->combinator() != ANCESTOR_OF) {
traces.push_back(Backtrace(pstate()));
throw Exception::InvalidParent(parent, traces, ss);
}
ss->tail(tail ? SASS_MEMORY_CLONE(tail) : NULL);
Compound_Selector_Obj h = SASS_MEMORY_COPY(head_);
// remove parent selector from sequence
if (h->length()) {
h->erase(h->begin());
ss->head(h);
} else {
ss->head(NULL);
}
// \/ IMO ruby sass bug \/
ss->has_line_feed(false);
// adjust for parent selector (1 char)
// if (h->length()) {
// ParserState state(h->at(0)->pstate());
// state.offset.column += 1;
// state.column -= 1;
// (*h)[0]->pstate(state);
// }
// keep old parser state
s->pstate(pstate());
// append new tail
s->append(ss, traces);
retval->append(s);
}
}
}
// have no parent but some tails
else {
if (tails && tails->length() > 0) {
for (size_t n = 0, nL = tails->length(); n < nL; ++n) {
Complex_Selector_Obj cpy = SASS_MEMORY_CLONE(this);
cpy->tail(SASS_MEMORY_CLONE(tails->at(n)));
cpy->head(SASS_MEMORY_NEW(Compound_Selector, head->pstate()));
for (size_t i = 1, L = this->head()->length(); i < L; ++i)
cpy->head()->append((*this->head())[i]);
if (!cpy->head()->length()) cpy->head(0);
retval->append(cpy->skip_empty_reference());
}
}
// have no parent nor tails
else {
Complex_Selector_Obj cpy = SASS_MEMORY_CLONE(this);
cpy->head(SASS_MEMORY_NEW(Compound_Selector, head->pstate()));
for (size_t i = 1, L = this->head()->length(); i < L; ++i)
cpy->head()->append((*this->head())[i]);
if (!cpy->head()->length()) cpy->head(0);
retval->append(cpy->skip_empty_reference());
}
}
}
// no parent selector in head
else {
retval = this->tails(tails);
}
for (Simple_Selector_Obj ss : head->elements()) {
if (Wrapped_Selector_Ptr ws = Cast<Wrapped_Selector>(ss)) {
if (Selector_List_Ptr sl = Cast<Selector_List>(ws->selector())) {
if (parents) ws->selector(sl->resolve_parent_refs(pstack, traces, implicit_parent));
}
}
}
return retval.detach();
}
// has no head
return this->tails(tails);
}
Selector_List_Ptr Complex_Selector::tails(Selector_List_Ptr tails)
{
Selector_List_Ptr rv = SASS_MEMORY_NEW(Selector_List, pstate_);
if (tails && tails->length()) {
for (size_t i = 0, iL = tails->length(); i < iL; ++i) {
Complex_Selector_Obj pr = SASS_MEMORY_CLONE(this);
pr->tail(tails->at(i));
rv->append(pr);
}
}
else {
rv->append(this);
}
return rv;
}
// return the last tail that is defined
Complex_Selector_Obj Complex_Selector::first()
{
// declare variables used in loop
Complex_Selector_Obj cur = this;
Compound_Selector_Obj head;
// processing loop
while (cur)
{
// get the head
head = cur->head_;
// abort (and return) if it is not a parent selector
if (!head || head->length() != 1 || !Cast<Parent_Selector>((*head)[0])) {
break;
}
// advance to next
cur = cur->tail_;
}
// result
return cur;
}
// return the last tail that is defined
Complex_Selector_Obj Complex_Selector::last()
{
Complex_Selector_Ptr cur = this;
Complex_Selector_Ptr nxt = cur;
// loop until last
while (nxt) {
cur = nxt;
nxt = cur->tail();
}
return cur;
}
Complex_Selector::Combinator Complex_Selector::clear_innermost()
{
Combinator c;
if (!tail() || tail()->tail() == 0)
{ c = combinator(); combinator(ANCESTOR_OF); tail(0); }
else
{ c = tail()->clear_innermost(); }
return c;
}
void Complex_Selector::set_innermost(Complex_Selector_Obj val, Combinator c)
{
if (!tail())
{ tail(val); combinator(c); }
else
{ tail()->set_innermost(val, c); }
}
void Complex_Selector::cloneChildren()
{
if (head()) head(SASS_MEMORY_CLONE(head()));
if (tail()) tail(SASS_MEMORY_CLONE(tail()));
}
void Compound_Selector::cloneChildren()
{
for (size_t i = 0, l = length(); i < l; i++) {
at(i) = SASS_MEMORY_CLONE(at(i));
}
}
void Selector_List::cloneChildren()
{
for (size_t i = 0, l = length(); i < l; i++) {
at(i) = SASS_MEMORY_CLONE(at(i));
}
}
void Wrapped_Selector::cloneChildren()
{
selector(SASS_MEMORY_CLONE(selector()));
}
// remove parent selector references
// basically unwraps parsed selectors
void Selector_List::remove_parent_selectors()
{
// Check every rhs selector against left hand list
for(size_t i = 0, L = length(); i < L; ++i) {
if (!(*this)[i]->head()) continue;
if ((*this)[i]->head()->is_empty_reference()) {
// simply move to the next tail if we have "no" combinator
if ((*this)[i]->combinator() == Complex_Selector::ANCESTOR_OF) {
if ((*this)[i]->tail()) {
if ((*this)[i]->has_line_feed()) {
(*this)[i]->tail()->has_line_feed(true);
}
(*this)[i] = (*this)[i]->tail();
}
}
// otherwise remove the first item from head
else {
(*this)[i]->head()->erase((*this)[i]->head()->begin());
}
}
}
}
size_t Wrapped_Selector::hash()
{
if (hash_ == 0) {
hash_combine(hash_, Simple_Selector::hash());
if (selector_) hash_combine(hash_, selector_->hash());
}
return hash_;
}
bool Wrapped_Selector::has_parent_ref() const {
// if (has_reference()) return true;
if (!selector()) return false;
return selector()->has_parent_ref();
}
bool Wrapped_Selector::has_real_parent_ref() const {
// if (has_reference()) return true;
if (!selector()) return false;
return selector()->has_real_parent_ref();
}
unsigned long Wrapped_Selector::specificity() const
{
return selector_ ? selector_->specificity() : 0;
}
bool Selector_List::has_parent_ref() const
{
for (Complex_Selector_Obj s : elements()) {
if (s && s->has_parent_ref()) return true;
}
return false;
}
bool Selector_List::has_real_parent_ref() const
{
for (Complex_Selector_Obj s : elements()) {
if (s && s->has_real_parent_ref()) return true;
}
return false;
}
bool Selector_Schema::has_parent_ref() const
{
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
return schema->length() > 0 && Cast<Parent_Selector>(schema->at(0)) != NULL;
}
return false;
}
bool Selector_Schema::has_real_parent_ref() const
{
if (String_Schema_Obj schema = Cast<String_Schema>(contents())) {
Parent_Selector_Obj p = Cast<Parent_Selector>(schema->at(0));
return schema->length() > 0 && p && p->is_real_parent_ref();
}
return false;
}
void Selector_List::adjust_after_pushing(Complex_Selector_Obj c)
{
// if (c->has_reference()) has_reference(true);
}
// it's a superselector if every selector of the right side
// list is a superselector of the given left side selector
bool Complex_Selector::is_superselector_of(Selector_List_Obj sub, std::string wrapping)
{
// Check every rhs selector against left hand list
for(size_t i = 0, L = sub->length(); i < L; ++i) {
if (!is_superselector_of((*sub)[i], wrapping)) return false;
}
return true;
}
// it's a superselector if every selector of the right side
// list is a superselector of the given left side selector
bool Selector_List::is_superselector_of(Selector_List_Obj sub, std::string wrapping)
{
// Check every rhs selector against left hand list
for(size_t i = 0, L = sub->length(); i < L; ++i) {
if (!is_superselector_of((*sub)[i], wrapping)) return false;
}
return true;
}
// it's a superselector if every selector on the right side
// is a superselector of any one of the left side selectors
bool Selector_List::is_superselector_of(Compound_Selector_Obj sub, std::string wrapping)
{
// Check every lhs selector against right hand
for(size_t i = 0, L = length(); i < L; ++i) {
if ((*this)[i]->is_superselector_of(sub, wrapping)) return true;
}
return false;
}
// it's a superselector if every selector on the right side
// is a superselector of any one of the left side selectors
bool Selector_List::is_superselector_of(Complex_Selector_Obj sub, std::string wrapping)
{
// Check every lhs selector against right hand
for(size_t i = 0, L = length(); i < L; ++i) {
if ((*this)[i]->is_superselector_of(sub)) return true;
}
return false;
}
Selector_List_Ptr Selector_List::unify_with(Selector_List_Ptr rhs) {
std::vector<Complex_Selector_Obj> unified_complex_selectors;
// Unify all of children with RHS's children, storing the results in `unified_complex_selectors`
for (size_t lhs_i = 0, lhs_L = length(); lhs_i < lhs_L; ++lhs_i) {
Complex_Selector_Obj seq1 = (*this)[lhs_i];
for(size_t rhs_i = 0, rhs_L = rhs->length(); rhs_i < rhs_L; ++rhs_i) {
Complex_Selector_Ptr seq2 = rhs->at(rhs_i);
Selector_List_Obj result = seq1->unify_with(seq2);
if( result ) {
for(size_t i = 0, L = result->length(); i < L; ++i) {
unified_complex_selectors.push_back( (*result)[i] );
}
}
}
}
// Creates the final Selector_List by combining all the complex selectors
Selector_List_Ptr final_result = SASS_MEMORY_NEW(Selector_List, pstate());
for (auto itr = unified_complex_selectors.begin(); itr != unified_complex_selectors.end(); ++itr) {
final_result->append(*itr);
}
return final_result;
}
void Selector_List::populate_extends(Selector_List_Obj extendee, Subset_Map& extends)
{
Selector_List_Ptr extender = this;
for (auto complex_sel : extendee->elements()) {
Complex_Selector_Obj c = complex_sel;
// Ignore any parent selectors, until we find the first non Selectorerence head
Compound_Selector_Obj compound_sel = c->head();
Complex_Selector_Obj pIter = complex_sel;
while (pIter) {
Compound_Selector_Obj pHead = pIter->head();
if (pHead && Cast<Parent_Selector>(pHead->elements()[0]) == NULL) {
compound_sel = pHead;
break;
}
pIter = pIter->tail();
}
if (!pIter->head() || pIter->tail()) {
coreError("nested selectors may not be extended", c->pstate());
}
compound_sel->is_optional(extendee->is_optional());
for (size_t i = 0, L = extender->length(); i < L; ++i) {
extends.put(compound_sel, std::make_pair((*extender)[i], compound_sel));
}
}
};
void Compound_Selector::append(Simple_Selector_Ptr element)
{
Vectorized<Simple_Selector_Obj>::append(element);
pstate_.offset += element->pstate().offset;
}
Compound_Selector_Ptr Compound_Selector::minus(Compound_Selector_Ptr rhs)
{
Compound_Selector_Ptr result = SASS_MEMORY_NEW(Compound_Selector, pstate());
// result->has_parent_reference(has_parent_reference());
// not very efficient because it needs to preserve order
for (size_t i = 0, L = length(); i < L; ++i)
{
bool found = false;
std::string thisSelector((*this)[i]->to_string());
for (size_t j = 0, M = rhs->length(); j < M; ++j)
{
if (thisSelector == (*rhs)[j]->to_string())
{
found = true;
break;
}
}
if (!found) result->append((*this)[i]);
}
return result;
}
void Compound_Selector::mergeSources(ComplexSelectorSet& sources)
{
for (ComplexSelectorSet::iterator iterator = sources.begin(), endIterator = sources.end(); iterator != endIterator; ++iterator) {
this->sources_.insert(SASS_MEMORY_CLONE(*iterator));
}
}
Argument_Obj Arguments::get_rest_argument()
{
if (this->has_rest_argument()) {
for (Argument_Obj arg : this->elements()) {
if (arg->is_rest_argument()) {
return arg;
}
}
}
return NULL;
}
Argument_Obj Arguments::get_keyword_argument()
{
if (this->has_keyword_argument()) {
for (Argument_Obj arg : this->elements()) {
if (arg->is_keyword_argument()) {
return arg;
}
}
}
return NULL;
}
void Arguments::adjust_after_pushing(Argument_Obj a)
{
if (!a->name().empty()) {
if (has_keyword_argument()) {
coreError("named arguments must precede variable-length argument", a->pstate());
}
has_named_arguments(true);
}
else if (a->is_rest_argument()) {
if (has_rest_argument()) {
coreError("functions and mixins may only be called with one variable-length argument", a->pstate());
}
if (has_keyword_argument_) {
coreError("only keyword arguments may follow variable arguments", a->pstate());
}
has_rest_argument(true);
}
else if (a->is_keyword_argument()) {
if (has_keyword_argument()) {
coreError("functions and mixins may only be called with one keyword argument", a->pstate());
}
has_keyword_argument(true);
}
else {
if (has_rest_argument()) {
coreError("ordinal arguments must precede variable-length arguments", a->pstate());
}
if (has_named_arguments()) {
coreError("ordinal arguments must precede named arguments", a->pstate());
}
}
}
bool Ruleset::is_invisible() const {
if (Selector_List_Ptr sl = Cast<Selector_List>(selector())) {
for (size_t i = 0, L = sl->length(); i < L; ++i)
if (!(*sl)[i]->has_placeholder()) return false;
}
return true;
}
bool Media_Block::is_invisible() const {
for (size_t i = 0, L = block()->length(); i < L; ++i) {
Statement_Obj stm = block()->at(i);
if (!stm->is_invisible()) return false;
}
return true;
}
Number::Number(ParserState pstate, double val, std::string u, bool zero)
: Value(pstate),
Units(),
value_(val),
zero_(zero),
hash_(0)
{
size_t l = 0;
size_t r;
if (!u.empty()) {
bool nominator = true;
while (true) {
r = u.find_first_of("*/", l);
std::string unit(u.substr(l, r == std::string::npos ? r : r - l));
if (!unit.empty()) {
if (nominator) numerators.push_back(unit);
else denominators.push_back(unit);
}
if (r == std::string::npos) break;
// ToDo: should error for multiple slashes
// if (!nominator && u[r] == '/') error(...)
if (u[r] == '/')
nominator = false;
// strange math parsing?
// else if (u[r] == '*')
// nominator = true;
l = r + 1;
}
}
concrete_type(NUMBER);
}
// cancel out unnecessary units
void Number::reduce()
{
// apply conversion factor
value_ *= this->Units::reduce();
}
void Number::normalize()
{
// apply conversion factor
value_ *= this->Units::normalize();
}
bool Custom_Warning::operator== (const Expression& rhs) const
{
if (Custom_Warning_Ptr_Const r = Cast<Custom_Warning>(&rhs)) {
return message() == r->message();
}
return false;
}
bool Custom_Error::operator== (const Expression& rhs) const
{
if (Custom_Error_Ptr_Const r = Cast<Custom_Error>(&rhs)) {
return message() == r->message();
}
return false;
}
bool Number::operator== (const Expression& rhs) const
{
if (auto rhsnr = Cast<Number>(&rhs)) {
return *this == *rhsnr;
}
return false;
}
bool Number::operator== (const Number& rhs) const
{
Number l(*this), r(rhs); l.reduce(); r.reduce();
size_t lhs_units = l.numerators.size() + l.denominators.size();
size_t rhs_units = r.numerators.size() + r.denominators.size();
// unitless and only having one unit seems equivalent (will change in future)
if (!lhs_units || !rhs_units) {
return NEAR_EQUAL(l.value(), r.value());
}
l.normalize(); r.normalize();
Units &lhs_unit = l, &rhs_unit = r;
return lhs_unit == rhs_unit &&
NEAR_EQUAL(l.value(), r.value());
}
bool Number::operator< (const Number& rhs) const
{
Number l(*this), r(rhs); l.reduce(); r.reduce();
size_t lhs_units = l.numerators.size() + l.denominators.size();
size_t rhs_units = r.numerators.size() + r.denominators.size();
// unitless and only having one unit seems equivalent (will change in future)
if (!lhs_units || !rhs_units) {
return l.value() < r.value();
}
l.normalize(); r.normalize();
Units &lhs_unit = l, &rhs_unit = r;
if (!(lhs_unit == rhs_unit)) {
/* ToDo: do we always get usefull backtraces? */
throw Exception::IncompatibleUnits(rhs, *this);
}
return lhs_unit < rhs_unit ||
l.value() < r.value();
}
bool String_Quoted::operator== (const Expression& rhs) const
{
if (String_Quoted_Ptr_Const qstr = Cast<String_Quoted>(&rhs)) {
return (value() == qstr->value());
} else if (String_Constant_Ptr_Const cstr = Cast<String_Constant>(&rhs)) {
return (value() == cstr->value());
}
return false;
}
bool String_Constant::is_invisible() const {
return value_.empty() && quote_mark_ == 0;
}
bool String_Constant::operator== (const Expression& rhs) const
{
if (String_Quoted_Ptr_Const qstr = Cast<String_Quoted>(&rhs)) {
return (value() == qstr->value());
} else if (String_Constant_Ptr_Const cstr = Cast<String_Constant>(&rhs)) {
return (value() == cstr->value());
}
return false;
}
bool String_Schema::is_left_interpolant(void) const
{
return length() && first()->is_left_interpolant();
}
bool String_Schema::is_right_interpolant(void) const
{
return length() && last()->is_right_interpolant();
}
bool String_Schema::operator== (const Expression& rhs) const
{
if (String_Schema_Ptr_Const r = Cast<String_Schema>(&rhs)) {
if (length() != r->length()) return false;
for (size_t i = 0, L = length(); i < L; ++i) {
Expression_Obj rv = (*r)[i];
Expression_Obj lv = (*this)[i];
if (!lv || !rv) return false;
if (!(*lv == *rv)) return false;
}
return true;
}
return false;
}
bool Boolean::operator== (const Expression& rhs) const
{
if (Boolean_Ptr_Const r = Cast<Boolean>(&rhs)) {
return (value() == r->value());
}
return false;
}
bool Color::operator== (const Expression& rhs) const
{
if (Color_Ptr_Const r = Cast<Color>(&rhs)) {
return r_ == r->r() &&
g_ == r->g() &&
b_ == r->b() &&
a_ == r->a();
}
return false;
}
bool List::operator== (const Expression& rhs) const
{
if (List_Ptr_Const r = Cast<List>(&rhs)) {
if (length() != r->length()) return false;
if (separator() != r->separator()) return false;
if (is_bracketed() != r->is_bracketed()) return false;
for (size_t i = 0, L = length(); i < L; ++i) {
Expression_Obj rv = r->at(i);
Expression_Obj lv = this->at(i);
if (!lv || !rv) return false;
if (!(*lv == *rv)) return false;
}
return true;
}
return false;
}
bool Map::operator== (const Expression& rhs) const
{
if (Map_Ptr_Const r = Cast<Map>(&rhs)) {
if (length() != r->length()) return false;
for (auto key : keys()) {
Expression_Obj lv = at(key);
Expression_Obj rv = r->at(key);
if (!rv || !lv) return false;
if (!(*lv == *rv)) return false;
}
return true;
}
return false;
}
bool Null::operator== (const Expression& rhs) const
{
return rhs.concrete_type() == NULL_VAL;
}
bool Function::operator== (const Expression& rhs) const
{
if (Function_Ptr_Const r = Cast<Function>(&rhs)) {
Definition_Ptr_Const d1 = Cast<Definition>(definition());
Definition_Ptr_Const d2 = Cast<Definition>(r->definition());
return d1 && d2 && d1 == d2 && is_css() == r->is_css();
}
return false;
}
size_t List::size() const {
if (!is_arglist_) return length();
// arglist expects a list of arguments
// so we need to break before keywords
for (size_t i = 0, L = length(); i < L; ++i) {
Expression_Obj obj = this->at(i);
if (Argument_Ptr arg = Cast<Argument>(obj)) {
if (!arg->name().empty()) return i;
}
}
return length();
}
Expression_Obj Hashed::at(Expression_Obj k) const
{
if (elements_.count(k))
{ return elements_.at(k); }
else { return NULL; }
}
bool Binary_Expression::is_left_interpolant(void) const
{
return is_interpolant() || (left() && left()->is_left_interpolant());
}
bool Binary_Expression::is_right_interpolant(void) const
{
return is_interpolant() || (right() && right()->is_right_interpolant());
}
const std::string AST_Node::to_string(Sass_Inspect_Options opt) const
{
Sass_Output_Options out(opt);
Emitter emitter(out);
Inspect i(emitter);
i.in_declaration = true;
// ToDo: inspect should be const
const_cast<AST_Node_Ptr>(this)->perform(&i);
return i.get_buffer();
}
const std::string AST_Node::to_string() const
{
return to_string({ NESTED, 5 });
}
std::string String_Quoted::inspect() const
{
return quote(value_, '*');
}
std::string String_Constant::inspect() const
{
return quote(value_, '*');
}
bool Declaration::is_invisible() const
{
if (is_custom_property()) return false;
return !(value_ && value_->concrete_type() != Expression::NULL_VAL);
}
gitextract_enyzzzv5/ ├── .github/ │ └── workflows/ │ └── go.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefile ├── README.md ├── appveyor.yml ├── blah/ │ ├── blah.go │ ├── blah.scss │ └── error.scss ├── compiler.go ├── compiler_test.go ├── context.go ├── context_test.go ├── doc.go ├── encoding.go ├── encoding_test.go ├── error.go ├── error_test.go ├── examples/ │ ├── basic/ │ │ ├── file.scss │ │ └── main.go │ ├── customfunc/ │ │ ├── README.md │ │ └── main.go │ ├── custompreamble/ │ │ ├── README.md │ │ └── main.go │ └── options/ │ ├── file.scss │ ├── main.go │ └── partials/ │ └── _settings.sass ├── export.go ├── export_test.go ├── file_test.go ├── func.go ├── func_test.go ├── go.mod ├── go.sum ├── header.go ├── header_test.go ├── importer.go ├── importer_test.go ├── libs/ │ ├── SharedPtr.hpp │ ├── ast.hpp │ ├── ast_fwd_decl.hpp │ ├── base64vlq.hpp │ ├── bind.hpp │ ├── cencode.c │ ├── check_nesting.hpp │ ├── color_maps.hpp │ ├── color_names.hpp │ ├── constants.hpp │ ├── context.hpp │ ├── cssize.hpp │ ├── docs.go │ ├── emitter.hpp │ ├── encoding.go │ ├── environment.hpp │ ├── error_handling.hpp │ ├── eval.hpp │ ├── expand.hpp │ ├── export.go │ ├── extend.hpp │ ├── file.hpp │ ├── func.go │ ├── functions.hpp │ ├── header.go │ ├── helpers.go │ ├── importer.go │ ├── inspect.hpp │ ├── json.hpp │ ├── kwd_arg_macros.hpp │ ├── lexer.hpp │ ├── listize.hpp │ ├── mapping.hpp │ ├── node.hpp │ ├── operation.hpp │ ├── output.hpp │ ├── parser.hpp │ ├── paths.hpp │ ├── plugins.hpp │ ├── position.hpp │ ├── prelexer.hpp │ ├── remove_placeholders.hpp │ ├── safemap.go │ ├── sass_number.go │ ├── sass_number_test.go │ ├── sass_util.hpp │ ├── source_map.hpp │ ├── subset_map.hpp │ ├── to_c.hpp │ ├── to_string.hpp │ ├── to_value.hpp │ ├── toscss.go │ ├── units.hpp │ ├── unity.cpp │ ├── utf8.h │ ├── utf8_string.hpp │ ├── util.hpp │ ├── values.hpp │ ├── wrap.go │ ├── wrap_dev.go │ └── wrap_main.go ├── libsass-build/ │ ├── ast.cpp │ ├── ast.hpp │ ├── ast_def_macros.hpp │ ├── ast_fwd_decl.cpp │ ├── ast_fwd_decl.hpp │ ├── b64/ │ │ ├── cencode.h │ │ └── encode.h │ ├── backtrace.cpp │ ├── backtrace.hpp │ ├── base64vlq.cpp │ ├── base64vlq.hpp │ ├── bind.cpp │ ├── bind.hpp │ ├── c99func.c │ ├── cencode.c │ ├── check_nesting.cpp │ ├── check_nesting.hpp │ ├── color_maps.cpp │ ├── color_maps.hpp │ ├── constants.cpp │ ├── constants.hpp │ ├── context.cpp │ ├── context.hpp │ ├── cssize.cpp │ ├── cssize.hpp │ ├── debug.hpp │ ├── debugger.hpp │ ├── emitter.cpp │ ├── emitter.hpp │ ├── environment.cpp │ ├── environment.hpp │ ├── error_handling.cpp │ ├── error_handling.hpp │ ├── eval.cpp │ ├── eval.hpp │ ├── expand.cpp │ ├── expand.hpp │ ├── extend.cpp │ ├── extend.hpp │ ├── file.cpp │ ├── file.hpp │ ├── functions.cpp │ ├── functions.hpp │ ├── include/ │ │ ├── sass/ │ │ │ ├── base.h │ │ │ ├── context.h │ │ │ ├── functions.h │ │ │ ├── values.h │ │ │ ├── version.h │ │ │ └── version.h.in │ │ ├── sass.h │ │ └── sass2scss.h │ ├── inspect.cpp │ ├── inspect.hpp │ ├── json.cpp │ ├── json.hpp │ ├── kwd_arg_macros.hpp │ ├── lexer.cpp │ ├── lexer.hpp │ ├── listize.cpp │ ├── listize.hpp │ ├── mapping.hpp │ ├── memory/ │ │ ├── SharedPtr.cpp │ │ └── SharedPtr.hpp │ ├── node.cpp │ ├── node.hpp │ ├── operation.hpp │ ├── operators.cpp │ ├── operators.hpp │ ├── output.cpp │ ├── output.hpp │ ├── parser.cpp │ ├── parser.hpp │ ├── paths.hpp │ ├── plugins.cpp │ ├── plugins.hpp │ ├── position.cpp │ ├── position.hpp │ ├── prelexer.cpp │ ├── prelexer.hpp │ ├── remove_placeholders.cpp │ ├── remove_placeholders.hpp │ ├── sass.cpp │ ├── sass.hpp │ ├── sass2scss.cpp │ ├── sass_context.cpp │ ├── sass_context.hpp │ ├── sass_functions.cpp │ ├── sass_functions.hpp │ ├── sass_util.cpp │ ├── sass_util.hpp │ ├── sass_values.cpp │ ├── sass_values.hpp │ ├── source_map.cpp │ ├── source_map.hpp │ ├── subset_map.cpp │ ├── subset_map.hpp │ ├── to_c.cpp │ ├── to_c.hpp │ ├── to_value.cpp │ ├── to_value.hpp │ ├── units.cpp │ ├── units.hpp │ ├── utf8/ │ │ ├── checked.h │ │ ├── core.h │ │ └── unchecked.h │ ├── utf8.h │ ├── utf8_string.cpp │ ├── utf8_string.hpp │ ├── util.cpp │ ├── util.hpp │ ├── values.cpp │ └── values.hpp ├── mixins.go ├── options.go ├── options_test.go ├── test/ │ └── scss/ │ ├── _include.scss │ ├── basic.scss │ ├── file.scss │ ├── main.scss │ └── sprite.scss ├── toscss.go ├── toscss_test.go ├── unicode_test.go ├── version.go └── version_test.go
SYMBOL INDEX (2097 symbols across 148 files)
FILE: blah/blah.go
function main (line 9) | func main() {
function run (line 14) | func run(path string) {
FILE: compiler.go
type Pather (line 18) | type Pather interface
type Compiler (line 31) | type Compiler interface
function New (line 58) | func New(dst io.Writer, src io.Reader, opts ...FuncOpt) (Compiler, error) {
type sass (line 76) | type sass struct
method run (line 104) | func (c *sass) run() error {
method BuildDir (line 116) | func (s *sass) BuildDir() string {
method CacheBust (line 121) | func (c *sass) CacheBust() string {
method HTTPPath (line 125) | func (s *sass) HTTPPath() string {
method ImgBuildDir (line 130) | func (s *sass) ImgBuildDir() string {
method ImgDir (line 135) | func (c *sass) ImgDir() string {
method Imports (line 141) | func (c *sass) Imports() []string {
method FontDir (line 146) | func (c *sass) FontDir() string {
method LineComments (line 151) | func (c *sass) LineComments() bool {
method Payload (line 155) | func (c *sass) Payload() context.Context {
method Run (line 160) | func (c *sass) Run() error {
method Syntax (line 164) | func (c *sass) Syntax() Syntax {
FILE: compiler_test.go
function ExampleCompiler_stdin (line 12) | func ExampleCompiler_stdin() {
function ExampleComipler_sass (line 32) | func ExampleComipler_sass() {
function TestCompiler_path (line 52) | func TestCompiler_path(t *testing.T) {
function TestCompiler_path_withpathsresolver (line 77) | func TestCompiler_path_withpathsresolver(t *testing.T) {
function TestCompiler_path_withabsresolver (line 125) | func TestCompiler_path_withabsresolver(t *testing.T) {
FILE: context.go
type compctx (line 19) | type compctx struct
method Init (line 104) | func (ctx *compctx) Init(goopts libs.SassOptions) libs.SassOptions {
method fileCompile (line 127) | func (ctx *compctx) fileCompile(path string, out io.Writer, mappath, s...
method compile (line 200) | func (ctx *compctx) compile(out io.Writer, in io.Reader) error {
method RelativeImage (line 272) | func (p *compctx) RelativeImage() string {
constant NESTED_STYLE (line 74) | NESTED_STYLE = iota
constant EXPANDED_STYLE (line 75) | EXPANDED_STYLE
constant COMPACT_STYLE (line 76) | COMPACT_STYLE
constant COMPRESSED_STYLE (line 77) | COMPRESSED_STYLE
function init (line 82) | func init() {
function newContext (line 91) | func newContext() *compctx {
FILE: context_test.go
function TestContextFile (line 12) | func TestContextFile(t *testing.T) {
function TestContextNilRun (line 49) | func TestContextNilRun(t *testing.T) {
function TestContextRun (line 61) | func TestContextRun(t *testing.T) {
function TestLibsassError (line 91) | func TestLibsassError(t *testing.T) {
function ExampleContext_Compile (line 124) | func ExampleContext_Compile() {
function BenchmarkContextCompile (line 152) | func BenchmarkContextCompile(b *testing.B) {
FILE: encoding.go
type SassValue (line 18) | type SassValue struct
method Val (line 22) | func (sv SassValue) Val() libs.UnionSassValue {
function NewSassValue (line 26) | func NewSassValue() SassValue {
function unmarshal (line 30) | func unmarshal(arg SassValue, v interface{}) error {
function Unmarshal (line 134) | func Unmarshal(arg SassValue, v ...interface{}) error {
function getKind (line 176) | func getKind(v interface{}) reflect.Kind {
function noSassNumberUnit (line 186) | func noSassNumberUnit(arg SassValue) bool {
function getSassNumberUnit (line 191) | func getSassNumberUnit(arg SassValue) (string, error) {
function Marshal (line 203) | func Marshal(v interface{}) (SassValue, error) {
function makevalue (line 208) | func makevalue(v interface{}) (SassValue, error) {
function throwMisMatchTypeError (line 245) | func throwMisMatchTypeError(arg SassValue, expectedType string) error {
FILE: encoding_test.go
type unsupportedStruct (line 12) | type unsupportedStruct struct
type TestError (line 16) | type TestError interface
function testMarshal (line 20) | func testMarshal(t TestError, v interface{}) SassValue {
function TestUnmarshalNumber (line 28) | func TestUnmarshalNumber(t *testing.T) {
function TestUnmarshalStringValue (line 59) | func TestUnmarshalStringValue(t *testing.T) {
function TestUnmarshalError (line 69) | func TestUnmarshalError(t *testing.T) {
function TestUnmarshal_complex (line 82) | func TestUnmarshal_complex(t *testing.T) {
function TestUnmarshal_unknown (line 102) | func TestUnmarshal_unknown(t *testing.T) {
function TestMarshalInvalidUnitSassNumber (line 119) | func TestMarshalInvalidUnitSassNumber(t *testing.T) {
function TestMarshal_list (line 130) | func TestMarshal_list(t *testing.T) {
function TestMarshal_number_interface (line 152) | func TestMarshal_number_interface(t *testing.T) {
function TestMarshalBool (line 164) | func TestMarshalBool(t *testing.T) {
function TestMarshalInterfaceListToMultiVariable (line 176) | func TestMarshalInterfaceListToMultiVariable(t *testing.T) {
function TestMarshalInterfaceListToMultiVariablewList (line 199) | func TestMarshalInterfaceListToMultiVariablewList(t *testing.T) {
function TestMarshalInterfaceListSingleVariable (line 229) | func TestMarshalInterfaceListSingleVariable(t *testing.T) {
function TestMarshalSassNumber (line 242) | func TestMarshalSassNumber(t *testing.T) {
function TestMarshalError (line 257) | func TestMarshalError(t *testing.T) {
function TestMarshalColor (line 269) | func TestMarshalColor(t *testing.T) {
function TestListListtoInterfaceList (line 286) | func TestListListtoInterfaceList(t *testing.T) {
function TestSlice_make (line 306) | func TestSlice_make(t *testing.T) {
function TestSlice_mixedtypes (line 332) | func TestSlice_mixedtypes(t *testing.T) {
function TestSV_equal (line 344) | func TestSV_equal(t *testing.T) {
function TestMarshal_map_set (line 366) | func TestMarshal_map_set(t *testing.T) {
function TestMarshalUnsupportedStruct (line 378) | func TestMarshalUnsupportedStruct(t *testing.T) {
function TestQuotedStringUnmarshal (line 394) | func TestQuotedStringUnmarshal(t *testing.T) {
function TestOptionalParameters (line 413) | func TestOptionalParameters(t *testing.T) {
function TestNullUnionSassValue (line 445) | func TestNullUnionSassValue(t *testing.T) {
function TestWrongUnmarshalToFloatType (line 455) | func TestWrongUnmarshalToFloatType(t *testing.T) {
FILE: error.go
type SassError (line 10) | type SassError struct
method ProcessSassError (line 17) | func (ctx *compctx) ProcessSassError(bs []byte) error {
method Error (line 34) | func (ctx *compctx) Error() string {
method Reset (line 39) | func (ctx *compctx) Reset() {
method ErrorLine (line 45) | func (ctx *compctx) ErrorLine() int {
FILE: error_test.go
type ErrorMap (line 10) | type ErrorMap struct
function TestError_basic (line 15) | func TestError_basic(t *testing.T) {
function TestError_JSON (line 41) | func TestError_JSON(t *testing.T) {
function TestError_unbound (line 63) | func TestError_unbound(t *testing.T) {
function TestError_function (line 81) | func TestError_function(t *testing.T) {
function TestError_import (line 106) | func TestError_import(t *testing.T) {
function TestError_processsass (line 127) | func TestError_processsass(t *testing.T) {
function TestError_invalid (line 152) | func TestError_invalid(t *testing.T) {
function TestError_line (line 161) | func TestError_line(t *testing.T) {
FILE: examples/basic/main.go
function main (line 10) | func main() {
FILE: examples/customfunc/main.go
function cryptotext (line 16) | func cryptotext(ctx context.Context, usv libsass.SassValue) (*libsass.Sa...
function main (line 28) | func main() {
FILE: examples/custompreamble/main.go
function main (line 12) | func main() {
FILE: examples/options/main.go
function main (line 10) | func main() {
FILE: export.go
function Error (line 6) | func Error(err error) SassValue {
function Warn (line 11) | func Warn(s string) SassValue {
FILE: export_test.go
function TestRegisterHandler (line 8) | func TestRegisterHandler(t *testing.T) {
function TestError_simple (line 21) | func TestError_simple(t *testing.T) {
FILE: file_test.go
function TestFile_resolved (line 10) | func TestFile_resolved(t *testing.T) {
FILE: func.go
function RegisterSassFunc (line 18) | func RegisterSassFunc(sign string, fn SassFunc) {
type key (line 27) | type key
constant compkey (line 30) | compkey key = iota
function NewCompilerContext (line 33) | func NewCompilerContext(c Compiler) context.Context {
function CompFromCtx (line 40) | func CompFromCtx(ctx context.Context) (Compiler, error) {
type SassFunc (line 50) | type SassFunc
function SassHandler (line 54) | func SassHandler(h SassFunc) libs.SassCallback {
function RegisterHandler (line 86) | func RegisterHandler(sign string, callback HandlerFunc) {
type HandlerFunc (line 97) | type HandlerFunc
function Handler (line 102) | func Handler(h HandlerFunc) libs.SassCallback {
type handler (line 119) | type handler struct
function testCallback (line 126) | func testCallback(h HandlerFunc) libs.SassCallback {
type Func (line 141) | type Func struct
type Funcs (line 147) | type Funcs struct
method Add (line 166) | func (fs *Funcs) Add(f Func) {
method Bind (line 174) | func (fs *Funcs) Bind(goopts libs.SassOptions) {
method Close (line 198) | func (fs *Funcs) Close() {
function NewFuncs (line 159) | func NewFuncs(ctx *compctx) *Funcs {
FILE: func_test.go
function TestFunc_simpletypes (line 13) | func TestFunc_simpletypes(t *testing.T) {
function TestFunc_colortype (line 65) | func TestFunc_colortype(t *testing.T) {
function TestFunc_complextypes (line 112) | func TestFunc_complextypes(t *testing.T) {
function TestFunc_customarity (line 154) | func TestFunc_customarity(t *testing.T) {
FILE: header.go
function RegisterHeader (line 13) | func RegisterHeader(body string) {
type Header (line 19) | type Header struct
type Headers (line 24) | type Headers struct
method Bind (line 42) | func (hdrs *Headers) Bind(opts libs.SassOptions) {
method Close (line 70) | func (hdrs *Headers) Close() {
method Add (line 77) | func (h *Headers) Add(s string) {
method Has (line 86) | func (h *Headers) Has(s string) bool {
method Len (line 95) | func (h *Headers) Len() int {
function NewHeaders (line 35) | func NewHeaders() *Headers {
FILE: header_test.go
function TestSassHeader_single (line 8) | func TestSassHeader_single(t *testing.T) {
function TestSassHeader_multi (line 37) | func TestSassHeader_multi(t *testing.T) {
FILE: importer.go
type Import (line 18) | type Import struct
method ModTime (line 27) | func (i Import) ModTime() time.Time {
type Imports (line 32) | type Imports struct
method Close (line 72) | func (i *Imports) Close() {
method Init (line 78) | func (p *Imports) Init() {
method Add (line 83) | func (p *Imports) Add(prev string, path string, bs []byte) error {
method Del (line 103) | func (p *Imports) Del(path string) {
method Get (line 111) | func (p *Imports) Get(prev, path string) ([]byte, error) {
method Update (line 124) | func (p *Imports) Update(name string) {
method Len (line 131) | func (p *Imports) Len() int {
method Bind (line 137) | func (p *Imports) Bind(opts libs.SassOptions) {
type ResolverCallback (line 41) | type ResolverCallback struct
function NewImports (line 46) | func NewImports() *Imports {
function NewImportsWithResolver (line 52) | func NewImportsWithResolver(resolver libs.ImportResolver) *Imports {
function NewImportsWithAbsResolver (line 62) | func NewImportsWithAbsResolver(resolver libs.ImportResolver) *Imports {
FILE: importer_test.go
function TestSassImport_single (line 9) | func TestSassImport_single(t *testing.T) {
function TestSassImport_file (line 29) | func TestSassImport_file(t *testing.T) {
function TestSassImport_multi (line 49) | func TestSassImport_multi(t *testing.T) {
function TestSassImporter_placeholder (line 75) | func TestSassImporter_placeholder(t *testing.T) {
function TestSassImporter_nested_placeholder (line 97) | func TestSassImporter_nested_placeholder(t *testing.T) {
function TestSassImporter_invalidimport (line 127) | func TestSassImporter_invalidimport(t *testing.T) {
function TestSassImporter_notfound (line 150) | func TestSassImporter_notfound(t *testing.T) {
FILE: libs/encoding.go
type UnionSassValue (line 12) | type UnionSassValue
function NewUnionSassValue (line 15) | func NewUnionSassValue() UnionSassValue {
function CloneValue (line 19) | func CloneValue(usv UnionSassValue) UnionSassValue {
function DeleteValue (line 23) | func DeleteValue(usv UnionSassValue) {
function MakeNil (line 28) | func MakeNil() UnionSassValue {
function MakeBool (line 33) | func MakeBool(b bool) UnionSassValue {
function MakeError (line 38) | func MakeError(s string) UnionSassValue {
function MakeWarning (line 45) | func MakeWarning(s string) UnionSassValue {
function MakeString (line 51) | func MakeString(s string) UnionSassValue {
function MakeNumber (line 58) | func MakeNumber(f float64, unit string) UnionSassValue {
function MakeColor (line 66) | func MakeColor(c color.RGBA) UnionSassValue {
function MakeList (line 75) | func MakeList(len int) UnionSassValue {
function MakeMap (line 80) | func MakeMap(len int) UnionSassValue {
function Slice (line 85) | func Slice(usv UnionSassValue, inf interface{}) {
function IsNil (line 117) | func IsNil(usv UnionSassValue) bool {
function IsBool (line 121) | func IsBool(usv UnionSassValue) bool {
function IsString (line 125) | func IsString(usv UnionSassValue) bool {
function IsColor (line 129) | func IsColor(usv UnionSassValue) bool {
function IsNumber (line 133) | func IsNumber(usv UnionSassValue) bool {
function IsList (line 137) | func IsList(usv UnionSassValue) bool {
function IsMap (line 141) | func IsMap(usv UnionSassValue) bool {
function IsError (line 145) | func IsError(usv UnionSassValue) bool {
function Interface (line 150) | func Interface(usv UnionSassValue) interface{} {
function Len (line 174) | func Len(usv UnionSassValue) int {
function Error (line 184) | func Error(usv UnionSassValue) string {
function String (line 190) | func String(usv UnionSassValue) string {
type SassNumber (line 196) | type SassNumber struct
method Float (line 201) | func (n SassNumber) Float() float64 {
method UnitOf (line 205) | func (n SassNumber) UnitOf() string {
function Number (line 209) | func Number(usv UnionSassValue) SassNumber {
function Float (line 216) | func Float(usv UnionSassValue) float64 {
function Unit (line 221) | func Unit(usv UnionSassValue) string {
function Bool (line 226) | func Bool(usv UnionSassValue) bool {
function Color (line 231) | func Color(usv UnionSassValue) color.Color {
function Index (line 240) | func Index(usv UnionSassValue, i int) UnionSassValue {
function SetIndex (line 250) | func SetIndex(usv UnionSassValue, i int, item UnionSassValue) {
function MapKeys (line 260) | func MapKeys(m UnionSassValue) []UnionSassValue {
function mapVals (line 268) | func mapVals(m UnionSassValue) []UnionSassValue {
FILE: libs/export.go
type SassCallback (line 13) | type SassCallback
type Cookie (line 18) | type Cookie struct
function GoBridge (line 31) | func GoBridge(cargs UnionSassValue, cidx C.int) UnionSassValue {
FILE: libs/func.go
type SassFunc (line 20) | type SassFunc
function SassMakeFunction (line 23) | func SassMakeFunction(signature string, idx int) SassFunc {
function init (line 36) | func init() {
function BindFuncs (line 42) | func BindFuncs(opts SassOptions, cookies []Cookie) []int {
function RemoveFuncs (line 62) | func RemoveFuncs(ids []int) error {
FILE: libs/header.go
function init (line 23) | func init() {
function BindHeader (line 29) | func BindHeader(opts SassOptions, entries []ImportEntry) int {
function RemoveHeaders (line 48) | func RemoveHeaders(idx int) error {
FILE: libs/helpers.go
function GetImportList (line 12) | func GetImportList(ctx SassContext) []string {
function Version (line 28) | func Version() string {
FILE: libs/importer.go
type ImportResolver (line 45) | type ImportResolver
type ResolverMode (line 47) | type ResolverMode
constant ResolverModeImporterUrl (line 50) | ResolverModeImporterUrl ResolverMode = iota
constant ResolverModeImporterAbsPath (line 51) | ResolverModeImporterAbsPath
function init (line 54) | func init() {
function BindImporter (line 59) | func BindImporter(opts SassOptions, resolverMode ResolverMode, resolver ...
function RemoveImporter (line 86) | func RemoveImporter(idx int) error {
FILE: libs/safemap.go
type SafeMap (line 7) | type SafeMap struct
method nextidx (line 13) | func (s *SafeMap) nextidx() int {
method init (line 20) | func (s *SafeMap) init() {
method Get (line 24) | func (s *SafeMap) Get(idx int) interface{} {
method Del (line 30) | func (s *SafeMap) Del(idx int) {
method Set (line 37) | func (s *SafeMap) Set(ie interface{}) int {
FILE: libs/sass_number.go
method String (line 8) | func (s SassNumber) String() string {
method Add (line 151) | func (sn SassNumber) Add(sn2 SassNumber) SassNumber {
method Subtract (line 157) | func (sn SassNumber) Subtract(sn2 SassNumber) SassNumber {
method Multiply (line 164) | func (sn SassNumber) Multiply(sn2 SassNumber) SassNumber {
method Divide (line 170) | func (sn SassNumber) Divide(sn2 SassNumber) SassNumber {
function getConvertedUnits (line 175) | func getConvertedUnits(sn1 SassNumber, sn2 SassNumber) (float64, float64) {
function convertUnits (line 186) | func convertUnits(from SassNumber, to SassNumber) float64 {
FILE: libs/sass_number_test.go
function TestSassNumberAddDifferentUnits (line 10) | func TestSassNumberAddDifferentUnits(t *testing.T) {
function TestSassNumberAddSameUnits (line 24) | func TestSassNumberAddSameUnits(t *testing.T) {
function TestSassNumberSubstractDifferentUnits (line 38) | func TestSassNumberSubstractDifferentUnits(t *testing.T) {
function TestSassNumberSubtractSameUnits (line 52) | func TestSassNumberSubtractSameUnits(t *testing.T) {
function TestSassNumberMultiplyDifferentUnits (line 66) | func TestSassNumberMultiplyDifferentUnits(t *testing.T) {
function TestSassNumberMultiplySameUnits (line 80) | func TestSassNumberMultiplySameUnits(t *testing.T) {
function TestSassNumberDivideDifferentUnits (line 94) | func TestSassNumberDivideDifferentUnits(t *testing.T) {
function TestSassNumberDivideSameUnits (line 108) | func TestSassNumberDivideSameUnits(t *testing.T) {
function TestChainedOperation (line 150) | func TestChainedOperation(t *testing.T) {
function compareFloats (line 168) | func compareFloats(f1 float64, f2 float64) bool {
FILE: libs/toscss.go
function ToScss (line 14) | func ToScss(r io.Reader, w io.Writer) error {
FILE: libs/wrap.go
type SassImporter (line 22) | type SassImporter
type SassImporterList (line 23) | type SassImporterList
function SassMakeImporterList (line 26) | func SassMakeImporterList(gol int) SassImporterList {
type ImportEntry (line 32) | type ImportEntry struct
function HeaderBridge (line 40) | func HeaderBridge(cint C.uintptr_t) C.Sass_Import_List {
function GetEntry (line 71) | func GetEntry(es []ImportEntry, parent string, path string) (string, err...
function ImporterBridge (line 84) | func ImporterBridge(url *C.char, prev *C.char, cidx C.uintptr_t) C.Sass_...
type SassImportList (line 134) | type SassImportList
type SassFileContext (line 136) | type SassFileContext
function SassMakeFileContext (line 139) | func SassMakeFileContext(gos string) SassFileContext {
function SassDeleteFileContext (line 146) | func SassDeleteFileContext(fc SassFileContext) {
type SassDataContext (line 150) | type SassDataContext
function SassMakeDataContext (line 153) | func SassMakeDataContext(gos string) SassDataContext {
function SassDeleteDataContext (line 160) | func SassDeleteDataContext(dc SassDataContext) {
type SassContext (line 164) | type SassContext
function SassDataContextGetContext (line 168) | func SassDataContextGetContext(godc SassDataContext) SassContext {
function SassFileContextGetContext (line 175) | func SassFileContextGetContext(gofc SassFileContext) SassContext {
type SassOptions (line 181) | type SassOptions
function SassMakeOptions (line 184) | func SassMakeOptions() SassOptions {
function SassFileContextGetOptions (line 190) | func SassFileContextGetOptions(gofc SassFileContext) SassOptions {
function SassFileContextSetOptions (line 196) | func SassFileContextSetOptions(gofc SassFileContext, goopts SassOptions) {
function SassDataContextGetOptions (line 201) | func SassDataContextGetOptions(godc SassDataContext) SassOptions {
function SassDataContextSetOptions (line 207) | func SassDataContextSetOptions(godc SassDataContext, goopts SassOptions) {
type SassCompiler (line 211) | type SassCompiler
function SassMakeFileCompiler (line 214) | func SassMakeFileCompiler(gofc SassFileContext) SassCompiler {
function SassMakeDataCompiler (line 220) | func SassMakeDataCompiler(godc SassDataContext) SassCompiler {
function SassCompileFileContext (line 226) | func SassCompileFileContext(gofc SassFileContext) int {
function SassCompilerParse (line 232) | func SassCompilerParse(c SassCompiler) {
function SassCompilerExecute (line 237) | func SassCompilerExecute(c SassCompiler) {
function SassDeleteCompiler (line 242) | func SassDeleteCompiler(c SassCompiler) {
function SassOptionSetCHeaders (line 247) | func SassOptionSetCHeaders(gofc SassOptions, goimp SassImporterList) {
function SassContextGetOutputString (line 253) | func SassContextGetOutputString(goctx SassContext) string {
function SassContextGetErrorJSON (line 260) | func SassContextGetErrorJSON(goctx SassContext) string {
function SassContextGetErrorStatus (line 267) | func SassContextGetErrorStatus(goctx SassContext) int {
function SassOptionGetSourceMapFile (line 272) | func SassOptionGetSourceMapFile(goopts SassOptions) string {
function SassContextGetSourceMapString (line 279) | func SassContextGetSourceMapString(goctx SassContext) string {
function SassOptionSetPrecision (line 286) | func SassOptionSetPrecision(goopts SassOptions, i int) {
function SassOptionSetOutputStyle (line 291) | func SassOptionSetOutputStyle(goopts SassOptions, i int) {
function SassOptionSetSourceComments (line 296) | func SassOptionSetSourceComments(goopts SassOptions, b bool) {
function SassOptionSetOutputPath (line 304) | func SassOptionSetOutputPath(goopts SassOptions, path string) {
function SassOptionSetInputPath (line 312) | func SassOptionSetInputPath(goopts SassOptions, path string) {
function SassOptionSetIncludePath (line 317) | func SassOptionSetIncludePath(goopts SassOptions, path string) {
function SassOptionSetSourceMapEmbed (line 321) | func SassOptionSetSourceMapEmbed(goopts SassOptions, b bool) {
function SassOptionSetSourceMapContents (line 325) | func SassOptionSetSourceMapContents(goopts SassOptions, b bool) {
function SassOptionSetSourceMapFile (line 329) | func SassOptionSetSourceMapFile(goopts SassOptions, path string) {
function SassOptionSetSourceMapRoot (line 336) | func SassOptionSetSourceMapRoot(goopts SassOptions, path string) {
function SassOptionSetOmitSourceMapURL (line 340) | func SassOptionSetOmitSourceMapURL(goopts SassOptions, b bool) {
type SassImportEntry (line 344) | type SassImportEntry
function SassMakeImport (line 348) | func SassMakeImport(path string, base string, source string, srcmap stri...
type SassImporterFN (line 354) | type SassImporterFN
function SassImporterGetFunction (line 356) | func SassImporterGetFunction(goimp SassImporter) SassImporterFN {
function SassImporterGetListEntry (line 361) | func SassImporterGetListEntry() {}
function SassMakeImporter (line 365) | func SassMakeImporter(fn SassImporterFN, priority int, v interface{}) (S...
function SassImporterSetListEntry (line 377) | func SassImporterSetListEntry(golst SassImporterList, idx int, ent SassI...
function SassOptionSetCImporters (line 381) | func SassOptionSetCImporters(goopts SassOptions, golst SassImporterList) {
function SassOptionSetCFunctions (line 385) | func SassOptionSetCFunctions() {
FILE: libsass-build/ast.cpp
type Sass (line 18) | namespace Sass {
function str_rtrim (line 73) | void str_rtrim(std::string& str, const std::string& delimiters = " \f\...
function Compound_Selector_Ptr (line 337) | Compound_Selector_Ptr Compound_Selector::unify_with(Compound_Selector_...
function Compound_Selector_Ptr (line 508) | Compound_Selector_Ptr Simple_Selector::unify_with(Compound_Selector_Pt...
function Simple_Selector_Ptr (line 541) | Simple_Selector_Ptr Element_Selector::unify_with(Simple_Selector_Ptr rhs)
function Compound_Selector_Ptr (line 572) | Compound_Selector_Ptr Element_Selector::unify_with(Compound_Selector_P...
function Compound_Selector_Ptr (line 619) | Compound_Selector_Ptr Class_Selector::unify_with(Compound_Selector_Ptr...
function Compound_Selector_Ptr (line 625) | Compound_Selector_Ptr Id_Selector::unify_with(Compound_Selector_Ptr rhs)
function Compound_Selector_Ptr (line 637) | Compound_Selector_Ptr Pseudo_Selector::unify_with(Compound_Selector_Pt...
function Complex_Selector_Obj (line 973) | Complex_Selector_Obj Compound_Selector::to_complex()
function Selector_List_Ptr (line 983) | Selector_List_Ptr Complex_Selector::unify_with(Complex_Selector_Ptr ot...
function Selector_List_Obj (line 1254) | Selector_List_Obj Selector_List::eval(Eval& eval)
function Selector_List_Ptr (line 1262) | Selector_List_Ptr Selector_List::resolve_parent_refs(std::vector<Selec...
function Selector_List_Ptr (line 1276) | Selector_List_Ptr Complex_Selector::resolve_parent_refs(std::vector<Se...
function Selector_List_Ptr (line 1423) | Selector_List_Ptr Complex_Selector::tails(Selector_List_Ptr tails)
function Complex_Selector_Obj (line 1440) | Complex_Selector_Obj Complex_Selector::first()
function Complex_Selector_Obj (line 1462) | Complex_Selector_Obj Complex_Selector::last()
function Selector_List_Ptr (line 1648) | Selector_List_Ptr Selector_List::unify_with(Selector_List_Ptr rhs) {
function Compound_Selector_Ptr (line 1712) | Compound_Selector_Ptr Compound_Selector::minus(Compound_Selector_Ptr rhs)
function Argument_Obj (line 1743) | Argument_Obj Arguments::get_rest_argument()
function Argument_Obj (line 1755) | Argument_Obj Arguments::get_keyword_argument()
function Expression_Obj (line 2046) | Expression_Obj Hashed::at(Expression_Obj k) const
function Expression_Obj (line 2098) | Expression_Obj List::value_at_index(size_t i) {
function List_Obj (line 2114) | List_Obj Map::to_list(ParserState& pstate) {
FILE: libsass-build/ast.hpp
class Operand (line 83) | class Operand {
method Operand (line 85) | Operand(Sass_OP operand, bool ws_before = false, bool ws_after = false)
type Sass_OP (line 89) | enum Sass_OP
function hash_combine (line 100) | void hash_combine (std::size_t& seed, const T& val)
function namespace (line 110) | class AST_Node : public SharedObj {
class Vectorized (line 293) | class Vectorized {
method reset_hash (line 297) | void reset_hash() { hash_ = 0; }
method adjust_after_pushing (line 298) | virtual void adjust_after_pushing(T element) { }
method Vectorized (line 300) | Vectorized(size_t s = 0) : elements_(std::vector<T>()), hash_(0)
method length (line 303) | size_t length() const { return elements_.size(); }
method empty (line 304) | bool empty() const { return elements_.empty(); }
method clear (line 305) | void clear() { return elements_.clear(); }
method T (line 306) | T last() const { return elements_.back(); }
method T (line 307) | T first() const { return elements_.front(); }
method T (line 308) | T& operator[](size_t i) { return elements_[i]; }
method T (line 309) | virtual const T& at(size_t i) const { return elements_.at(i); }
method T (line 310) | virtual T& at(size_t i) { return elements_.at(i); }
method T (line 311) | const T& operator[](size_t i) const { return elements_[i]; }
method append (line 312) | virtual void append(T element)
method concat (line 320) | virtual void concat(Vectorized* v)
method Vectorized (line 324) | Vectorized& unshift(T element)
method hash (line 333) | virtual size_t hash()
method end (line 343) | typename std::vector<T>::iterator end() { return elements_.end(); }
method begin (line 344) | typename std::vector<T>::iterator begin() { return elements_.begin(); }
method end (line 345) | typename std::vector<T>::const_iterator end() const { return elements_...
method begin (line 346) | typename std::vector<T>::const_iterator begin() const { return element...
method erase (line 347) | typename std::vector<T>::iterator erase(typename std::vector<T>::itera...
method erase (line 348) | typename std::vector<T>::const_iterator erase(typename std::vector<T>:...
class Hashed (line 358) | class Hashed {
method reset_hash (line 365) | void reset_hash() { hash_ = 0; }
method reset_duplicate_key (line 366) | void reset_duplicate_key() { duplicate_key_ = 0; }
method adjust_after_pushing (line 367) | virtual void adjust_after_pushing(std::pair<Expression_Obj, Expression...
method Hashed (line 369) | Hashed(size_t s = 0)
method length (line 375) | size_t length() const { return list_.size(); }
method empty (line 376) | bool empty() const { return list_.empty(); }
method has (line 377) | bool has(Expression_Obj k) const { return elements_.count(k) ...
method has_duplicate_key (line 379) | bool has_duplicate_key() const { return duplicate_key_ != 0; }
method Expression_Obj (line 380) | Expression_Obj get_duplicate_key() const { return duplicate_key_; }
method ExpressionMap (line 381) | const ExpressionMap elements() { return elements_; }
method Hashed (line 382) | Hashed& operator<<(std::pair<Expression_Obj, Expression_Obj> p)
method Hashed (line 394) | Hashed& operator+=(Hashed* h)
method ExpressionMap (line 409) | const ExpressionMap& pairs() const { return elements_; }
class Statement (line 426) | class Statement : public AST_Node {
type Statement_Type (line 428) | enum Statement_Type {
method Statement (line 458) | Statement(ParserState pstate, Statement_Type st = NONE, size_t t = 0)
method Statement (line 461) | Statement(const Statement* ptr)
method is_invisible (line 469) | virtual bool is_invisible() const { return false; }
method bubbles (line 470) | virtual bool bubbles() { return false; }
method has_content (line 471) | virtual bool has_content()
function adjust_after_pushing (line 485) | void adjust_after_pushing(Statement_Obj s)
function Block (line 489) | Block(ParserState pstate, size_t s = 0, bool r = false)
function Block (line 494) | Block(const Block* ptr)
function has_content (line 499) | virtual bool has_content()
class Has_Block (line 513) | class Has_Block : public Statement {
method Has_Block (line 516) | Has_Block(ParserState pstate, Block_Obj b)
method Has_Block (line 519) | Has_Block(const Has_Block* ptr)
method has_content (line 522) | virtual bool has_content()
function Ruleset (line 538) | Ruleset(ParserState pstate, Selector_List_Obj s = 0, Block_Obj b = 0)
function Ruleset (line 541) | Ruleset(const Ruleset* ptr)
function Bubble (line 558) | Bubble(ParserState pstate, Statement_Obj n, Statement_Obj g = 0, size_t ...
function Bubble (line 561) | Bubble(const Bubble* ptr)
function bubbles (line 566) | bool bubbles() { return true; }
function Trace (line 578) | Trace(ParserState pstate, std::string n, Block_Obj b = 0, char type = 'm')
function Trace (line 581) | Trace(const Trace* ptr)
function Media_Block (line 596) | Media_Block(ParserState pstate, List_Obj mqs, Block_Obj b)
function Media_Block (line 599) | Media_Block(const Media_Block* ptr)
function bubbles (line 602) | bool bubbles() { return true; }
function Directive (line 617) | Directive(ParserState pstate, std::string kwd, Selector_List_Obj sel = 0...
function Directive (line 620) | Directive(const Directive* ptr)
function bubbles (line 626) | bool bubbles() { return is_keyframes() || is_media(); }
function is_media (line 627) | bool is_media() {
function is_keyframes (line 633) | bool is_keyframes() {
function Keyframe_Rule (line 651) | Keyframe_Rule(ParserState pstate, Block_Obj b)
function Keyframe_Rule (line 654) | Keyframe_Rule(const Keyframe_Rule* ptr)
function Declaration (line 671) | Declaration(ParserState pstate,
function Declaration (line 675) | Declaration(const Declaration* ptr)
function Assignment (line 697) | Assignment(ParserState pstate,
function Assignment (line 703) | Assignment(const Assignment* ptr)
function Import (line 723) | Import(ParserState pstate)
function Import (line 729) | Import(const Import* ptr)
function abs_path (line 746) | std::string abs_path() { return resource_.abs_path; }
function imp_path (line 747) | std::string imp_path() { return resource_.imp_path; }
function Include (line 748) | Include resource() { return resource_; }
function Import_Stub (line 750) | Import_Stub(ParserState pstate, Include res)
function Import_Stub (line 753) | Import_Stub(const Import_Stub* ptr)
function Warning (line 766) | Warning(ParserState pstate, Expression_Obj msg)
function Warning (line 769) | Warning(const Warning* ptr)
function Error (line 782) | Error(ParserState pstate, Expression_Obj msg)
function Error (line 785) | Error(const Error* ptr)
function Debug (line 798) | Debug(ParserState pstate, Expression_Obj val)
function Debug (line 801) | Debug(const Debug* ptr)
function Comment (line 815) | Comment(ParserState pstate, String_Obj txt, bool is_important)
function Comment (line 818) | Comment(const Comment* ptr)
function is_invisible (line 823) | virtual bool is_invisible() const
function If (line 836) | If(ParserState pstate, Expression_Obj pred, Block_Obj con, Block_Obj alt...
function If (line 839) | If(const If* ptr)
function has_content (line 844) | virtual bool has_content()
function For (line 861) | For(ParserState pstate,
function For (line 866) | For(const For* ptr)
function Each (line 884) | Each(ParserState pstate, std::vector<std::string> vars, Expression_Obj l...
function Each (line 887) | Each(const Each* ptr)
function While (line 900) | While(ParserState pstate, Expression_Obj pred, Block_Obj b)
function While (line 903) | While(const While* ptr)
function Return (line 916) | Return(ParserState pstate, Expression_Obj val)
function Return (line 919) | Return(const Return* ptr)
function Extension (line 932) | Extension(ParserState pstate, Selector_List_Obj s)
function Extension (line 935) | Extension(const Extension* ptr)
type Backtrace (line 946) | struct Backtrace
type Type (line 951) | enum Type { MIXIN, FUNCTION }
function Definition (line 962) | Definition(const Definition* ptr)
function Definition (line 975) | Definition(ParserState pstate,
function Definition (line 991) | Definition(ParserState pstate,
function Definition (line 1008) | Definition(ParserState pstate,
function Mixin_Call (line 1037) | Mixin_Call(ParserState pstate, std::string n, Arguments_Obj args, Block_...
function Mixin_Call (line 1040) | Mixin_Call(const Mixin_Call* ptr)
function Content (line 1055) | Content(ParserState pstate)
function Content (line 1059) | Content(const Content* ptr)
function adjust_after_pushing (line 1072) | void adjust_after_pushing(Expression_Obj e) { is_expanded(false); }
type Sass_Separator (line 1074) | enum Sass_Separator
function List (line 1079) | List(ParserState pstate,
function List (line 1088) | List(const List* ptr)
function type (line 1096) | std::string type() const { return is_arglist_ ? "arglist" : "list"; }
function type_name (line 1097) | static std::string type_name() { return "list"; }
function is_invisible (line 1102) | bool is_invisible() const { return empty() && !is_bracketed(); }
function hash (line 1107) | virtual size_t hash()
function set_delayed (line 1118) | virtual void set_delayed(bool delayed)
function adjust_after_pushing (line 1134) | void adjust_after_pushing(std::pair<Expression_Obj, Expression_Obj> p) {...
function Map (line 1136) | Map(ParserState pstate,
function Map (line 1141) | Map(const Map* ptr)
function type (line 1145) | std::string type() const { return "map"; }
function type_name (line 1146) | static std::string type_name() { return "map"; }
function is_invisible (line 1147) | bool is_invisible() const { return empty(); }
function hash (line 1150) | virtual size_t hash()
function sass_op_to_name (line 1168) | inline static const std::string sass_op_to_name(enum Sass_OP op) {
function sass_op_separator (line 1189) | inline static const std::string sass_op_separator(enum Sass_OP op) {
function Binary_Expression (line 1222) | Binary_Expression(ParserState pstate,
function Binary_Expression (line 1226) | Binary_Expression(const Binary_Expression* ptr)
function type_name (line 1233) | const std::string type_name() {
function separator (line 1236) | const std::string separator() {
function has_interpolant (line 1241) | bool has_interpolant() const
function set_delayed (line 1246) | virtual void set_delayed(bool delayed)
function hash (line 1268) | virtual size_t hash()
function optype (line 1277) | enum Sass_OP optype() const { return op_.operand; }
type Type (line 1287) | enum Type { PLUS, MINUS, NOT, SLASH }
function Unary_Expression (line 1293) | Unary_Expression(ParserState pstate, Type t, Expression_Obj o)
function Unary_Expression (line 1296) | Unary_Expression(const Unary_Expression* ptr)
function type_name (line 1302) | const std::string type_name() {
function hash (line 1326) | virtual size_t hash()
function Argument (line 1348) | Argument(ParserState pstate, Expression_Obj val, std::string n = "", boo...
function Argument (line 1355) | Argument(const Argument* ptr)
function hash (line 1384) | virtual size_t hash()
function Arguments (line 1409) | Arguments(ParserState pstate)
function Arguments (line 1416) | Arguments(const Arguments* ptr)
function Function (line 1441) | Function(ParserState pstate, Definition_Obj def, bool css)
function Function (line 1444) | Function(const Function* ptr)
function type (line 1448) | std::string type() const { return "function"; }
function type_name (line 1449) | static std::string type_name() { return "function"; }
function is_invisible (line 1450) | bool is_invisible() const { return true; }
function name (line 1452) | std::string name() {
function Function_Call (line 1476) | Function_Call(ParserState pstate, std::string n, Arguments_Obj args, voi...
function Function_Call (line 1479) | Function_Call(ParserState pstate, std::string n, Arguments_Obj args, Fun...
function Function_Call (line 1482) | Function_Call(ParserState pstate, std::string n, Arguments_Obj args)
function Function_Call (line 1485) | Function_Call(const Function_Call* ptr)
function is_css (line 1495) | bool is_css() {
function hash (line 1518) | virtual size_t hash()
function Function_Call_Schema (line 1538) | Function_Call_Schema(ParserState pstate, String_Obj n, Arguments_Obj args)
function Function_Call_Schema (line 1541) | Function_Call_Schema(const Function_Call_Schema* ptr)
function Variable (line 1556) | Variable(ParserState pstate, std::string n)
function Variable (line 1559) | Variable(const Variable* ptr)
function hash (line 1577) | virtual size_t hash()
function Number (line 1596) | Number(const Number* ptr)
function zero (line 1603) | bool zero() { return zero_; }
function type (line 1604) | std::string type() const { return "number"; }
function type_name (line 1605) | static std::string type_name() { return "number"; }
function hash (line 1610) | virtual size_t hash()
function Color (line 1640) | Color(ParserState pstate, double r, double g, double b, double a = 1, co...
function Color (line 1644) | Color(const Color* ptr)
function type (line 1653) | std::string type() const { return "color"; }
function type_name (line 1654) | static std::string type_name() { return "color"; }
function hash (line 1656) | virtual size_t hash()
function Custom_Error (line 1679) | Custom_Error(ParserState pstate, std::string msg)
function Custom_Error (line 1682) | Custom_Error(const Custom_Error* ptr)
function Custom_Warning (line 1696) | Custom_Warning(ParserState pstate, std::string msg)
function Custom_Warning (line 1699) | Custom_Warning(const Custom_Warning* ptr)
function Boolean (line 1714) | Boolean(ParserState pstate, bool val)
function Boolean (line 1718) | Boolean(const Boolean* ptr)
function type (line 1724) | std::string type() const { return "bool"; }
function type_name (line 1725) | static std::string type_name() { return "bool"; }
function is_false (line 1726) | virtual bool is_false() { return !value_; }
function hash (line 1728) | virtual size_t hash()
function String (line 1748) | String(ParserState pstate, bool delayed = false)
function String (line 1751) | String(const String* ptr)
function type_name (line 1754) | static std::string type_name() { return "string"; }
function String_Schema (line 1774) | String_Schema(ParserState pstate, size_t size = 0, bool css = true)
function String_Schema (line 1777) | String_Schema(const String_Schema* ptr)
function type (line 1784) | std::string type() const { return "string"; }
function type_name (line 1785) | static std::string type_name() { return "string"; }
function has_interpolants (line 1790) | bool has_interpolants() {
function hash (line 1798) | virtual size_t hash()
function set_delayed (line 1807) | virtual void set_delayed(bool delayed) {
function String_Constant (line 1826) | String_Constant(const String_Constant* ptr)
function String_Constant (line 1833) | String_Constant(ParserState pstate, std::string val, bool css = true)
function String_Constant (line 1836) | String_Constant(ParserState pstate, const char* beg, bool css = true)
function String_Constant (line 1839) | String_Constant(ParserState pstate, const char* beg, const char* end, bo...
function String_Constant (line 1842) | String_Constant(ParserState pstate, const Token& tok, bool css = true)
function type (line 1845) | std::string type() const { return "string"; }
function type_name (line 1846) | static std::string type_name() { return "string"; }
function hash (line 1850) | virtual size_t hash()
function double_quote (line 1862) | static char double_quote() { return '"'; }
function single_quote (line 1863) | static char single_quote() { return '\''; }
function String_Quoted (line 1874) | String_Quoted(ParserState pstate, std::string val, char q = 0,
function String_Quoted (line 1884) | String_Quoted(const String_Quoted* ptr)
function Media_Query (line 1902) | Media_Query(ParserState pstate,
function Media_Query (line 1907) | Media_Query(const Media_Query* ptr)
function Media_Query_Expression (line 1926) | Media_Query_Expression(ParserState pstate,
function Media_Query_Expression (line 1930) | Media_Query_Expression(const Media_Query_Expression* ptr)
function Supports_Block (line 1946) | Supports_Block(ParserState pstate, Supports_Condition_Obj condition, Blo...
function Supports_Block (line 1949) | Supports_Block(const Supports_Block* ptr)
function bubbles (line 1952) | bool bubbles() { return true; }
function Supports_Condition (line 1962) | Supports_Condition(ParserState pstate)
function Supports_Condition (line 1965) | Supports_Condition(const Supports_Condition* ptr)
function needs_parens (line 1968) | virtual bool needs_parens(Supports_Condition_Obj cond) const { return fa...
type Operand (line 1978) | enum Operand { AND, OR }
method Operand (line 85) | Operand(Sass_OP operand, bool ws_before = false, bool ws_after = false)
type Sass_OP (line 89) | enum Sass_OP
function Supports_Operator (line 1984) | Supports_Operator(ParserState pstate, Supports_Condition_Obj l, Supports...
function Supports_Operator (line 1987) | Supports_Operator(const Supports_Operator* ptr)
function Supports_Negation (line 2005) | Supports_Negation(ParserState pstate, Supports_Condition_Obj c)
function Supports_Negation (line 2008) | Supports_Negation(const Supports_Negation* ptr)
function Supports_Declaration (line 2024) | Supports_Declaration(ParserState pstate, Expression_Obj f, Expression_Ob...
function Supports_Declaration (line 2027) | Supports_Declaration(const Supports_Declaration* ptr)
function needs_parens (line 2032) | virtual bool needs_parens(Supports_Condition_Obj cond) const { return fa...
function Supports_Interpolation (line 2044) | Supports_Interpolation(ParserState pstate, Expression_Obj v)
function Supports_Interpolation (line 2047) | Supports_Interpolation(const Supports_Interpolation* ptr)
function needs_parens (line 2051) | virtual bool needs_parens(Supports_Condition_Obj cond) const { return fa...
function At_Root_Query (line 2064) | At_Root_Query(ParserState pstate, Expression_Obj f = 0, Expression_Obj v...
function At_Root_Query (line 2067) | At_Root_Query(const At_Root_Query* ptr)
function At_Root_Block (line 2083) | At_Root_Block(ParserState pstate, Block_Obj b = 0, At_Root_Query_Obj e = 0)
function At_Root_Block (line 2086) | At_Root_Block(const At_Root_Block* ptr)
function bubbles (line 2089) | bool bubbles() { return true; }
function exclude_node (line 2090) | bool exclude_node(Statement_Obj s) {
function Null (line 2132) | Null(ParserState pstate) : Value(pstate) { concrete_type(NULL_VAL); }
function Null (line 2133) | Null(const Null* ptr) : Value(ptr) { concrete_type(NULL_VAL); }
function type (line 2134) | std::string type() const { return "null"; }
function type_name (line 2135) | static std::string type_name() { return "null"; }
function is_invisible (line 2136) | bool is_invisible() const { return true; }
function is_false (line 2138) | bool is_false() { return true; }
function hash (line 2140) | virtual size_t hash()
class Thunk (line 2154) | class Thunk : public Expression {
method Thunk (line 2158) | Thunk(ParserState pstate, Expression_Obj exp, Env* env = 0)
function Parameter (line 2171) | Parameter(ParserState pstate,
function Parameter (line 2181) | Parameter(const Parameter* ptr)
function adjust_after_pushing (line 2206) | void adjust_after_pushing(Parameter_Obj p)
function Parameters (line 2230) | Parameters(ParserState pstate)
function Parameters (line 2236) | Parameters(const Parameters* ptr)
class Selector (line 2249) | class Selector : public Expression {
method Selector (line 2265) | Selector(ParserState pstate)
method Selector (line 2273) | Selector(const Selector* ptr)
method set_media_block (line 2285) | virtual void set_media_block(Media_Block_Ptr mb) {
method has_parent_ref (line 2288) | virtual bool has_parent_ref() const {
method has_real_parent_ref (line 2291) | virtual bool has_real_parent_ref() const {
function Selector_Schema (line 2314) | Selector_Schema(ParserState pstate, String_Obj c)
function Selector_Schema (line 2321) | Selector_Schema(const Selector_Schema* ptr)
function specificity (line 2334) | virtual unsigned long specificity() const { return 0; }
function hash (line 2335) | virtual size_t hash() {
class Simple_Selector (line 2348) | class Simple_Selector : public Selector {
method Simple_Selector (line 2354) | Simple_Selector(ParserState pstate, std::string n = "")
method Simple_Selector (line 2366) | Simple_Selector(const Simple_Selector* ptr)
method ns_name (line 2372) | virtual std::string ns_name() const
method hash (line 2379) | virtual size_t hash()
method is_universal_ns (line 2391) | bool is_universal_ns() const
method has_universal_ns (line 2395) | bool has_universal_ns() const
method is_empty_ns (line 2399) | bool is_empty_ns() const
method has_empty_ns (line 2403) | bool has_empty_ns() const
method has_qualified_ns (line 2407) | bool has_qualified_ns() const
method is_universal (line 2412) | bool is_universal() const
method has_placeholder (line 2417) | virtual bool has_placeholder() {
method has_parent_ref (line 2423) | virtual bool has_parent_ref() const { return false; }
method has_real_parent_ref (line 2424) | virtual bool has_real_parent_ref() const { return false; }
method is_pseudo_element (line 2425) | virtual bool is_pseudo_element() const { return false; }
method is_superselector_of (line 2427) | virtual bool is_superselector_of(Compound_Selector_Obj sub) { return f...
function Parent_Selector (line 2451) | Parent_Selector(ParserState pstate, bool r = true)
function Parent_Selector (line 2454) | Parent_Selector(const Parent_Selector* ptr)
function is_real_parent_ref (line 2457) | bool is_real_parent_ref() const { return real(); }
function has_parent_ref (line 2458) | virtual bool has_parent_ref() const { return true; }
function has_real_parent_ref (line 2459) | virtual bool has_real_parent_ref() const { return is_real_parent_ref(); }
function specificity (line 2460) | virtual unsigned long specificity() const
function type (line 2464) | std::string type() const { return "selector"; }
function type_name (line 2465) | static std::string type_name() { return "selector"; }
function Placeholder_Selector (line 2475) | Placeholder_Selector(ParserState pstate, std::string n)
function Placeholder_Selector (line 2478) | Placeholder_Selector(const Placeholder_Selector* ptr)
function specificity (line 2481) | virtual unsigned long specificity() const
function has_placeholder (line 2485) | virtual bool has_placeholder() {
function Element_Selector (line 2498) | Element_Selector(ParserState pstate, std::string n)
function Element_Selector (line 2501) | Element_Selector(const Element_Selector* ptr)
function specificity (line 2504) | virtual unsigned long specificity() const
function Class_Selector (line 2524) | Class_Selector(ParserState pstate, std::string n)
function Class_Selector (line 2527) | Class_Selector(const Class_Selector* ptr)
function specificity (line 2530) | virtual unsigned long specificity() const
function Id_Selector (line 2544) | Id_Selector(ParserState pstate, std::string n)
function Id_Selector (line 2547) | Id_Selector(const Id_Selector* ptr)
function specificity (line 2550) | virtual unsigned long specificity() const
function Attribute_Selector (line 2568) | Attribute_Selector(ParserState pstate, std::string n, std::string m, Str...
function Attribute_Selector (line 2571) | Attribute_Selector(const Attribute_Selector* ptr)
function hash (line 2577) | virtual size_t hash()
function specificity (line 2586) | virtual unsigned long specificity() const
function is_pseudo_class_element (line 2605) | inline bool is_pseudo_class_element(const std::string& name)
function Pseudo_Selector (line 2617) | Pseudo_Selector(ParserState pstate, std::string n, String_Obj expr = 0)
function Pseudo_Selector (line 2620) | Pseudo_Selector(const Pseudo_Selector* ptr)
function is_pseudo_element (line 2632) | virtual bool is_pseudo_element() const
function hash (line 2637) | virtual size_t hash()
function specificity (line 2645) | virtual unsigned long specificity() const
function Wrapped_Selector (line 2666) | Wrapped_Selector(ParserState pstate, std::string n, Selector_List_Obj sel)
function Wrapped_Selector (line 2669) | Wrapped_Selector(const Wrapped_Selector* ptr)
function adjust_after_pushing (line 2699) | void adjust_after_pushing(Simple_Selector_Obj s)
function Compound_Selector (line 2705) | Compound_Selector(ParserState pstate, size_t s = 0)
function Compound_Selector (line 2711) | Compound_Selector(const Compound_Selector* ptr)
function contains_placeholder (line 2717) | bool contains_placeholder() {
function is_universal (line 2726) | bool is_universal() const
function Simple_Selector_Ptr (line 2736) | Simple_Selector_Ptr base() const {
function hash (line 2746) | virtual size_t hash()
function specificity (line 2754) | virtual unsigned long specificity() const
function has_placeholder (line 2762) | virtual bool has_placeholder()
function is_empty_reference (line 2771) | bool is_empty_reference()
function ComplexSelectorSet (line 2784) | ComplexSelectorSet& sources() { return sources_; }
function clearSources (line 2785) | void clearSources() { sources_.clear(); }
type Combinator (line 2801) | enum Combinator { ANCESTOR_OF, PARENT_OF, PRECEDES, ADJACENT_TO, REFEREN...
function contains_placeholder (line 2808) | bool contains_placeholder() {
function Complex_Selector (line 2813) | Complex_Selector(ParserState pstate,
function Complex_Selector (line 2823) | Complex_Selector(const Complex_Selector* ptr)
function Complex_Selector_Obj (line 2832) | Complex_Selector_Obj skip_empty_reference()
function is_empty_ancestor (line 2846) | bool is_empty_ancestor() const
function Complex_Selector_Obj (line 2861) | Complex_Selector_Obj innermost() { return last(); }
function hash (line 2872) | virtual size_t hash()
function specificity (line 2882) | virtual unsigned long specificity() const
function set_media_block (line 2889) | virtual void set_media_block(Media_Block_Ptr mb) {
function has_placeholder (line 2894) | virtual bool has_placeholder() {
function ComplexSelectorSet (line 2905) | const ComplexSelectorSet sources()
function addSources (line 2928) | void addSources(ComplexSelectorSet& sources) {
function clearSources (line 2941) | void clearSources() {
class Selector_List (line 2962) | class Selector_List : public Selector, public Vectorized<Complex_Selecto...
method Selector_List (line 2968) | Selector_List(ParserState pstate, size_t s = 0)
method Selector_List (line 2974) | Selector_List(const Selector_List* ptr)
method type (line 2980) | std::string type() const { return "list"; }
method hash (line 2993) | virtual size_t hash()
method specificity (line 3001) | virtual unsigned long specificity() const
method set_media_block (line 3012) | virtual void set_media_block(Media_Block_Ptr mb) {
method has_placeholder (line 3018) | virtual bool has_placeholder() {
type cmp_complex_selector (line 3037) | struct cmp_complex_selector { inline bool operator() (const Complex_Se...
type cmp_compound_selector (line 3038) | struct cmp_compound_selector { inline bool operator() (const Compound_...
type cmp_simple_selector (line 3039) | struct cmp_simple_selector { inline bool operator() (const Simple_Sele...
FILE: libsass-build/ast_def_macros.hpp
class LocalOption (line 6) | class LocalOption {
method LocalOption (line 11) | LocalOption(T& var)
method LocalOption (line 16) | LocalOption(T& var, T orig)
method reset (line 22) | void reset()
FILE: libsass-build/ast_fwd_decl.cpp
type Sass (line 3) | namespace Sass {
FILE: libsass-build/ast_fwd_decl.hpp
type Sass (line 19) | namespace Sass {
class AST_Node (line 21) | class AST_Node
class Has_Block (line 25) | class Has_Block
class Simple_Selector (line 29) | class Simple_Selector
class PreValue (line 33) | class PreValue
class Thunk (line 36) | class Thunk
class Block (line 39) | class Block
class Expression (line 42) | class Expression
class Statement (line 45) | class Statement
class Value (line 48) | class Value
class Declaration (line 51) | class Declaration
class Ruleset (line 54) | class Ruleset
class Bubble (line 57) | class Bubble
class Trace (line 60) | class Trace
class Media_Block (line 64) | class Media_Block
class Supports_Block (line 67) | class Supports_Block
class Directive (line 70) | class Directive
class Keyframe_Rule (line 75) | class Keyframe_Rule
class At_Root_Block (line 78) | class At_Root_Block
class Assignment (line 81) | class Assignment
class Import (line 85) | class Import
class Import_Stub (line 88) | class Import_Stub
class Warning (line 91) | class Warning
class Error (line 95) | class Error
class Debug (line 98) | class Debug
class Comment (line 101) | class Comment
class If (line 105) | class If
class For (line 108) | class For
class Each (line 111) | class Each
class While (line 114) | class While
class Return (line 117) | class Return
class Content (line 120) | class Content
class Extension (line 123) | class Extension
class Definition (line 126) | class Definition
class List (line 130) | class List
class Map (line 133) | class Map
class Function (line 136) | class Function
class Mixin_Call (line 140) | class Mixin_Call
class Binary_Expression (line 143) | class Binary_Expression
class Unary_Expression (line 146) | class Unary_Expression
class Function_Call (line 149) | class Function_Call
class Function_Call_Schema (line 152) | class Function_Call_Schema
class Custom_Warning (line 155) | class Custom_Warning
class Custom_Error (line 158) | class Custom_Error
class Variable (line 162) | class Variable
class Number (line 165) | class Number
class Color (line 168) | class Color
class Boolean (line 171) | class Boolean
class String (line 174) | class String
class String_Schema (line 178) | class String_Schema
class String_Constant (line 181) | class String_Constant
class String_Quoted (line 184) | class String_Quoted
class Media_Query (line 188) | class Media_Query
class Media_Query_Expression (line 191) | class Media_Query_Expression
class Supports_Condition (line 194) | class Supports_Condition
class Supports_Operator (line 197) | class Supports_Operator
class Supports_Negation (line 200) | class Supports_Negation
class Supports_Declaration (line 203) | class Supports_Declaration
class Supports_Interpolation (line 206) | class Supports_Interpolation
class Null (line 211) | class Null
class At_Root_Query (line 215) | class At_Root_Query
class Parent_Selector (line 218) | class Parent_Selector
class Parameter (line 221) | class Parameter
class Parameters (line 224) | class Parameters
class Argument (line 227) | class Argument
class Arguments (line 230) | class Arguments
class Selector (line 233) | class Selector
class Selector_Schema (line 238) | class Selector_Schema
class Placeholder_Selector (line 241) | class Placeholder_Selector
class Element_Selector (line 244) | class Element_Selector
class Class_Selector (line 247) | class Class_Selector
class Id_Selector (line 250) | class Id_Selector
class Attribute_Selector (line 253) | class Attribute_Selector
class Pseudo_Selector (line 257) | class Pseudo_Selector
class Wrapped_Selector (line 260) | class Wrapped_Selector
class Compound_Selector (line 263) | class Compound_Selector
class Complex_Selector (line 266) | class Complex_Selector
class Selector_List (line 269) | class Selector_List
class Context (line 275) | class Context
class Expand (line 276) | class Expand
class Eval (line 277) | class Eval
type HashNodes (line 365) | struct HashNodes {
type OrderNodes (line 371) | struct OrderNodes {
type CompareNodes (line 377) | struct CompareNodes {
FILE: libsass-build/b64/cencode.h
type base64_encodestep (line 11) | typedef enum
type base64_encodestate (line 16) | typedef struct
FILE: libsass-build/b64/encode.h
function namespace (line 13) | namespace base64
FILE: libsass-build/backtrace.cpp
type Sass (line 3) | namespace Sass {
function traces_to_string (line 5) | const std::string traces_to_string(Backtraces traces, std::string inde...
FILE: libsass-build/backtrace.hpp
type Sass (line 9) | namespace Sass {
type Backtrace (line 11) | struct Backtrace {
method Backtrace (line 16) | Backtrace(ParserState pstate, std::string c = "")
FILE: libsass-build/base64vlq.cpp
type Sass (line 4) | namespace Sass {
FILE: libsass-build/base64vlq.hpp
type Sass (line 6) | namespace Sass {
class Base64VLQ (line 8) | class Base64VLQ {
FILE: libsass-build/bind.cpp
type Sass (line 11) | namespace Sass {
function bind (line 13) | void bind(std::string type, std::string name, Parameters_Obj ps, Argum...
FILE: libsass-build/bind.hpp
type Sass (line 8) | namespace Sass {
FILE: libsass-build/c99func.c
function c99_vsnprintf (line 30) | static int c99_vsnprintf(char* str, size_t size, const char* format, va_...
function snprintf (line 42) | int snprintf(char* str, size_t size, const char* format, ...)
FILE: libsass-build/cencode.c
function base64_init_encodestate (line 10) | void base64_init_encodestate(base64_encodestate* state_in)
function base64_encode_value (line 17) | char base64_encode_value(char value_in)
function base64_encode_block (line 24) | int base64_encode_block(const char* plaintext_in, int length_in, char* c...
function base64_encode_blockend (line 86) | int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
FILE: libsass-build/check_nesting.cpp
type Sass (line 6) | namespace Sass {
function error (line 14) | void error(AST_Node_Ptr node, Backtraces traces, std::string msg) {
function Statement_Ptr (line 19) | Statement_Ptr CheckNesting::visit_children(Statement_Ptr parent)
function Statement_Ptr (line 101) | Statement_Ptr CheckNesting::operator()(Block_Ptr b)
function Statement_Ptr (line 106) | Statement_Ptr CheckNesting::operator()(Definition_Ptr n)
function Statement_Ptr (line 124) | Statement_Ptr CheckNesting::operator()(If_Ptr i)
function Statement_Ptr (line 135) | Statement_Ptr CheckNesting::fallback_impl(Statement_Ptr s)
FILE: libsass-build/check_nesting.hpp
type Sass (line 7) | namespace Sass {
class CheckNesting (line 9) | class CheckNesting : public Operation_CRTP<Statement_Ptr, CheckNesting> {
method Statement_Ptr (line 29) | Statement_Ptr fallback(U x) {
FILE: libsass-build/color_maps.cpp
type Sass (line 5) | namespace Sass {
type ColorNames (line 7) | namespace ColorNames
type Colors (line 160) | namespace Colors {
function Color_Ptr_Const (line 608) | Color_Ptr_Const name_to_color(const char* key)
function Color_Ptr_Const (line 613) | Color_Ptr_Const name_to_color(const std::string& key)
FILE: libsass-build/color_maps.hpp
type Sass (line 8) | namespace Sass {
type map_cmp_str (line 10) | struct map_cmp_str
type ColorNames (line 18) | namespace ColorNames
type Colors (line 171) | namespace Colors {
FILE: libsass-build/constants.cpp
type Sass (line 4) | namespace Sass {
type Constants (line 5) | namespace Constants {
FILE: libsass-build/constants.hpp
type Sass (line 4) | namespace Sass {
type Constants (line 5) | namespace Constants {
FILE: libsass-build/context.cpp
type Sass (line 33) | namespace Sass {
function sort_importers (line 38) | inline bool sort_importers (const Sass_Importer_Entry& i, const Sass_I...
function safe_input (line 41) | static std::string safe_input(const char* in_path)
function safe_output (line 49) | static std::string safe_output(const char* out_path, const std::string...
type Sass_Context (line 62) | struct Sass_Context
function Include (line 346) | Include Context::load_import(const Importer& imp, ParserState pstate)
function Block_Obj (line 555) | Block_Obj File_Context::parse()
function Block_Obj (line 601) | Block_Obj Data_Context::parse()
function Block_Obj (line 645) | Block_Obj Context::compile()
function register_function (line 733) | void register_function(Context& ctx, Signature sig, Native_Function f,...
function register_function (line 740) | void register_function(Context& ctx, Signature sig, Native_Function f,...
function register_overload_stub (line 749) | void register_overload_stub(Context& ctx, std::string name, Env* env)
function register_built_in_functions (line 762) | void register_built_in_functions(Context& ctx, Env* env)
function register_c_functions (line 866) | void register_c_functions(Context& ctx, Env* env, Sass_Function_List d...
function register_c_function (line 873) | void register_c_function(Context& ctx, Env* env, Sass_Function_Entry d...
FILE: libsass-build/context.hpp
type Sass_Function (line 24) | struct Sass_Function
type Sass (line 26) | namespace Sass {
class Context (line 28) | class Context {
method call_headers (line 31) | bool call_headers(const std::string& load_path, const char* ctx_path...
method call_importers (line 33) | bool call_importers(const std::string& load_path, const char* ctx_pa...
type Sass_Options (line 41) | struct Sass_Options
type Sass_Compiler (line 60) | struct Sass_Compiler
type Sass_Context (line 93) | struct Sass_Context
method Sass_Output_Style (line 104) | Sass_Output_Style output_style() { return c_options.output_style; }
class File_Context (line 125) | class File_Context : public Context {
method File_Context (line 127) | File_Context(struct Sass_File_Context& ctx)
class Data_Context (line 134) | class Data_Context : public Context {
method Data_Context (line 138) | Data_Context(struct Sass_Data_Context& ctx)
FILE: libsass-build/cssize.cpp
type Sass (line 9) | namespace Sass {
function Statement_Ptr (line 18) | Statement_Ptr Cssize::parent()
function Block_Ptr (line 23) | Block_Ptr Cssize::operator()(Block_Ptr b)
function Statement_Ptr (line 33) | Statement_Ptr Cssize::operator()(Trace_Ptr t)
function Statement_Ptr (line 41) | Statement_Ptr Cssize::operator()(Declaration_Ptr d)
function Statement_Ptr (line 81) | Statement_Ptr Cssize::operator()(Directive_Ptr r)
function Statement_Ptr (line 131) | Statement_Ptr Cssize::operator()(Keyframe_Rule_Ptr r)
function Statement_Ptr (line 143) | Statement_Ptr Cssize::operator()(Ruleset_Ptr r)
function Statement_Ptr (line 210) | Statement_Ptr Cssize::operator()(Null_Ptr m)
function Statement_Ptr (line 215) | Statement_Ptr Cssize::operator()(Media_Block_Ptr m)
function Statement_Ptr (line 236) | Statement_Ptr Cssize::operator()(Supports_Block_Ptr m)
function Statement_Ptr (line 257) | Statement_Ptr Cssize::operator()(At_Root_Block_Ptr m)
function Statement_Ptr (line 285) | Statement_Ptr Cssize::bubble(Directive_Ptr m)
function Statement_Ptr (line 306) | Statement_Ptr Cssize::bubble(At_Root_Block_Ptr m)
function Statement_Ptr (line 327) | Statement_Ptr Cssize::bubble(Supports_Block_Ptr m)
function Statement_Ptr (line 352) | Statement_Ptr Cssize::bubble(Media_Block_Ptr m)
function Block_Ptr (line 381) | Block_Ptr Cssize::flatten(Block_Ptr b)
function Block_Ptr (line 422) | Block_Ptr Cssize::debubble(Block_Ptr children, Statement_Ptr parent)
function Statement_Ptr (line 512) | Statement_Ptr Cssize::fallback_impl(AST_Node_Ptr n)
function List_Ptr (line 532) | List_Ptr Cssize::merge_media_queries(Media_Block_Ptr m1, Media_Block_P...
function Media_Query_Ptr (line 554) | Media_Query_Ptr Cssize::merge_media_query(Media_Query_Ptr mq1, Media_Q...
FILE: libsass-build/cssize.hpp
type Sass (line 9) | namespace Sass {
type Backtrace (line 11) | struct Backtrace
class Cssize (line 13) | class Cssize : public Operation_CRTP<Statement_Ptr, Cssize> {
method Statement_Ptr (line 70) | Statement_Ptr fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/debug.hpp
type dbg_lvl_t (line 10) | enum dbg_lvl_t : uint32_t {
FILE: libsass-build/debugger.hpp
function debug_ast (line 13) | inline void debug_ast(const AST_Node* node, std::string ind = "", Env* e...
function debug_sources_set (line 17) | inline void debug_sources_set(ComplexSelectorSet& set, std::string ind =...
function str_replace (line 27) | inline std::string str_replace(std::string str, const std::string& oldSt...
function prettyprint (line 38) | inline std::string prettyprint(const std::string& str) {
function longToHex (line 45) | inline std::string longToHex(long long t) {
function pstate_source_position (line 51) | inline std::string pstate_source_position(AST_Node_Ptr node)
function debug_ast (line 67) | inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
function debug_node (line 721) | inline void debug_node(Node* node, std::string ind = "")
function debug_node (line 776) | inline void debug_node(const Node* node, std::string ind = "")
function debug_subset_map (line 781) | inline void debug_subset_map(Sass::Subset_Map& map, std::string ind = "")
function debug_subset_entries (line 791) | inline void debug_subset_entries(SubSetMapPairs* entries, std::string in...
FILE: libsass-build/emitter.cpp
type Sass (line 8) | namespace Sass {
type Sass_Output_Options (line 10) | struct Sass_Output_Options
function Sass_Output_Style (line 34) | Sass_Output_Style Emitter::output_style(void) const
function ParserState (line 56) | ParserState Emitter::remap(const ParserState& pstate)
FILE: libsass-build/emitter.hpp
type Sass (line 10) | namespace Sass {
class Context (line 11) | class Context
class Emitter (line 13) | class Emitter {
type Sass_Output_Options (line 16) | struct Sass_Output_Options
method SourceMap (line 23) | const SourceMap smap(void) { return wbuf.smap; }
method OutputBuffer (line 24) | const OutputBuffer output(void) { return wbuf; }
type Sass_Output_Options (line 35) | struct Sass_Output_Options
FILE: libsass-build/environment.cpp
type Sass (line 5) | namespace Sass {
function EnvResult (line 56) | EnvResult
function T (line 65) | T& Environment<T>::get_local(const std::string& key)
function T (line 98) | T& Environment<T>::get_global(const std::string& key)
function EnvResult (line 197) | EnvResult
function T (line 211) | T& Environment<T>::operator[](const std::string& key)
class Environment<AST_Node_Obj> (line 243) | class Environment<AST_Node_Obj>
FILE: libsass-build/environment.hpp
type Sass (line 8) | namespace Sass {
class EnvResult (line 12) | class EnvResult {
method EnvResult (line 17) | EnvResult(EnvIter it, bool found)
class Environment (line 22) | class Environment {
FILE: libsass-build/error_handling.cpp
type Sass (line 9) | namespace Sass {
type Exception (line 11) | namespace Exception {
type Sass_OP (line 115) | enum Sass_OP
type Sass_OP (line 131) | enum Sass_OP
type Sass_OP (line 141) | enum Sass_OP
function warn (line 161) | void warn(std::string msg, ParserState pstate)
function warning (line 166) | void warning(std::string msg, ParserState pstate)
function warn (line 177) | void warn(std::string msg, ParserState pstate, Backtrace* bt)
function deprecated_function (line 182) | void deprecated_function(std::string msg, ParserState pstate)
function deprecated (line 194) | void deprecated(std::string msg, std::string msg2, bool with_column, P...
function deprecated_bind (line 210) | void deprecated_bind(std::string msg, ParserState pstate)
function coreError (line 223) | void coreError(std::string msg, ParserState pstate)
function error (line 229) | void error(std::string msg, ParserState pstate, Backtraces& traces)
FILE: libsass-build/error_handling.hpp
type Sass (line 12) | namespace Sass {
type Backtrace (line 14) | struct Backtrace
type Exception (line 16) | namespace Exception {
class Base (line 23) | class Base : public std::runtime_error {
class InvalidSass (line 37) | class InvalidSass : public Base {
class InvalidParent (line 43) | class InvalidParent : public Base {
class MissingArgument (line 52) | class MissingArgument : public Base {
class InvalidArgumentType (line 62) | class InvalidArgumentType : public Base {
class InvalidVarKwdType (line 73) | class InvalidVarKwdType : public Base {
class InvalidSyntax (line 82) | class InvalidSyntax : public Base {
class NestingLimitError (line 88) | class NestingLimitError : public Base {
class DuplicateKeyError (line 94) | class DuplicateKeyError : public Base {
class TypeMismatch (line 104) | class TypeMismatch : public Base {
class InvalidValue (line 114) | class InvalidValue : public Base {
class StackError (line 123) | class StackError : public Base {
class OperationError (line 133) | class OperationError : public std::runtime_error {
method OperationError (line 137) | OperationError(std::string msg = def_op_msg)
class ZeroDivisionError (line 146) | class ZeroDivisionError : public OperationError {
class IncompatibleUnits (line 156) | class IncompatibleUnits : public OperationError {
class UndefinedOperation (line 166) | class UndefinedOperation : public OperationError {
type Sass_OP (line 172) | enum Sass_OP
class InvalidNullOperation (line 177) | class InvalidNullOperation : public UndefinedOperation {
type Sass_OP (line 179) | enum Sass_OP
class AlphaChannelsNotEqual (line 183) | class AlphaChannelsNotEqual : public OperationError {
type Sass_OP (line 189) | enum Sass_OP
class SassValueError (line 194) | class SassValueError : public Base {
FILE: libsass-build/eval.cpp
type Sass (line 30) | namespace Sass {
function Env (line 45) | Env* Eval::environment()
function Selector_List_Obj (line 50) | Selector_List_Obj Eval::selector()
function Expression_Ptr (line 55) | Expression_Ptr Eval::operator()(Block_Ptr b)
function Expression_Ptr (line 65) | Expression_Ptr Eval::operator()(Assignment_Ptr a)
function Expression_Ptr (line 126) | Expression_Ptr Eval::operator()(If_Ptr i)
function Expression_Ptr (line 145) | Expression_Ptr Eval::operator()(For_Ptr f)
function Expression_Ptr (line 201) | Expression_Ptr Eval::operator()(Each_Ptr e)
function Expression_Ptr (line 286) | Expression_Ptr Eval::operator()(While_Ptr w)
function Expression_Ptr (line 305) | Expression_Ptr Eval::operator()(Return_Ptr r)
function Expression_Ptr (line 310) | Expression_Ptr Eval::operator()(Warning_Ptr w)
function Expression_Ptr (line 358) | Expression_Ptr Eval::operator()(Error_Ptr e)
function Expression_Ptr (line 402) | Expression_Ptr Eval::operator()(Debug_Ptr d)
function Expression_Ptr (line 452) | Expression_Ptr Eval::operator()(List_Ptr l)
function Expression_Ptr (line 493) | Expression_Ptr Eval::operator()(Map_Ptr m)
function Expression_Ptr (line 525) | Expression_Ptr Eval::operator()(Binary_Expression_Ptr b_in)
function Expression_Ptr (line 869) | Expression_Ptr Eval::operator()(Unary_Expression_Ptr u)
function Expression_Ptr (line 917) | Expression_Ptr Eval::operator()(Function_Call_Ptr c)
function Expression_Ptr (line 1084) | Expression_Ptr Eval::operator()(Function_Call_Schema_Ptr s)
function Expression_Ptr (line 1094) | Expression_Ptr Eval::operator()(Variable_Ptr v)
function Expression_Ptr (line 1112) | Expression_Ptr Eval::operator()(Color_Ptr c)
function Expression_Ptr (line 1117) | Expression_Ptr Eval::operator()(Number_Ptr n)
function Expression_Ptr (line 1122) | Expression_Ptr Eval::operator()(Boolean_Ptr b)
function Expression_Ptr (line 1214) | Expression_Ptr Eval::operator()(String_Schema_Ptr s)
function Expression_Ptr (line 1258) | Expression_Ptr Eval::operator()(String_Constant_Ptr s)
function Expression_Ptr (line 1263) | Expression_Ptr Eval::operator()(String_Quoted_Ptr s)
function Expression_Ptr (line 1272) | Expression_Ptr Eval::operator()(Supports_Operator_Ptr c)
function Expression_Ptr (line 1284) | Expression_Ptr Eval::operator()(Supports_Negation_Ptr c)
function Expression_Ptr (line 1293) | Expression_Ptr Eval::operator()(Supports_Declaration_Ptr c)
function Expression_Ptr (line 1304) | Expression_Ptr Eval::operator()(Supports_Interpolation_Ptr c)
function Expression_Ptr (line 1313) | Expression_Ptr Eval::operator()(At_Root_Query_Ptr e)
function Media_Query_Ptr (line 1326) | Media_Query_Ptr Eval::operator()(Media_Query_Ptr q)
function Expression_Ptr (line 1342) | Expression_Ptr Eval::operator()(Media_Query_Expression_Ptr e)
function Expression_Ptr (line 1366) | Expression_Ptr Eval::operator()(Null_Ptr n)
function Expression_Ptr (line 1371) | Expression_Ptr Eval::operator()(Argument_Ptr a)
function Expression_Ptr (line 1400) | Expression_Ptr Eval::operator()(Arguments_Ptr a)
function Expression_Ptr (line 1450) | Expression_Ptr Eval::operator()(Comment_Ptr c)
function Expression_Ptr (line 1455) | inline Expression_Ptr Eval::fallback_impl(AST_Node_Ptr n)
function Expression_Ptr (line 1462) | Expression_Ptr cval_to_astnode(union Sass_Value* v, Backtraces traces,...
function Selector_List_Ptr (line 1515) | Selector_List_Ptr Eval::operator()(Selector_List_Ptr s)
function Selector_List_Ptr (line 1548) | Selector_List_Ptr Eval::operator()(Complex_Selector_Ptr s)
function Compound_Selector_Ptr (line 1566) | Compound_Selector_Ptr Eval::operator()(Compound_Selector_Ptr s)
function Selector_List_Ptr (line 1577) | Selector_List_Ptr Eval::operator()(Selector_Schema_Ptr s)
function Expression_Ptr (line 1612) | Expression_Ptr Eval::operator()(Parent_Selector_Ptr p)
function Simple_Selector_Ptr (line 1624) | Simple_Selector_Ptr Eval::operator()(Simple_Selector_Ptr s)
function hasNotSelector (line 1633) | bool hasNotSelector(AST_Node_Obj obj) {
function Wrapped_Selector_Ptr (line 1640) | Wrapped_Selector_Ptr Eval::operator()(Wrapped_Selector_Ptr s)
FILE: libsass-build/eval.hpp
type Sass (line 10) | namespace Sass {
class Expand (line 12) | class Expand
class Context (line 13) | class Context
class Eval (line 15) | class Eval : public Operation_CRTP<Expression_Ptr, Eval> {
method Expression_Ptr (line 92) | Expression_Ptr fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/expand.cpp
type Sass (line 14) | namespace Sass {
function Env (line 42) | Env* Expand::environment()
function Selector_List_Obj (line 49) | Selector_List_Obj Expand::selector()
function Block_Ptr (line 57) | Block_Ptr Expand::operator()(Block_Ptr b)
function Statement_Ptr (line 80) | Statement_Ptr Expand::operator()(Ruleset_Ptr r)
function Statement_Ptr (line 160) | Statement_Ptr Expand::operator()(Supports_Block_Ptr f)
function Statement_Ptr (line 170) | Statement_Ptr Expand::operator()(Media_Block_Ptr m)
function Statement_Ptr (line 197) | Statement_Ptr Expand::operator()(At_Root_Block_Ptr a)
function Statement_Ptr (line 218) | Statement_Ptr Expand::operator()(Directive_Ptr a)
function Statement_Ptr (line 238) | Statement_Ptr Expand::operator()(Declaration_Ptr d)
function Statement_Ptr (line 266) | Statement_Ptr Expand::operator()(Assignment_Ptr a)
function Statement_Ptr (line 327) | Statement_Ptr Expand::operator()(Import_Ptr imp)
function Statement_Ptr (line 342) | Statement_Ptr Expand::operator()(Import_Stub_Ptr i)
function Statement_Ptr (line 372) | Statement_Ptr Expand::operator()(Warning_Ptr w)
function Statement_Ptr (line 379) | Statement_Ptr Expand::operator()(Error_Ptr e)
function Statement_Ptr (line 386) | Statement_Ptr Expand::operator()(Debug_Ptr d)
function Statement_Ptr (line 393) | Statement_Ptr Expand::operator()(Comment_Ptr c)
function Statement_Ptr (line 407) | Statement_Ptr Expand::operator()(If_Ptr i)
function Statement_Ptr (line 427) | Statement_Ptr Expand::operator()(For_Ptr f)
function Statement_Ptr (line 482) | Statement_Ptr Expand::operator()(Each_Ptr e)
function Statement_Ptr (line 566) | Statement_Ptr Expand::operator()(While_Ptr w)
function Statement_Ptr (line 583) | Statement_Ptr Expand::operator()(Return_Ptr r)
function Statement (line 641) | Statement* Expand::operator()(Extension_Ptr e)
function Statement_Ptr (line 672) | Statement_Ptr Expand::operator()(Definition_Ptr d)
function Statement_Ptr (line 697) | Statement_Ptr Expand::operator()(Mixin_Call_Ptr c)
function Statement_Ptr (line 772) | Statement_Ptr Expand::operator()(Content_Ptr c)
function Statement_Ptr (line 797) | inline Statement_Ptr Expand::fallback_impl(AST_Node_Ptr n)
FILE: libsass-build/expand.hpp
type Sass (line 11) | namespace Sass {
class Listize (line 13) | class Listize
class Context (line 14) | class Context
class Eval (line 15) | class Eval
type Backtrace (line 16) | struct Backtrace
class Expand (line 18) | class Expand : public Operation_CRTP<Statement_Ptr, Expand> {
method Statement_Ptr (line 75) | Statement_Ptr fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/extend.cpp
type Sass (line 62) | namespace Sass {
function printSimpleSelector (line 96) | static void printSimpleSelector(Simple_Selector* pSimpleSelector, cons...
function printCompoundSelector (line 114) | static void printCompoundSelector(Compound_Selector_Ptr pCompoundSelec...
function printComplexSelector (line 166) | static void printComplexSelector(Complex_Selector_Ptr pComplexSelector...
function printSelsNewSeqPairCollection (line 183) | static void printSelsNewSeqPairCollection(SubSetMapLookups& collection...
function printSourcesSet (line 210) | static void printSourcesSet(ComplexSelectorSet& sources, const char* m...
function parentSuperselector (line 283) | static bool parentSuperselector(Complex_Selector_Ptr pOne, Complex_Sel...
function nodeToComplexSelectorDeque (line 302) | void nodeToComplexSelectorDeque(const Node& node, ComplexSelectorDeque...
function Node (line 309) | Node complexSelectorDequeToNode(const ComplexSelectorDeque& deque) {
class LcsCollectionComparator (line 320) | class LcsCollectionComparator {
method LcsCollectionComparator (line 322) | LcsCollectionComparator() {}
function lcs_backtrace (line 365) | void lcs_backtrace(const LCSTable& c, ComplexSelectorDeque& x, Complex...
function lcs_table (line 400) | void lcs_table(const ComplexSelectorDeque& x, const ComplexSelectorDeq...
function lcs (line 439) | void lcs(ComplexSelectorDeque& x, ComplexSelectorDeque& y, const LcsCo...
function Node (line 519) | Node Extend::trim(Node& seqses, bool isReplace) {
function parentSuperselector (line 643) | static bool parentSuperselector(const Node& one, const Node& two) {
class ParentSuperselectorChunker (line 660) | class ParentSuperselectorChunker {
method ParentSuperselectorChunker (line 662) | ParentSuperselectorChunker(Node& lcs) : mLcs(lcs) {}
class SubweaveEmptyChunker (line 672) | class SubweaveEmptyChunker {
function Node (line 714) | static Node chunks(Node& seq1, Node& seq2, const ChunkerType& chunker) {
function Node (line 764) | static Node groupSelectors(Node& seq) {
function getAndRemoveInitialOps (line 785) | static void getAndRemoveInitialOps(Node& seq, Node& ops) {
function getAndRemoveFinalOps (line 796) | static void getAndRemoveFinalOps(Node& seq, Node& ops) {
function Node (line 824) | static Node mergeInitialOps(Node& seq1, Node& seq2) {
function Node (line 915) | static Node mergeFinalOps(Node& seq1, Node& seq2, Node& res) {
function Node (line 1176) | Node subweave(Node& one, Node& two) {
function Node (line 1437) | Node Extend::weave(Node& path) {
class GroupByToAFunctor (line 1513) | class GroupByToAFunctor {
method KeyType (line 1515) | KeyType operator()(SubSetMapPair& extPair) const {
function Node (line 1520) | Node Extend::extendCompoundSelector(Compound_Selector_Ptr pSelector, C...
function Node (line 1744) | Node Extend::extendComplexSelector(Complex_Selector_Ptr selector, Comp...
function Selector_List_Ptr (line 1871) | Selector_List_Ptr Extend::extendSelectorList(Selector_List_Obj pSelect...
function shouldExtendBlock (line 2006) | bool shouldExtendBlock(Block_Obj b) {
FILE: libsass-build/extend.hpp
type Sass (line 14) | namespace Sass {
class Extend (line 18) | class Extend : public Operation_CRTP<void, Extend> {
method fallback_impl (line 23) | void fallback_impl(AST_Node_Ptr n) { }
method Selector_List_Ptr (line 61) | Selector_List_Ptr extendSelectorList(Selector_List_Obj pSelectorList...
method Selector_List_Ptr (line 66) | Selector_List_Ptr extendSelectorList(Selector_List_Obj pSelectorList...
method fallback (line 81) | void fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/file.cpp
function wstring_to_string (line 31) | inline static std::string wstring_to_string(const std::wstring& wstr)
function wstring_to_string (line 37) | inline static std::string wstring_to_string(const std::wstring &wstr)
type Sass (line 47) | namespace Sass {
type File (line 48) | namespace File {
function get_cwd (line 53) | std::string get_cwd()
function file_exists (line 76) | bool file_exists(const std::string& path)
function is_absolute_path (line 99) | bool is_absolute_path(const std::string& path)
function find_last_folder_separator (line 115) | inline size_t find_last_folder_separator(const std::string& path, si...
function dir_name (line 137) | std::string dir_name(const std::string& path)
function base_name (line 145) | std::string base_name(const std::string& path)
function make_canonical_path (line 154) | std::string make_canonical_path (std::string path)
function join_paths (line 194) | std::string join_paths(std::string l, std::string r)
function path_for_console (line 228) | std::string path_for_console(const std::string& rel_path, const std:...
function rel2abs (line 241) | std::string rel2abs(const std::string& path, const std::string& base...
function abs2rel (line 248) | std::string abs2rel(const std::string& path, const std::string& base...
function resolve_includes (line 326) | std::vector<Include> resolve_includes(const std::string& root, const...
function find_files (line 357) | std::vector<std::string> find_files(const std::string& file, const s...
function find_files (line 367) | std::vector<std::string> find_files(const std::string& file, struct ...
function find_file (line 383) | std::string find_file(const std::string& file, const std::vector<std...
function find_include (line 391) | std::string find_include(const std::string& file, const std::vector<...
type stat (line 433) | struct stat
function split_path_list (line 465) | std::vector<std::string> split_path_list(const char* str)
FILE: libsass-build/file.hpp
type Sass (line 10) | namespace Sass {
type File (line 12) | namespace File {
type Sass_Compiler (line 52) | struct Sass_Compiler
class Importer (line 70) | class Importer {
method Importer (line 80) | Importer(std::string imp_path, std::string ctx_path)
class Include (line 88) | class Include : public Importer {
method Include (line 93) | Include(const Importer& imp, std::string abs_path)
class Resource (line 99) | class Resource {
method Resource (line 106) | Resource(char* contents, char* srcmap)
class StyleSheet (line 112) | class StyleSheet : public Resource {
method StyleSheet (line 117) | StyleSheet(const Resource& res, Block_Obj root)
type File (line 122) | namespace File {
type Sass_Compiler (line 52) | struct Sass_Compiler
FILE: libsass-build/functions.cpp
type Sass (line 55) | namespace Sass {
function Definition_Ptr (line 59) | Definition_Ptr make_native_function(Signature sig, Native_Function fun...
function Definition_Ptr (line 74) | Definition_Ptr make_c_function(Sass_Function_Entry c_func, Context& ctx)
function function_name (line 97) | std::string function_name(Signature sig)
type Functions (line 103) | namespace Functions {
function handle_utf8_error (line 105) | inline void handle_utf8_error (const ParserState& pstate, Backtraces...
function T (line 126) | T* get_arg(const std::string& argname, Env& env, Signature sig, Pars...
function Map_Ptr (line 142) | Map_Ptr get_arg_m(const std::string& argname, Env& env, Signature si...
function get_arg_r (line 156) | double get_arg_r(const std::string& argname, Env& env, Signature sig...
function Number_Ptr (line 172) | Number_Ptr get_arg_n(const std::string& argname, Env& env, Signature...
function get_arg_v (line 181) | double get_arg_v(const std::string& argname, Env& env, Signature sig...
function get_arg_val (line 198) | double get_arg_val(const std::string& argname, Env& env, Signature s...
function color_num (line 207) | double color_num(const std::string& argname, Env& env, Signature sig...
function alpha_num (line 220) | inline double alpha_num(const std::string& argname, Env& env, Signat...
function Selector_List_Obj (line 237) | Selector_List_Obj get_arg_sel(const std::string& argname, Env& env, ...
function Compound_Selector_Obj (line 253) | Compound_Selector_Obj get_arg_sel(const std::string& argname, Env& e...
function GetSeed (line 272) | uint64_t GetSeed()
function GetSeed (line 286) | uint64_t GetSeed()
function special_number (line 312) | inline bool special_number(String_Constant_Ptr s) {
function BUILT_IN (line 324) | BUILT_IN(rgb)
function BUILT_IN (line 349) | BUILT_IN(rgba_4)
function BUILT_IN (line 378) | BUILT_IN(rgba_2)
function BUILT_IN (line 413) | BUILT_IN(red)
function BUILT_IN (line 417) | BUILT_IN(green)
function BUILT_IN (line 421) | BUILT_IN(blue)
function Color (line 424) | Color* colormix(Context& ctx, ParserState& pstate, Color* color1, Co...
function BUILT_IN (line 441) | BUILT_IN(mix)
type HSL (line 455) | struct HSL { double h; double s; double l; }
function HSL (line 456) | HSL rgb_to_hsl(double r, double g, double b)
function h_to_rgb (line 491) | double h_to_rgb(double m1, double m2, double h) {
function Color_Ptr (line 500) | Color_Ptr hsla_impl(double h, double s, double l, double a, Context&...
function BUILT_IN (line 533) | BUILT_IN(hsl)
function BUILT_IN (line 559) | BUILT_IN(hsla)
function BUILT_IN (line 588) | BUILT_IN(hue)
function BUILT_IN (line 598) | BUILT_IN(saturation)
function BUILT_IN (line 608) | BUILT_IN(lightness)
function BUILT_IN (line 618) | BUILT_IN(adjust_hue)
function BUILT_IN (line 634) | BUILT_IN(lighten)
function BUILT_IN (line 656) | BUILT_IN(darken)
function BUILT_IN (line 679) | BUILT_IN(saturate)
function BUILT_IN (line 711) | BUILT_IN(desaturate)
function BUILT_IN (line 738) | BUILT_IN(grayscale)
function BUILT_IN (line 759) | BUILT_IN(complement)
function BUILT_IN (line 774) | BUILT_IN(invert)
function BUILT_IN (line 798) | BUILT_IN(alpha)
function BUILT_IN (line 816) | BUILT_IN(opacify)
function BUILT_IN (line 831) | BUILT_IN(transparentize)
function BUILT_IN (line 849) | BUILT_IN(adjust_color)
function BUILT_IN (line 904) | BUILT_IN(scale_color)
function BUILT_IN (line 960) | BUILT_IN(change_color)
function cap_channel (line 1008) | static double cap_channel(double c) {
function BUILT_IN (line 1015) | BUILT_IN(ie_hex_str)
function BUILT_IN (line 1042) | BUILT_IN(sass_unquote)
function BUILT_IN (line 1068) | BUILT_IN(sass_quote)
function BUILT_IN (line 1085) | BUILT_IN(str_length)
function BUILT_IN (line 1101) | BUILT_IN(str_insert)
function BUILT_IN (line 1146) | BUILT_IN(str_index)
function BUILT_IN (line 1171) | BUILT_IN(str_slice)
function BUILT_IN (line 1223) | BUILT_IN(to_upper_case)
function BUILT_IN (line 1244) | BUILT_IN(to_lower_case)
function BUILT_IN (line 1269) | BUILT_IN(percentage)
function BUILT_IN (line 1277) | BUILT_IN(round)
function BUILT_IN (line 1286) | BUILT_IN(ceil)
function BUILT_IN (line 1295) | BUILT_IN(floor)
function BUILT_IN (line 1304) | BUILT_IN(abs)
function BUILT_IN (line 1313) | BUILT_IN(min)
function BUILT_IN (line 1331) | BUILT_IN(max)
function BUILT_IN (line 1349) | BUILT_IN(random)
function BUILT_IN (line 1390) | BUILT_IN(length)
function BUILT_IN (line 1417) | BUILT_IN(nth)
function BUILT_IN (line 1458) | BUILT_IN(set_nth)
function BUILT_IN (line 1482) | BUILT_IN(index)
function BUILT_IN (line 1501) | BUILT_IN(join)
function BUILT_IN (line 1545) | BUILT_IN(append)
function BUILT_IN (line 1584) | BUILT_IN(zip)
function BUILT_IN (line 1620) | BUILT_IN(list_separator)
function BUILT_IN (line 1637) | BUILT_IN(map_get)
function BUILT_IN (line 1655) | BUILT_IN(map_has_key)
function BUILT_IN (line 1663) | BUILT_IN(map_keys)
function BUILT_IN (line 1674) | BUILT_IN(map_values)
function BUILT_IN (line 1685) | BUILT_IN(map_merge)
function BUILT_IN (line 1699) | BUILT_IN(map_remove)
function BUILT_IN (line 1716) | BUILT_IN(keywords)
function BUILT_IN (line 1737) | BUILT_IN(type_of)
function BUILT_IN (line 1744) | BUILT_IN(unit)
function BUILT_IN (line 1752) | BUILT_IN(unitless)
function BUILT_IN (line 1760) | BUILT_IN(comparable)
function BUILT_IN (line 1775) | BUILT_IN(variable_exists)
function BUILT_IN (line 1788) | BUILT_IN(global_variable_exists)
function BUILT_IN (line 1801) | BUILT_IN(function_exists)
function BUILT_IN (line 1819) | BUILT_IN(mixin_exists)
function BUILT_IN (line 1832) | BUILT_IN(feature_exists)
function BUILT_IN (line 1845) | BUILT_IN(call)
function BUILT_IN (line 1900) | BUILT_IN(sass_not)
function BUILT_IN (line 1908) | BUILT_IN(sass_if)
function BUILT_IN (line 1927) | BUILT_IN(inspect)
function BUILT_IN (line 1951) | BUILT_IN(selector_nest)
function BUILT_IN (line 2004) | BUILT_IN(selector_append)
function BUILT_IN (line 2098) | BUILT_IN(selector_unify)
function BUILT_IN (line 2109) | BUILT_IN(simple_selectors)
function BUILT_IN (line 2126) | BUILT_IN(selector_extend)
function BUILT_IN (line 2143) | BUILT_IN(selector_replace)
function BUILT_IN (line 2159) | BUILT_IN(selector_parse)
function BUILT_IN (line 2168) | BUILT_IN(is_superselector)
function BUILT_IN (line 2177) | BUILT_IN(unique_id)
function BUILT_IN (line 2187) | BUILT_IN(is_bracketed)
function BUILT_IN (line 2195) | BUILT_IN(content_exists)
function BUILT_IN (line 2204) | BUILT_IN(get_function)
FILE: libsass-build/functions.hpp
type Sass (line 13) | namespace Sass {
type Backtrace (line 14) | struct Backtrace
type Functions (line 23) | namespace Functions {
FILE: libsass-build/include/sass/base.h
type Sass_Output_Style (line 57) | enum Sass_Output_Style {
FILE: libsass-build/include/sass/context.h
type Sass_Compiler (line 16) | struct Sass_Compiler
type Sass_Options (line 19) | struct Sass_Options
type Sass_Context (line 20) | struct Sass_Context
type Sass_File_Context (line 21) | struct Sass_File_Context
type Sass_Data_Context (line 22) | struct Sass_Data_Context
type Sass_Compiler_State (line 25) | enum Sass_Compiler_State {
type Sass_File_Context (line 38) | struct Sass_File_Context
type Sass_Data_Context (line 39) | struct Sass_Data_Context
type Sass_File_Context (line 42) | struct Sass_File_Context
type Sass_Data_Context (line 43) | struct Sass_Data_Context
type Sass_Compiler (line 47) | struct Sass_Compiler
type Sass_Compiler (line 48) | struct Sass_Compiler
type Sass_Compiler (line 52) | struct Sass_Compiler
type Sass_Options (line 53) | struct Sass_Options
type Sass_File_Context (line 56) | struct Sass_File_Context
type Sass_Data_Context (line 57) | struct Sass_Data_Context
type Sass_File_Context (line 60) | struct Sass_File_Context
type Sass_Data_Context (line 61) | struct Sass_Data_Context
type Sass_Context (line 64) | struct Sass_Context
type Sass_File_Context (line 65) | struct Sass_File_Context
type Sass_Data_Context (line 66) | struct Sass_Data_Context
type Sass_File_Context (line 67) | struct Sass_File_Context
type Sass_Options (line 67) | struct Sass_Options
type Sass_Data_Context (line 68) | struct Sass_Data_Context
type Sass_Options (line 68) | struct Sass_Options
type Sass_Options (line 72) | struct Sass_Options
type Sass_Options (line 73) | struct Sass_Options
type Sass_Options (line 74) | struct Sass_Options
type Sass_Options (line 75) | struct Sass_Options
type Sass_Options (line 76) | struct Sass_Options
type Sass_Options (line 77) | struct Sass_Options
type Sass_Options (line 78) | struct Sass_Options
type Sass_Options (line 79) | struct Sass_Options
type Sass_Options (line 80) | struct Sass_Options
type Sass_Options (line 81) | struct Sass_Options
type Sass_Options (line 82) | struct Sass_Options
type Sass_Options (line 83) | struct Sass_Options
type Sass_Options (line 84) | struct Sass_Options
type Sass_Options (line 85) | struct Sass_Options
type Sass_Options (line 86) | struct Sass_Options
type Sass_Options (line 87) | struct Sass_Options
type Sass_Options (line 88) | struct Sass_Options
type Sass_Options (line 91) | struct Sass_Options
type Sass_Options (line 92) | struct Sass_Options
type Sass_Output_Style (line 92) | enum Sass_Output_Style
type Sass_Options (line 93) | struct Sass_Options
type Sass_Options (line 94) | struct Sass_Options
type Sass_Options (line 95) | struct Sass_Options
type Sass_Options (line 96) | struct Sass_Options
type Sass_Options (line 97) | struct Sass_Options
type Sass_Options (line 98) | struct Sass_Options
type Sass_Options (line 99) | struct Sass_Options
type Sass_Options (line 100) | struct Sass_Options
type Sass_Options (line 101) | struct Sass_Options
type Sass_Options (line 102) | struct Sass_Options
type Sass_Options (line 103) | struct Sass_Options
type Sass_Options (line 104) | struct Sass_Options
type Sass_Options (line 105) | struct Sass_Options
type Sass_Options (line 106) | struct Sass_Options
type Sass_Options (line 107) | struct Sass_Options
type Sass_Options (line 108) | struct Sass_Options
type Sass_Options (line 109) | struct Sass_Options
type Sass_Context (line 113) | struct Sass_Context
type Sass_Context (line 114) | struct Sass_Context
type Sass_Context (line 115) | struct Sass_Context
type Sass_Context (line 116) | struct Sass_Context
type Sass_Context (line 117) | struct Sass_Context
type Sass_Context (line 118) | struct Sass_Context
type Sass_Context (line 119) | struct Sass_Context
type Sass_Context (line 120) | struct Sass_Context
type Sass_Context (line 121) | struct Sass_Context
type Sass_Context (line 122) | struct Sass_Context
type Sass_Context (line 123) | struct Sass_Context
type Sass_Options (line 126) | struct Sass_Options
type Sass_Options (line 127) | struct Sass_Options
type Sass_Context (line 130) | struct Sass_Context
type Sass_Context (line 133) | struct Sass_Context
type Sass_Context (line 134) | struct Sass_Context
type Sass_Context (line 135) | struct Sass_Context
type Sass_Context (line 136) | struct Sass_Context
type Sass_Context (line 137) | struct Sass_Context
type Sass_Context (line 138) | struct Sass_Context
type Sass_Context (line 139) | struct Sass_Context
type Sass_Compiler (line 142) | struct Sass_Compiler
type Sass_Compiler (line 143) | struct Sass_Compiler
type Sass_Compiler (line 144) | struct Sass_Compiler
type Sass_Compiler (line 145) | struct Sass_Compiler
type Sass_Compiler (line 146) | struct Sass_Compiler
type Sass_Compiler (line 147) | struct Sass_Compiler
type Sass_Compiler (line 148) | struct Sass_Compiler
type Sass_Compiler (line 149) | struct Sass_Compiler
type Sass_Compiler (line 150) | struct Sass_Compiler
type Sass_Options (line 153) | struct Sass_Options
type Sass_Options (line 154) | struct Sass_Options
type Sass_Options (line 158) | struct Sass_Options
type Sass_Options (line 159) | struct Sass_Options
type Sass_Compiler (line 163) | struct Sass_Compiler
type Sass_Compiler (line 164) | struct Sass_Compiler
FILE: libsass-build/include/sass/functions.h
type Sass_Env (line 14) | struct Sass_Env
type Sass_Callee (line 15) | struct Sass_Callee
type Sass_Import (line 16) | struct Sass_Import
type Sass_Options (line 17) | struct Sass_Options
type Sass_Compiler (line 18) | struct Sass_Compiler
type Sass_Importer (line 19) | struct Sass_Importer
type Sass_Function (line 20) | struct Sass_Function
type Sass_Env (line 23) | struct Sass_Env
type Sass_Callee (line 25) | struct Sass_Callee
type Sass_Import (line 27) | struct Sass_Import
type Sass_Import (line 28) | struct Sass_Import
type Sass_Importer (line 30) | struct Sass_Importer
type Sass_Importer (line 31) | struct Sass_Importer
type Sass_Import_List (line 33) | typedef Sass_Import_List (*Sass_Importer_Fn)
type Sass_Function (line 37) | struct Sass_Function
type Sass_Function (line 38) | struct Sass_Function
type Sass_Compiler (line 41) | struct Sass_Compiler
type Sass_Callee_Type (line 44) | enum Sass_Callee_Type {
FILE: libsass-build/include/sass/values.h
type Sass_Tag (line 17) | enum Sass_Tag {
type Sass_Separator (line 30) | enum Sass_Separator {
type Sass_OP (line 39) | enum Sass_OP {
type Sass_OP (line 67) | enum Sass_OP
type Sass_Separator (line 118) | enum Sass_Separator
FILE: libsass-build/include/sass2scss.h
function namespace (line 44) | namespace Sass
FILE: libsass-build/inspect.cpp
type Sass (line 16) | namespace Sass {
function cap_channel (line 617) | static double cap_channel(double c) {
FILE: libsass-build/inspect.hpp
type Sass (line 8) | namespace Sass {
class Context (line 9) | class Context
class Inspect (line 11) | class Inspect : public Operation_CRTP<void, Inspect>, public Emitter {
FILE: libsass-build/json.cpp
function sb_init (line 73) | static void sb_init(SB *sb)
function sb_grow (line 88) | static void sb_grow(SB *sb, int need)
function sb_put (line 104) | static void sb_put(SB *sb, const char *bytes, int count)
function sb_puts (line 117) | static void sb_puts(SB *sb, const char *str)
function sb_free (line 129) | static void sb_free(SB *sb)
function utf8_validate_cz (line 165) | static int utf8_validate_cz(const char *s)
function utf8_validate (line 220) | static bool utf8_validate(const char *s)
function utf8_read_char (line 240) | static int utf8_read_char(const char *s, uint32_t *out)
function utf8_write_char (line 279) | static int utf8_write_char(uint32_t unicode, char *out)
function from_surrogate_pair (line 316) | static bool from_surrogate_pair(uint16_t uc, uint16_t lc, uint32_t *unic...
function to_surrogate_pair (line 331) | static void to_surrogate_pair(uint32_t unicode, uint16_t *uc, uint16_t *lc)
function JsonNode (line 374) | JsonNode *json_decode(const char *json)
function json_delete (line 432) | void json_delete(JsonNode *node)
function json_validate (line 458) | bool json_validate(const char *json)
function JsonNode (line 473) | JsonNode *json_find_element(JsonNode *array, int index)
function JsonNode (line 490) | JsonNode *json_find_member(JsonNode *object, const char *name)
function JsonNode (line 504) | JsonNode *json_first_child(const JsonNode *node)
function JsonNode (line 511) | static JsonNode *mknode(JsonTag tag)
function JsonNode (line 520) | JsonNode *json_mknull(void)
function JsonNode (line 525) | JsonNode *json_mkbool(bool b)
function JsonNode (line 532) | static JsonNode *mkstring(char *s)
function JsonNode (line 539) | JsonNode *json_mkstring(const char *s)
function JsonNode (line 544) | JsonNode *json_mknumber(double n)
function JsonNode (line 551) | JsonNode *json_mkarray(void)
function JsonNode (line 556) | JsonNode *json_mkobject(void)
function append_node (line 561) | static void append_node(JsonNode *parent, JsonNode *child)
function prepend_node (line 576) | static void prepend_node(JsonNode *parent, JsonNode *child)
function append_member (line 591) | static void append_member(JsonNode *object, char *key, JsonNode *value)
function json_append_element (line 599) | void json_append_element(JsonNode *array, JsonNode *element)
function json_prepend_element (line 609) | void json_prepend_element(JsonNode *array, JsonNode *element)
function json_append_member (line 617) | void json_append_member(JsonNode *object, const char *key, JsonNode *value)
function json_prepend_member (line 627) | void json_prepend_member(JsonNode *object, const char *key, JsonNode *va...
function json_remove_from_parent (line 638) | void json_remove_from_parent(JsonNode *node)
function parse_value (line 663) | static bool parse_value(const char **sp, JsonNode **out)
function parse_array (line 733) | static bool parse_array(const char **sp, JsonNode **out)
function parse_object (line 777) | static bool parse_object(const char **sp, JsonNode **out)
function parse_string (line 833) | bool parse_string(const char **sp, char **out)
function is_space (line 948) | bool is_space(const char *c) {
function is_digit (line 952) | bool is_digit(const char *c){
function parse_number (line 966) | bool parse_number(const char **sp, double *out)
function skip_space (line 1014) | static void skip_space(const char **sp)
function emit_value (line 1022) | static void emit_value(SB *out, const JsonNode *node)
function emit_value_indented (line 1049) | void emit_value_indented(SB *out, const JsonNode *node, const char *spac...
function emit_array (line 1076) | static void emit_array(SB *out, const JsonNode *array)
function emit_array_indented (line 1089) | static void emit_array_indented(SB *out, const JsonNode *array, const ch...
function emit_object (line 1113) | static void emit_object(SB *out, const JsonNode *object)
function emit_object_indented (line 1128) | static void emit_object_indented(SB *out, const JsonNode *object, const ...
function emit_string (line 1154) | void emit_string(SB *out, const char *str)
function emit_number (line 1280) | static void emit_number(SB *out, double num)
function tag_is_valid (line 1297) | static bool tag_is_valid(unsigned int tag)
function number_is_valid (line 1302) | static bool number_is_valid(const char *num)
function expect_literal (line 1307) | static bool expect_literal(const char **sp, const char *str)
function parse_hex16 (line 1323) | static bool parse_hex16(const char **sp, uint16_t *out)
function write_hex16 (line 1356) | static int write_hex16(char *out, uint16_t val)
function json_check (line 1368) | bool json_check(const JsonNode *node, char errmsg[256])
FILE: libsass-build/json.hpp
type JsonNode (line 39) | struct JsonNode
type JsonNode (line 41) | struct JsonNode
FILE: libsass-build/lexer.cpp
type Sass (line 9) | namespace Sass {
type Prelexer (line 12) | namespace Prelexer {
function is_alpha (line 34) | bool is_alpha(const char& chr)
function is_space (line 40) | bool is_space(const char& chr)
function is_digit (line 46) | bool is_digit(const char& chr)
function is_number (line 52) | bool is_number(const char& chr)
function is_xdigit (line 58) | bool is_xdigit(const char& chr)
function is_punct (line 66) | bool is_punct(const char& chr)
function is_alnum (line 72) | bool is_alnum(const char& chr)
function is_unicode (line 78) | bool is_unicode(const char& chr)
function is_nonascii (line 86) | bool is_nonascii(const char& chr)
function is_uri_character (line 98) | bool is_uri_character(const char& chr)
function is_escapable_character (line 107) | bool is_escapable_character(const char& chr)
function is_character (line 114) | bool is_character(const char& chr)
FILE: libsass-build/lexer.hpp
type Sass (line 6) | namespace Sass {
type Prelexer (line 7) | namespace Prelexer {
FILE: libsass-build/listize.cpp
type Sass (line 11) | namespace Sass {
function Expression_Ptr (line 16) | Expression_Ptr Listize::operator()(Selector_List_Ptr sel)
function Expression_Ptr (line 28) | Expression_Ptr Listize::operator()(Compound_Selector_Ptr sel)
function Expression_Ptr (line 38) | Expression_Ptr Listize::operator()(Complex_Selector_Ptr sel)
function Expression_Ptr (line 81) | Expression_Ptr Listize::fallback_impl(AST_Node_Ptr n)
FILE: libsass-build/listize.hpp
type Sass (line 12) | namespace Sass {
type Backtrace (line 14) | struct Backtrace
class Listize (line 16) | class Listize : public Operation_CRTP<Expression_Ptr, Listize> {
method Expression_Ptr (line 29) | Expression_Ptr fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/mapping.hpp
type Sass (line 6) | namespace Sass {
type Mapping (line 8) | struct Mapping {
method Mapping (line 12) | Mapping(const Position& original_position, const Position& generated...
FILE: libsass-build/memory/SharedPtr.cpp
type Sass (line 12) | namespace Sass {
function SharedPtr (line 96) | SharedPtr& SharedPtr::operator=(const SharedPtr& rhs) {
FILE: libsass-build/memory/SharedPtr.hpp
type Sass (line 8) | namespace Sass {
class SharedPtr (line 10) | class SharedPtr
method SharedPtr (line 96) | SharedPtr()
method SharedObj (line 111) | SharedObj* obj () const {
method SharedObj (line 114) | SharedObj* operator-> () const {
method isNull (line 117) | bool isNull () {
method isNull (line 120) | bool isNull () const {
method SharedObj (line 123) | SharedObj* detach() const {
class SharedObj (line 41) | class SharedObj {
method SharedObj (line 60) | SharedObj* trace(std::string file, size_t line) {
method getDbgFile (line 68) | std::string getDbgFile() {
method getDbgLine (line 71) | size_t getDbgLine() {
method setDbg (line 74) | void setDbg(bool dbg) {
method setTaint (line 78) | static void setTaint(bool val) {
method getRefCount (line 82) | long getRefCount() {
class SharedPtr (line 88) | class SharedPtr {
method SharedPtr (line 96) | SharedPtr()
method SharedObj (line 111) | SharedObj* obj () const {
method SharedObj (line 114) | SharedObj* operator-> () const {
method isNull (line 117) | bool isNull () {
method isNull (line 120) | bool isNull () const {
method SharedObj (line 123) | SharedObj* detach() const {
class SharedImpl (line 136) | class SharedImpl : private SharedPtr {
method SharedImpl (line 138) | SharedImpl()
method SharedImpl (line 140) | SharedImpl(T* node)
method SharedImpl (line 143) | SharedImpl(SharedImpl<U> obj)
method SharedImpl (line 145) | SharedImpl(T&& node)
method SharedImpl (line 147) | SharedImpl(const T& node)
method SharedImpl (line 150) | SharedImpl(const SharedImpl<T>& impl)
method SharedImpl (line 153) | SharedImpl(SharedImpl<T>&& impl)
method T (line 180) | T& operator* () const {
method T (line 183) | T* operator-> () const {
method T (line 186) | T* ptr () const {
method T (line 189) | T* detach() const {
method isNull (line 193) | bool isNull() const {
FILE: libsass-build/node.cpp
type Sass (line 8) | namespace Sass {
function Node (line 11) | Node Node::createCombinator(const Complex_Selector::Combinator& combin...
function Node (line 17) | Node Node::createSelector(const Complex_Selector& pSelector) {
function Node (line 30) | Node Node::createCollection() {
function Node (line 36) | Node Node::createCollection(const NodeDeque& values) {
function Node (line 42) | Node Node::createNil() {
function Node (line 53) | Node Node::klone() const {
function Node (line 175) | Node complexSelectorToNode(Complex_Selector_Ptr pToConvert) {
function Complex_Selector_Ptr (line 223) | Complex_Selector_Ptr nodeToComplexSelector(const Node& toConvert) {
function Node (line 284) | Node Node::naiveTrim(Node& seqses) {
FILE: libsass-build/node.hpp
type Sass (line 10) | namespace Sass {
class Context (line 15) | class Context
class Node (line 33) | class Node
type TYPE (line 39) | enum TYPE {
method TYPE (line 46) | TYPE type() const { return mType; }
method isCombinator (line 47) | bool isCombinator() const { return mType == COMBINATOR; }
method isSelector (line 48) | bool isSelector() const { return mType == SELECTOR; }
method isCollection (line 49) | bool isCollection() const { return mType == COLLECTION; }
method isNil (line 50) | bool isNil() const { return mType == NIL; }
method combinator (line 53) | Complex_Selector::Combinator combinator() const { return mCombinator; }
method Complex_Selector_Obj (line 55) | Complex_Selector_Obj selector() { return mpSelector; }
method Complex_Selector_Obj (line 56) | Complex_Selector_Obj selector() const { return mpSelector; }
method NodeDequePtr (line 58) | NodeDequePtr collection() { return mpCollection; }
method NodeDequePtr (line 59) | const NodeDequePtr collection() const { return mpCollection; }
class Node (line 37) | class Node {
type TYPE (line 39) | enum TYPE {
method TYPE (line 46) | TYPE type() const { return mType; }
method isCombinator (line 47) | bool isCombinator() const { return mType == COMBINATOR; }
method isSelector (line 48) | bool isSelector() const { return mType == SELECTOR; }
method isCollection (line 49) | bool isCollection() const { return mType == COLLECTION; }
method isNil (line 50) | bool isNil() const { return mType == NIL; }
method combinator (line 53) | Complex_Selector::Combinator combinator() const { return mCombinator; }
method Complex_Selector_Obj (line 55) | Complex_Selector_Obj selector() { return mpSelector; }
method Complex_Selector_Obj (line 56) | Complex_Selector_Obj selector() const { return mpSelector; }
method NodeDequePtr (line 58) | NodeDequePtr collection() { return mpCollection; }
method NodeDequePtr (line 59) | const NodeDequePtr collection() const { return mpCollection; }
FILE: libsass-build/operation.hpp
type Sass (line 6) | namespace Sass {
class Operation (line 9) | class Operation {
method T (line 86) | T fallback(U x) { return T(); }
class Operation_CRTP (line 90) | class Operation_CRTP : public Operation<T> {
method D (line 92) | D& impl() { return static_cast<D&>(*this); }
method T (line 94) | T operator()(AST_Node_Ptr x) { return static_cast<D*>(...
method T (line 96) | T operator()(Block_Ptr x) { return static_cast<D*>(...
method T (line 97) | T operator()(Ruleset_Ptr x) { return static_cast<D*>(...
method T (line 98) | T operator()(Bubble_Ptr x) { return static_cast<D*>(...
method T (line 99) | T operator()(Trace_Ptr x) { return static_cast<D*>(...
method T (line 100) | T operator()(Supports_Block_Ptr x) { return static_cast<D*>(...
method T (line 101) | T operator()(Media_Block_Ptr x) { return static_cast<D*>(...
method T (line 102) | T operator()(At_Root_Block_Ptr x) { return static_cast<D*>(...
method T (line 103) | T operator()(Directive_Ptr x) { return static_cast<D*>(...
method T (line 104) | T operator()(Keyframe_Rule_Ptr x) { return static_cast<D*>(...
method T (line 105) | T operator()(Declaration_Ptr x) { return static_cast<D*>(...
method T (line 106) | T operator()(Assignment_Ptr x) { return static_cast<D*>(...
method T (line 107) | T operator()(Import_Ptr x) { return static_cast<D*>(...
method T (line 108) | T operator()(Import_Stub_Ptr x) { return static_cast<D*>(...
method T (line 109) | T operator()(Warning_Ptr x) { return static_cast<D*>(...
method T (line 110) | T operator()(Error_Ptr x) { return static_cast<D*>(...
method T (line 111) | T operator()(Debug_Ptr x) { return static_cast<D*>(...
method T (line 112) | T operator()(Comment_Ptr x) { return static_cast<D*>(...
method T (line 113) | T operator()(If_Ptr x) { return static_cast<D*>(...
method T (line 114) | T operator()(For_Ptr x) { return static_cast<D*>(...
method T (line 115) | T operator()(Each_Ptr x) { return static_cast<D*>(...
method T (line 116) | T operator()(While_Ptr x) { return static_cast<D*>(...
method T (line 117) | T operator()(Return_Ptr x) { return static_cast<D*>(...
method T (line 118) | T operator()(Content_Ptr x) { return static_cast<D*>(...
method T (line 119) | T operator()(Extension_Ptr x) { return static_cast<D*>(...
method T (line 120) | T operator()(Definition_Ptr x) { return static_cast<D*>(...
method T (line 121) | T operator()(Mixin_Call_Ptr x) { return static_cast<D*>(...
method T (line 123) | T operator()(List_Ptr x) { return static_cast<D*>(...
method T (line 124) | T operator()(Map_Ptr x) { return static_cast<D*>(...
method T (line 125) | T operator()(Function_Ptr x) { return static_cast<D*>(...
method T (line 126) | T operator()(Binary_Expression_Ptr x) { return static_cast<D*>(...
method T (line 127) | T operator()(Unary_Expression_Ptr x) { return static_cast<D*>(...
method T (line 128) | T operator()(Function_Call_Ptr x) { return static_cast<D*>(...
method T (line 129) | T operator()(Function_Call_Schema_Ptr x) { return static_cast<D*>(...
method T (line 130) | T operator()(Custom_Warning_Ptr x) { return static_cast<D*>(...
method T (line 131) | T operator()(Custom_Error_Ptr x) { return static_cast<D*>(...
method T (line 132) | T operator()(Variable_Ptr x) { return static_cast<D*>(...
method T (line 133) | T operator()(Number_Ptr x) { return static_cast<D*>(...
method T (line 134) | T operator()(Color_Ptr x) { return static_cast<D*>(...
method T (line 135) | T operator()(Boolean_Ptr x) { return static_cast<D*>(...
method T (line 136) | T operator()(String_Schema_Ptr x) { return static_cast<D*>(...
method T (line 137) | T operator()(String_Constant_Ptr x) { return static_cast<D*>(...
method T (line 138) | T operator()(String_Quoted_Ptr x) { return static_cast<D*>(...
method T (line 139) | T operator()(Supports_Condition_Ptr x) { return static_cast<D*>(...
method T (line 140) | T operator()(Supports_Operator_Ptr x) { return static_cast<D*>(...
method T (line 141) | T operator()(Supports_Negation_Ptr x) { return static_cast<D*>(...
method T (line 142) | T operator()(Supports_Declaration_Ptr x) { return static_cast<D*>(...
method T (line 143) | T operator()(Supports_Interpolation_Ptr x) { return static_cast<D*>(...
method T (line 144) | T operator()(Media_Query_Ptr x) { return static_cast<D*>(...
method T (line 145) | T operator()(Media_Query_Expression_Ptr x) { return static_cast<D*>(...
method T (line 146) | T operator()(At_Root_Query_Ptr x) { return static_cast<D*>(...
method T (line 147) | T operator()(Null_Ptr x) { return static_cast<D*>(...
method T (line 148) | T operator()(Parent_Selector_Ptr x) { return static_cast<D*>(...
method T (line 150) | T operator()(Parameter_Ptr x) { return static_cast<D*>(...
method T (line 151) | T operator()(Parameters_Ptr x) { return static_cast<D*>(...
method T (line 152) | T operator()(Argument_Ptr x) { return static_cast<D*>(...
method T (line 153) | T operator()(Arguments_Ptr x) { return static_cast<D*>(...
method T (line 155) | T operator()(Selector_Schema_Ptr x) { return static_cast<D*>(...
method T (line 156) | T operator()(Placeholder_Selector_Ptr x) { return static_cast<D*>(...
method T (line 157) | T operator()(Element_Selector_Ptr x) { return static_cast<D*>(...
method T (line 158) | T operator()(Class_Selector_Ptr x) { return static_cast<D*>(...
method T (line 159) | T operator()(Id_Selector_Ptr x) { return static_cast<D*>(...
method T (line 160) | T operator()(Attribute_Selector_Ptr x) { return static_cast<D*>(...
method T (line 161) | T operator()(Pseudo_Selector_Ptr x) { return static_cast<D*>(...
method T (line 162) | T operator()(Wrapped_Selector_Ptr x) { return static_cast<D*>(...
method T (line 163) | T operator()(Compound_Selector_Ptr x){ return static_cast<D*>(this)-...
method T (line 164) | T operator()(Complex_Selector_Ptr x) { return static_cast<D*>(t...
method T (line 165) | T operator()(Selector_List_Ptr x) { return static_cast<D*>(this)->fa...
method T (line 168) | T fallback(U x) { return T(); }
FILE: libsass-build/operators.cpp
type Sass (line 4) | namespace Sass {
type Operators (line 6) | namespace Operators {
function add (line 8) | inline double add(double x, double y) { return x + y; }
function sub (line 9) | inline double sub(double x, double y) { return x - y; }
function mul (line 10) | inline double mul(double x, double y) { return x * y; }
function div (line 11) | inline double div(double x, double y) { return x / y; }
function mod (line 13) | inline double mod(double x, double y) { // x/0 checked by caller
function eq (line 30) | bool eq(Expression_Obj lhs, Expression_Obj rhs)
function cmp (line 39) | bool cmp(Expression_Obj lhs, Expression_Obj rhs, const Sass_OP op)
function lt (line 51) | bool lt(Expression_Obj lhs, Expression_Obj rhs) { return cmp(lhs, rh...
function neq (line 52) | bool neq(Expression_Obj lhs, Expression_Obj rhs) { return eq(lhs, rh...
function gt (line 53) | bool gt(Expression_Obj lhs, Expression_Obj rhs) { return !cmp(lhs, r...
function lte (line 54) | bool lte(Expression_Obj lhs, Expression_Obj rhs) { return cmp(lhs, r...
function gte (line 55) | bool gte(Expression_Obj lhs, Expression_Obj rhs) { return !cmp(lhs, ...
function op_color_deprecation (line 58) | void op_color_deprecation(enum Sass_OP op, std::string lsh, std::str...
function Value_Ptr (line 74) | Value_Ptr op_strings(Sass::Operand operand, Value& lhs, Value& rhs, ...
function Value_Ptr (line 124) | Value_Ptr op_colors(enum Sass_OP op, const Color& lhs, const Color& ...
function Value_Ptr (line 145) | Value_Ptr op_numbers(enum Sass_OP op, const Number& lhs, const Numbe...
function Value_Ptr (line 215) | Value_Ptr op_number_color(enum Sass_OP op, const Number& lhs, const ...
function Value_Ptr (line 246) | Value_Ptr op_color_number(enum Sass_OP op, const Color& lhs, const N...
FILE: libsass-build/operators.hpp
type Sass (line 7) | namespace Sass {
type Operators (line 9) | namespace Operators {
type Sass_Inspect_Options (line 20) | struct Sass_Inspect_Options
type Sass_OP (line 21) | enum Sass_OP
type Sass_Inspect_Options (line 21) | struct Sass_Inspect_Options
type Sass_OP (line 22) | enum Sass_OP
type Sass_Inspect_Options (line 22) | struct Sass_Inspect_Options
type Sass_OP (line 23) | enum Sass_OP
type Sass_Inspect_Options (line 23) | struct Sass_Inspect_Options
type Sass_OP (line 24) | enum Sass_OP
type Sass_Inspect_Options (line 24) | struct Sass_Inspect_Options
FILE: libsass-build/output.cpp
type Sass (line 5) | namespace Sass {
function OutputBuffer (line 45) | OutputBuffer Output::get_buffer(void)
FILE: libsass-build/output.hpp
type Sass (line 11) | namespace Sass {
class Context (line 12) | class Context
function ends_with (line 15) | inline bool ends_with(std::string const & value, std::string const & e...
class Output (line 21) | class Output : public Inspect {
FILE: libsass-build/parser.cpp
type Sass (line 29) | namespace Sass {
function Parser (line 33) | Parser Parser::from_c_str(const char* beg, Context& ctx, Backtraces tr...
function Parser (line 47) | Parser Parser::from_c_str(const char* beg, const char* end, Context& c...
function Selector_List_Obj (line 69) | Selector_List_Obj Parser::parse_selector(const char* beg, Context& ctx...
function Parser (line 83) | Parser Parser::from_token(Token t, Context& ctx, Backtraces traces, Pa...
function Block_Obj (line 96) | Block_Obj Parser::parse()
function Block_Obj (line 140) | Block_Obj Parser::parse_css_block(bool is_root)
function Block_Obj (line 176) | Block_Obj Parser::parse_block(bool is_root)
function Import_Obj (line 328) | Import_Obj Parser::parse_import()
function Definition_Obj (line 385) | Definition_Obj Parser::parse_definition(Definition::Type which_type)
function Parameters_Obj (line 401) | Parameters_Obj Parser::parse_parameters()
function Parameter_Obj (line 419) | Parameter_Obj Parser::parse_parameter()
function Arguments_Obj (line 441) | Arguments_Obj Parser::parse_arguments()
function Argument_Obj (line 459) | Argument_Obj Parser::parse_argument()
function Assignment_Obj (line 494) | Assignment_Obj Parser::parse_assignment()
function Ruleset_Obj (line 519) | Ruleset_Obj Parser::parse_ruleset(Lookahead lookahead)
function Selector_Schema_Obj (line 552) | Selector_Schema_Obj Parser::parse_selector_schema(const char* end_of_s...
function Mixin_Call_Obj (line 641) | Mixin_Call_Obj Parser::parse_include_directive()
function Selector_List_Obj (line 662) | Selector_List_Obj Parser::parse_selector_list(bool chroot)
function Complex_Selector_Obj (line 718) | Complex_Selector_Obj Parser::parse_complex_selector(bool chroot)
function Compound_Selector_Obj (line 799) | Compound_Selector_Obj Parser::parse_compound_selector()
function Simple_Selector_Obj (line 865) | Simple_Selector_Obj Parser::parse_simple_selector()
function Wrapped_Selector_Obj (line 901) | Wrapped_Selector_Obj Parser::parse_negated_selector()
function Simple_Selector_Obj (line 916) | Simple_Selector_Obj Parser::parse_pseudo_selector() {
function Attribute_Selector_Obj (line 982) | Attribute_Selector_Obj Parser::parse_attribute_selector()
function Declaration_Obj (line 1035) | Declaration_Obj Parser::parse_declaration() {
function Expression_Obj (line 1106) | Expression_Obj Parser::parse_map()
function Expression_Obj (line 1150) | Expression_Obj Parser::parse_bracket_list()
function Expression_Obj (line 1197) | Expression_Obj Parser::parse_list(bool delayed)
function Expression_Obj (line 1204) | Expression_Obj Parser::parse_comma_list(bool delayed)
function Expression_Obj (line 1244) | Expression_Obj Parser::parse_space_list()
function Expression_Obj (line 1269) | Expression_Obj Parser::parse_disjunction()
function Expression_Obj (line 1291) | Expression_Obj Parser::parse_conjunction()
function Expression_Obj (line 1314) | Expression_Obj Parser::parse_relation()
function Expression_Obj (line 1367) | Expression_Obj Parser::parse_expression()
function Expression_Obj (line 1411) | Expression_Obj Parser::parse_operators()
function Expression_Obj (line 1444) | Expression_Obj Parser::parse_factor()
function number_has_zero (line 1527) | bool number_has_zero(const std::string& parsed)
function Number_Ptr (line 1536) | Number_Ptr Parser::lexed_number(const ParserState& pstate, const std::...
function Number_Ptr (line 1548) | Number_Ptr Parser::lexed_percentage(const ParserState& pstate, const s...
function Number_Ptr (line 1560) | Number_Ptr Parser::lexed_dimension(const ParserState& pstate, const st...
function Value_Ptr (line 1581) | Value_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std...
function Value_Ptr (line 1644) | Value_Ptr Parser::color_or_string(const std::string& lexed) const
function Expression_Obj (line 1658) | Expression_Obj Parser::parse_value()
function String_Obj (line 1737) | String_Obj Parser::parse_interpolated_chunk(Token chunk, bool constant...
function String_Schema_Obj (line 1789) | String_Schema_Obj Parser::parse_css_variable_value(bool top_level)
function String_Schema_Obj (line 1805) | String_Schema_Obj Parser::parse_css_variable_value_token(bool top_level)
function Value_Obj (line 1856) | Value_Obj Parser::parse_static_value()
function String_Obj (line 1870) | String_Obj Parser::parse_string()
function String_Obj (line 1875) | String_Obj Parser::parse_ie_property()
function String_Obj (line 1919) | String_Obj Parser::parse_ie_keyword_arg()
function String_Schema_Obj (line 1940) | String_Schema_Obj Parser::parse_value_schema(const char* stop)
function String_Obj (line 2049) | String_Obj Parser::parse_identifier_schema()
function Function_Call_Obj (line 2101) | Function_Call_Obj Parser::parse_calc_function()
function String_Obj (line 2122) | String_Obj Parser::parse_url_function_string()
function String_Obj (line 2154) | String_Obj Parser::parse_url_function_argument()
function Function_Call_Obj (line 2181) | Function_Call_Obj Parser::parse_function_call()
function Function_Call_Schema_Obj (line 2194) | Function_Call_Schema_Obj Parser::parse_function_call_schema()
function Content_Obj (line 2203) | Content_Obj Parser::parse_content_directive()
function If_Obj (line 2208) | If_Obj Parser::parse_if_directive(bool else_if)
function For_Obj (line 2230) | For_Obj Parser::parse_for_directive()
function Token (line 2250) | Token Parser::lex_variable()
function Token (line 2265) | Token Parser::lex_identifier()
function Each_Obj (line 2275) | Each_Obj Parser::parse_each_directive()
function While_Obj (line 2295) | While_Obj Parser::parse_while_directive()
function Media_Block_Obj (line 2317) | Media_Block_Obj Parser::parse_media_block()
function List_Obj (line 2332) | List_Obj Parser::parse_media_queries()
function Media_Query_Obj (line 2343) | Media_Query_Obj Parser::parse_media_query()
function Media_Query_Expression_Obj (line 2369) | Media_Query_Expression_Obj Parser::parse_media_expression()
function Supports_Block_Obj (line 2395) | Supports_Block_Obj Parser::parse_supports_directive()
function Supports_Condition_Obj (line 2412) | Supports_Condition_Obj Parser::parse_supports_condition()
function Supports_Condition_Obj (line 2422) | Supports_Condition_Obj Parser::parse_supports_negation()
function Supports_Condition_Obj (line 2429) | Supports_Condition_Obj Parser::parse_supports_operator()
function Supports_Condition_Obj (line 2448) | Supports_Condition_Obj Parser::parse_supports_interpolation()
function Supports_Condition_Obj (line 2460) | Supports_Condition_Obj Parser::parse_supports_declaration()
function Supports_Condition_Obj (line 2478) | Supports_Condition_Obj Parser::parse_supports_condition_in_parens()
function At_Root_Block_Obj (line 2497) | At_Root_Block_Obj Parser::parse_at_root_block()
function At_Root_Query_Obj (line 2522) | At_Root_Query_Obj Parser::parse_at_root_query()
function Directive_Obj (line 2548) | Directive_Obj Parser::parse_special_directive()
function Directive_Obj (line 2580) | Directive_Obj Parser::parse_prefixed_directive()
function Directive_Obj (line 2610) | Directive_Obj Parser::parse_directive()
function Expression_Obj (line 2622) | Expression_Obj Parser::lex_interpolation()
function Expression_Obj (line 2630) | Expression_Obj Parser::lex_interp_uri()
function Expression_Obj (line 2636) | Expression_Obj Parser::lex_interp_string()
function Expression_Obj (line 2644) | Expression_Obj Parser::lex_almost_any_value_chars()
function Expression_Obj (line 2696) | Expression_Obj Parser::lex_almost_any_value_token()
function String_Schema_Obj (line 2711) | String_Schema_Obj Parser::parse_almost_any_value()
function Warning_Obj (line 2736) | Warning_Obj Parser::parse_warning()
function Error_Obj (line 2748) | Error_Obj Parser::parse_error()
function Debug_Obj (line 2760) | Debug_Obj Parser::parse_debug()
function Return_Obj (line 2772) | Return_Obj Parser::parse_return_directive()
function Lookahead (line 2780) | Lookahead Parser::lookahead_for_selector(const char* start)
function Lookahead (line 2835) | Lookahead Parser::lookahead_for_include(const char* start)
function Lookahead (line 2854) | Lookahead Parser::lookahead_for_value(const char* start)
function check_bom_chars (line 2979) | size_t check_bom_chars(const char* src, const char *end, const unsigne...
function Expression_Obj (line 2990) | Expression_Obj Parser::fold_operands(Expression_Obj base, std::vector<...
function Expression_Obj (line 2998) | Expression_Obj Parser::fold_operands(Expression_Obj base, std::vector<...
FILE: libsass-build/parser.hpp
type Lookahead (line 22) | struct Lookahead {
type Sass (line 31) | namespace Sass {
class Parser (line 33) | class Parser : public ParserState {
type Scope (line 36) | enum Scope { Root, Mixin, Function, Media, Control, Properties, Rule...
method Parser (line 54) | Parser(Context& ctx, const ParserState& pstate, Backtraces traces)
method Expression_Obj (line 355) | Expression_Obj lex_interp()
method Number_Ptr (line 387) | Number_Ptr lexed_number(const std::string& parsed) { return lexed_nu...
method Number_Ptr (line 388) | Number_Ptr lexed_dimension(const std::string& parsed) { return lexed...
method Number_Ptr (line 389) | Number_Ptr lexed_percentage(const std::string& parsed) { return lexe...
method Value_Ptr (line 390) | Value_Ptr lexed_hex_color(const std::string& parsed) { return lexed_...
FILE: libsass-build/paths.hpp
function vector_to_string (line 10) | std::string vector_to_string(std::vector<T> v)
type Sass (line 31) | namespace Sass {
function paths (line 35) | std::vector<std::vector<T> > paths(std::vector<std::vector<T> > strata...
FILE: libsass-build/plugins.cpp
type Sass (line 15) | namespace Sass {
function compatibility (line 34) | inline bool compatibility(const char* their_version)
type dirent (line 167) | struct dirent
FILE: libsass-build/plugins.hpp
type Sass (line 28) | namespace Sass {
class Plugins (line 31) | class Plugins {
method get_headers (line 44) | const std::vector<Sass_Importer_Entry> get_headers(void) { return he...
method get_importers (line 45) | const std::vector<Sass_Importer_Entry> get_importers(void) { return ...
method get_functions (line 46) | const std::vector<Sass_Function_Entry> get_functions(void) { return ...
FILE: libsass-build/position.cpp
type Sass (line 4) | namespace Sass {
function Offset (line 28) | Offset Offset::init(const char* beg, const char* end)
function Offset (line 40) | Offset Offset::add(const char* begin, const char* end)
function Offset (line 72) | Offset Offset::inc(const char* begin, const char* end) const
function Offset (line 94) | Offset Offset::operator+ (const Offset &off) const
function Offset (line 99) | Offset Offset::operator- (const Offset &off) const
function Position (line 126) | Position Position::add(const char* begin, const char* end)
function Position (line 132) | Position Position::inc(const char* begin, const char* end) const
function Position (line 154) | const Position Position::operator+ (const Offset &off) const
function Offset (line 159) | const Offset Position::operator- (const Offset &off) const
FILE: libsass-build/position.hpp
type Sass (line 8) | namespace Sass {
class Offset (line 11) | class Offset {
method Offset (line 37) | Offset off() { return *this; }
class Position (line 45) | class Position : public Offset {
class Token (line 72) | class Token {
method Token (line 78) | Token()
method Token (line 80) | Token(const char* b, const char* e)
method Token (line 82) | Token(const char* str)
method Token (line 84) | Token(const char* p, const char* b, const char* e)
method length (line 87) | size_t length() const { return end - begin; }
method ws_before (line 88) | std::string ws_before() const { return std::string(prefix, begin); }
method to_string (line 89) | const std::string to_string() const { return std::string(begin, end); }
method time_wspace (line 90) | std::string time_wspace() const {
class ParserState (line 102) | class ParserState : public Position {
method Offset (line 110) | Offset off() { return *this; }
method Position (line 111) | Position pos() { return *this; }
method ParserState (line 112) | ParserState pstate() { return *this; }
FILE: libsass-build/prelexer.cpp
type Sass (line 11) | namespace Sass {
type Prelexer (line 15) | namespace Prelexer {
FILE: libsass-build/prelexer.hpp
type Sass (line 7) | namespace Sass {
type Prelexer (line 9) | namespace Prelexer {
function count_interval (line 421) | unsigned int count_interval(const char* beg, const char* end) {
FILE: libsass-build/remove_placeholders.cpp
type Sass (line 7) | namespace Sass {
function Selector_List_Ptr (line 19) | Selector_List_Ptr Remove_Placeholders::remove_placeholders(Selector_Li...
FILE: libsass-build/remove_placeholders.hpp
type Sass (line 9) | namespace Sass {
class Remove_Placeholders (line 12) | class Remove_Placeholders : public Operation_CRTP<void, Remove_Placeho...
method fallback_impl (line 14) | void fallback_impl(AST_Node_Ptr n) {}
method fallback (line 30) | void fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/sass.cpp
type Sass (line 13) | namespace Sass {
function list2vec (line 16) | std::vector<std::string> list2vec(struct string_list* cur)
function sass_free_memory (line 52) | void ADDCALL sass_free_memory(void* ptr)
type Sass_Compiler (line 71) | struct Sass_Compiler
type Sass_Compiler (line 85) | struct Sass_Compiler
type Sass_Options (line 102) | struct Sass_Options
type Sass_Options (line 111) | struct Sass_Options
type Sass (line 132) | namespace Sass {
function list2vec (line 16) | std::vector<std::string> list2vec(struct string_list* cur)
FILE: libsass-build/sass.hpp
type Sass (line 52) | namespace Sass {
type Sass_Input_Style (line 70) | enum Sass_Input_Style {
type string_list (line 78) | struct string_list {
type Sass_Inspect_Options (line 84) | struct Sass_Inspect_Options {
type Sass_Output_Style (line 88) | enum Sass_Output_Style
method Sass_Inspect_Options (line 97) | Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED,
type Sass_Output_Options (line 105) | struct Sass_Output_Options : Sass_Inspect_Options {
method Sass_Output_Options (line 117) | Sass_Output_Options(struct Sass_Inspect_Options opt,
method Sass_Output_Options (line 127) | Sass_Output_Options(Sass_Output_Style style = Sass::NESTED,
FILE: libsass-build/sass2scss.cpp
type Sass (line 36) | namespace Sass
function findCommentOpener (line 195) | static size_t findCommentOpener (std::string& sass)
function removeMultilineComment (line 277) | static std::string removeMultilineComment (std::string &sass)
function rtrim (line 353) | std::string rtrim(const std::string &sass)
function flush (line 366) | std::string flush (std::string& sass, converter& converter)
function process (line 440) | std::string process (std::string& sass, converter& converter)
FILE: libsass-build/sass_context.cpp
type Sass (line 22) | namespace Sass {
function JsonNode (line 24) | static inline JsonNode* json_mkstream(const std::stringstream& stream)
function handle_error (line 31) | static int handle_error(Sass_Context* c_ctx) {
function handle_errors (line 206) | static int handle_errors(Sass_Context* c_ctx) {
function Block_Obj (line 211) | static Block_Obj sass_parse_block(Sass_Compiler* compiler) throw()
type Sass_Options (line 265) | struct Sass_Options
type Sass_Options (line 266) | struct Sass_Options
function copy_options (line 267) | static void copy_options(struct Sass_Options* to, struct Sass_Options* f...
function Sass_Compiler (line 298) | static Sass_Compiler* sass_prepare_context (Sass_Context* c_ctx, Context...
function sass_compile_context (line 363) | static int sass_compile_context (Sass_Context* c_ctx, Context* cpp_ctx)
function init_options (line 382) | inline void init_options (struct Sass_Options* options)
type Sass_Options (line 391) | struct Sass_Options
type Sass_Options (line 391) | struct Sass_Options
type Sass_File_Context (line 400) | struct Sass_File_Context
type Sass_File_Context (line 400) | struct Sass_File_Context
type Sass_File_Context (line 400) | struct Sass_File_Context
type Sass_Data_Context (line 416) | struct Sass_Data_Context
type Sass_Data_Context (line 416) | struct Sass_Data_Context
type Sass_Data_Context (line 416) | struct Sass_Data_Context
type Sass_Compiler (line 430) | struct Sass_Compiler
type Sass_Data_Context (line 430) | struct Sass_Data_Context
type Sass_Compiler (line 437) | struct Sass_Compiler
type Sass_File_Context (line 437) | struct Sass_File_Context
function sass_compile_data_context (line 444) | int ADDCALL sass_compile_data_context(Sass_Data_Context* data_ctx)
function sass_compile_file_context (line 459) | int ADDCALL sass_compile_file_context(Sass_File_Context* file_ctx)
function sass_compiler_parse (line 473) | int ADDCALL sass_compiler_parse(struct Sass_Compiler* compiler)
function sass_compiler_execute (line 488) | int ADDCALL sass_compiler_execute(struct Sass_Compiler* compiler)
function sass_reset_options (line 512) | static void sass_reset_options (struct Sass_Options* options)
function sass_clear_options (line 530) | static void sass_clear_options (struct Sass_Options* options)
function sass_clear_context (line 584) | static void sass_clear_context (struct Sass_Context* ctx)
function sass_delete_compiler (line 611) | void ADDCALL sass_delete_compiler (struct Sass_Compiler* compiler)
function sass_delete_options (line 624) | void ADDCALL sass_delete_options (struct Sass_Options* options)
function sass_delete_file_context (line 630) | void ADDCALL sass_delete_file_context (struct Sass_File_Context* ctx)
function sass_delete_data_context (line 636) | void ADDCALL sass_delete_data_context (struct Sass_Data_Context* ctx)
type Sass_Context (line 646) | struct Sass_Context
type Sass_File_Context (line 646) | struct Sass_File_Context
type Sass_Context (line 647) | struct Sass_Context
type Sass_Data_Context (line 647) | struct Sass_Data_Context
type Sass_Options (line 650) | struct Sass_Options
type Sass_Context (line 650) | struct Sass_Context
type Sass_Options (line 651) | struct Sass_Options
type Sass_File_Context (line 651) | struct Sass_File_Context
type Sass_Options (line 652) | struct Sass_Options
type Sass_Data_Context (line 652) | struct Sass_Data_Context
function sass_file_context_set_options (line 653) | void ADDCALL sass_file_context_set_options (struct Sass_File_Context* ct...
function sass_data_context_set_options (line 654) | void ADDCALL sass_data_context_set_options (struct Sass_Data_Context* ct...
function sass_compiler_get_state (line 657) | enum Sass_Compiler_State ADDCALL sass_compiler_get_state(struct Sass_Com...
type Sass_Context (line 658) | struct Sass_Context
type Sass_Compiler (line 658) | struct Sass_Compiler
type Sass_Options (line 659) | struct Sass_Options
type Sass_Compiler (line 659) | struct Sass_Compiler
function sass_compiler_get_import_stack_size (line 661) | size_t ADDCALL sass_compiler_get_import_stack_size(struct Sass_Compiler*...
function Sass_Import_Entry (line 662) | Sass_Import_Entry ADDCALL sass_compiler_get_last_import(struct Sass_Comp...
function Sass_Import_Entry (line 663) | Sass_Import_Entry ADDCALL sass_compiler_get_import_entry(struct Sass_Com...
function sass_compiler_get_callee_stack_size (line 665) | size_t ADDCALL sass_compiler_get_callee_stack_size(struct Sass_Compiler*...
function Sass_Callee_Entry (line 666) | Sass_Callee_Entry ADDCALL sass_compiler_get_last_callee(struct Sass_Comp...
function Sass_Callee_Entry (line 667) | Sass_Callee_Entry ADDCALL sass_compiler_get_callee_entry(struct Sass_Com...
function sass_context_get_included_files_size (line 670) | size_t ADDCALL sass_context_get_included_files_size (struct Sass_Context...
type Sass_Output_Style (line 675) | enum Sass_Output_Style
type Sass_Options (line 717) | struct Sass_Options
type string_list (line 720) | struct string_list
type string_list (line 720) | struct string_list
type Sass_Options (line 744) | struct Sass_Options
type Sass_Options (line 752) | struct Sass_Options
type string_list (line 755) | struct string_list
type string_list (line 755) | struct string_list
type string_list (line 755) | struct string_list
FILE: libsass-build/sass_context.hpp
type Sass_Options (line 9) | struct Sass_Options : Sass_Output_Options {
type string_list (line 47) | struct string_list
type string_list (line 49) | struct string_list
type Sass_Context (line 72) | struct Sass_Context : Sass_Options
type Sass_Input_Style (line 76) | enum Sass_Input_Style
type Sass_File_Context (line 101) | struct Sass_File_Context : Sass_Context {
type Sass_Data_Context (line 109) | struct Sass_Data_Context : Sass_Context {
type Sass_Compiler (line 118) | struct Sass_Compiler {
FILE: libsass-build/sass_functions.cpp
function Sass_Function_List (line 12) | Sass_Function_List ADDCALL sass_make_function_list(size_t length)
function Sass_Function_Entry (line 17) | Sass_Function_Entry ADDCALL sass_make_function(const char* signature, Sa...
function sass_delete_function (line 27) | void ADDCALL sass_delete_function(Sass_Function_Entry entry)
function sass_delete_function_list (line 34) | void ADDCALL sass_delete_function_list(Sass_Function_List list)
function Sass_Function_Entry (line 46) | Sass_Function_Entry ADDCALL sass_function_get_list_entry(Sass_Function_L...
function sass_function_set_list_entry (line 47) | void sass_function_set_list_entry(Sass_Function_List list, size_t pos, S...
function Sass_Function_Fn (line 50) | Sass_Function_Fn ADDCALL sass_function_get_function(Sass_Function_Entry ...
function Sass_Importer_Entry (line 53) | Sass_Importer_Entry ADDCALL sass_make_importer(Sass_Importer_Fn importer...
function Sass_Importer_Fn (line 63) | Sass_Importer_Fn ADDCALL sass_importer_get_function(Sass_Importer_Entry ...
function sass_importer_get_priority (line 64) | double ADDCALL sass_importer_get_priority (Sass_Importer_Entry cb) { ret...
function sass_delete_importer (line 68) | void ADDCALL sass_delete_importer (Sass_Importer_Entry cb)
function Sass_Importer_List (line 74) | Sass_Importer_List ADDCALL sass_make_importer_list(size_t length)
function sass_delete_importer_list (line 80) | void ADDCALL sass_delete_importer_list(Sass_Importer_List list)
function Sass_Importer_Entry (line 91) | Sass_Importer_Entry ADDCALL sass_importer_get_list_entry(Sass_Importer_L...
function sass_importer_set_list_entry (line 92) | void ADDCALL sass_importer_set_list_entry(Sass_Importer_List list, size_...
function Sass_Import_List (line 95) | Sass_Import_List ADDCALL sass_make_import_list(size_t length)
function Sass_Import_Entry (line 102) | Sass_Import_Entry ADDCALL sass_make_import(const char* imp_path, const c...
function Sass_Import_Entry (line 117) | Sass_Import_Entry ADDCALL sass_make_import_entry(const char* path, char*...
function Sass_Import_Entry (line 123) | Sass_Import_Entry ADDCALL sass_import_set_error(Sass_Import_Entry import...
function sass_import_set_list_entry (line 134) | void ADDCALL sass_import_set_list_entry(Sass_Import_List list, size_t id...
function Sass_Import_Entry (line 135) | Sass_Import_Entry ADDCALL sass_import_get_list_entry(Sass_Import_List li...
function sass_delete_import_list (line 138) | void ADDCALL sass_delete_import_list(Sass_Import_List list)
function sass_delete_import (line 150) | void ADDCALL sass_delete_import(Sass_Import_Entry import)
function sass_callee_get_line (line 163) | size_t ADDCALL sass_callee_get_line(Sass_Callee_Entry entry) { return en...
function sass_callee_get_column (line 164) | size_t ADDCALL sass_callee_get_column(Sass_Callee_Entry entry) { return ...
function sass_callee_get_type (line 165) | enum Sass_Callee_Type ADDCALL sass_callee_get_type(Sass_Callee_Entry ent...
function Sass_Env_Frame (line 166) | Sass_Env_Frame ADDCALL sass_callee_get_env (Sass_Callee_Entry entry) { r...
function sass_env_set_lexical (line 173) | void ADDCALL sass_env_set_lexical (Sass_Env_Frame env, const char* name,...
function sass_env_set_local (line 180) | void ADDCALL sass_env_set_local (Sass_Env_Frame env, const char* name, u...
function sass_env_set_global (line 187) | void ADDCALL sass_env_set_global (Sass_Env_Frame env, const char* name, ...
function sass_import_get_error_line (line 198) | size_t ADDCALL sass_import_get_error_line(Sass_Import_Entry entry) { ret...
function sass_import_get_error_column (line 199) | size_t ADDCALL sass_import_get_error_column(Sass_Import_Entry entry) { r...
FILE: libsass-build/sass_functions.hpp
type Sass_Function (line 9) | struct Sass_Function {
type Sass_Import (line 16) | struct Sass_Import {
type Sass_Env (line 28) | struct Sass_Env {
type Sass_Callee (line 34) | struct Sass_Callee {
type Sass_Callee_Type (line 39) | enum Sass_Callee_Type
type Sass_Env (line 40) | struct Sass_Env
type Sass_Importer (line 44) | struct Sass_Importer {
FILE: libsass-build/sass_util.cpp
type Sass (line 4) | namespace Sass {
function Node (line 40) | Node paths(const Node& arrs) {
function Node (line 111) | Node flatten(Node& arr, int n) {
FILE: libsass-build/sass_util.hpp
type Sass (line 8) | namespace Sass {
class DefaultLcsComparator (line 38) | class DefaultLcsComparator {
function Node (line 63) | Node lcs_backtrace(const LCSTable& c, const Node& x, const Node& y, in...
function lcs_table (line 99) | void lcs_table(const Node& x, const Node& y, const ComparatorType& com...
function Node (line 142) | Node lcs(Node& x, Node& y, const ComparatorType& comparator) {
function group_by_to_a (line 220) | void group_by_to_a(std::vector<EnumType>& enumeration, KeyFunctorType&...
FILE: libsass-build/sass_values.cpp
function sass_value_get_tag (line 15) | enum Sass_Tag ADDCALL sass_value_get_tag(const union Sass_Value* v) { re...
function sass_value_is_null (line 18) | bool ADDCALL sass_value_is_null(const union Sass_Value* v) { return v->u...
function sass_value_is_number (line 19) | bool ADDCALL sass_value_is_number(const union Sass_Value* v) { return v-...
function sass_value_is_string (line 20) | bool ADDCALL sass_value_is_string(const union Sass_Value* v) { return v-...
function sass_value_is_boolean (line 21) | bool ADDCALL sass_value_is_boolean(const union Sass_Value* v) { return v...
function sass_value_is_color (line 22) | bool ADDCALL sass_value_is_color(const union Sass_Value* v) { return v->...
function sass_value_is_list (line 23) | bool ADDCALL sass_value_is_list(const union Sass_Value* v) { return v->u...
function sass_value_is_map (line 24) | bool ADDCALL sass_value_is_map(const union Sass_Value* v) { return v->un...
function sass_value_is_error (line 25) | bool ADDCALL sass_value_is_error(const union Sass_Value* v) { return v->...
function sass_value_is_warning (line 26) | bool ADDCALL sass_value_is_warning(const union Sass_Value* v) { return v...
function sass_number_get_value (line 29) | double ADDCALL sass_number_get_value(const union Sass_Value* v) { return...
function sass_number_set_value (line 30) | void ADDCALL sass_number_set_value(union Sass_Value* v, double value) { ...
function sass_number_set_unit (line 32) | void ADDCALL sass_number_set_unit(union Sass_Value* v, char* unit) { v->...
function sass_string_set_value (line 36) | void ADDCALL sass_string_set_value(union Sass_Value* v, char* value) { v...
function sass_string_is_quoted (line 37) | bool ADDCALL sass_string_is_quoted(const union Sass_Value* v) { return v...
function sass_string_set_quoted (line 38) | void ADDCALL sass_string_set_quoted(union Sass_Value* v, bool quoted) { ...
function sass_boolean_get_value (line 41) | bool ADDCALL sass_boolean_get_value(const union Sass_Value* v) { return ...
function sass_boolean_set_value (line 42) | void ADDCALL sass_boolean_set_value(union Sass_Value* v, bool value) { v...
function sass_color_get_r (line 45) | double ADDCALL sass_color_get_r(const union Sass_Value* v) { return v->c...
function sass_color_set_r (line 46) | void ADDCALL sass_color_set_r(union Sass_Value* v, double r) { v->color....
function sass_color_get_g (line 47) | double ADDCALL sass_color_get_g(const union Sass_Value* v) { return v->c...
function sass_color_set_g (line 48) | void ADDCALL sass_color_set_g(union Sass_Value* v, double g) { v->color....
function sass_color_get_b (line 49) | double ADDCALL sass_color_get_b(const union Sass_Value* v) { return v->c...
function sass_color_set_b (line 50) | void ADDCALL sass_color_set_b(union Sass_Value* v, double b) { v->color....
function sass_color_get_a (line 51) | double ADDCALL sass_color_get_a(const union Sass_Value* v) { return v->c...
function sass_color_set_a (line 52) | void ADDCALL sass_color_set_a(union Sass_Value* v, double a) { v->color....
function sass_list_get_length (line 55) | size_t ADDCALL sass_list_get_length(const union Sass_Value* v) { return ...
function sass_list_get_separator (line 56) | enum Sass_Separator ADDCALL sass_list_get_separator(const union Sass_Val...
function sass_list_set_separator (line 57) | void ADDCALL sass_list_set_separator(union Sass_Value* v, enum Sass_Sepa...
function sass_list_get_is_bracketed (line 58) | bool ADDCALL sass_list_get_is_bracketed(const union Sass_Value* v) { ret...
function sass_list_set_is_bracketed (line 59) | void ADDCALL sass_list_set_is_bracketed(union Sass_Value* v, bool is_bra...
function sass_list_set_value (line 62) | void ADDCALL sass_list_set_value(union Sass_Value* v, size_t i, union Sa...
function sass_map_get_length (line 65) | size_t ADDCALL sass_map_get_length(const union Sass_Value* v) { return v...
function sass_map_set_key (line 69) | void ADDCALL sass_map_set_key(union Sass_Value* v, size_t i, union Sass_...
function sass_map_set_value (line 70) | void ADDCALL sass_map_set_value(union Sass_Value* v, size_t i, union Sas...
function sass_error_set_message (line 74) | void ADDCALL sass_error_set_message(union Sass_Value* v, char* msg) { v-...
function sass_warning_set_message (line 78) | void ADDCALL sass_warning_set_message(union Sass_Value* v, char* msg) { ...
type Sass_Separator (line 136) | enum Sass_Separator
type Sass_MapPair (line 155) | struct Sass_MapPair
type Sass_MapPair (line 155) | struct Sass_MapPair
function sass_delete_value (line 189) | void ADDCALL sass_delete_value(union Sass_Value* val) {
type Sass_OP (line 290) | enum Sass_OP
type Sass_Inspect_Options (line 299) | struct Sass_Inspect_Options
FILE: libsass-build/sass_values.hpp
type Sass_Unknown (line 6) | struct Sass_Unknown {
type Sass_Tag (line 7) | enum Sass_Tag
type Sass_Boolean (line 10) | struct Sass_Boolean {
type Sass_Tag (line 11) | enum Sass_Tag
type Sass_Number (line 15) | struct Sass_Number {
type Sass_Tag (line 16) | enum Sass_Tag
type Sass_Color (line 21) | struct Sass_Color {
type Sass_Tag (line 22) | enum Sass_Tag
type Sass_String (line 29) | struct Sass_String {
type Sass_Tag (line 30) | enum Sass_Tag
type Sass_List (line 35) | struct Sass_List {
type Sass_Tag (line 36) | enum Sass_Tag
type Sass_Separator (line 37) | enum Sass_Separator
type Sass_Map (line 44) | struct Sass_Map {
type Sass_Tag (line 45) | enum Sass_Tag
type Sass_MapPair (line 47) | struct Sass_MapPair
type Sass_Null (line 50) | struct Sass_Null {
type Sass_Tag (line 51) | enum Sass_Tag
type Sass_Error (line 54) | struct Sass_Error {
type Sass_Tag (line 55) | enum Sass_Tag
type Sass_Warning (line 59) | struct Sass_Warning {
type Sass_Tag (line 60) | enum Sass_Tag
type Sass_Unknown (line 65) | struct Sass_Unknown
type Sass_Tag (line 7) | enum Sass_Tag
type Sass_Boolean (line 66) | struct Sass_Boolean
type Sass_Tag (line 11) | enum Sass_Tag
type Sass_Number (line 67) | struct Sass_Number
type Sass_Tag (line 16) | enum Sass_Tag
type Sass_Color (line 68) | struct Sass_Color
type Sass_Tag (line 22) | enum Sass_Tag
type Sass_String (line 69) | struct Sass_String
type Sass_Tag (line 30) | enum Sass_Tag
type Sass_List (line 70) | struct Sass_List
type Sass_Tag (line 36) | enum Sass_Tag
type Sass_Separator (line 37) | enum Sass_Separator
type Sass_Map (line 71) | struct Sass_Map
type Sass_Tag (line 45) | enum Sass_Tag
type Sass_MapPair (line 47) | struct Sass_MapPair
type Sass_Null (line 72) | struct Sass_Null
type Sass_Tag (line 51) | enum Sass_Tag
type Sass_Error (line 73) | struct Sass_Error
type Sass_Tag (line 55) | enum Sass_Tag
type Sass_Warning (line 74) | struct Sass_Warning
type Sass_Tag (line 60) | enum Sass_Tag
type Sass_MapPair (line 77) | struct Sass_MapPair {
FILE: libsass-build/source_map.cpp
type Sass (line 13) | namespace Sass {
function ParserState (line 183) | ParserState SourceMap::remap(const ParserState& pstate) {
FILE: libsass-build/source_map.hpp
type Sass (line 15) | namespace Sass {
class Context (line 17) | class Context
class OutputBuffer (line 18) | class OutputBuffer
method OutputBuffer (line 51) | OutputBuffer(void)
class SourceMap (line 20) | class SourceMap {
class OutputBuffer (line 49) | class OutputBuffer {
method OutputBuffer (line 51) | OutputBuffer(void)
FILE: libsass-build/subset_map.cpp
type Sass (line 5) | namespace Sass {
FILE: libsass-build/subset_map.hpp
type Sass (line 59) | namespace Sass {
class Subset_Map (line 61) | class Subset_Map {
method empty (line 69) | bool empty() { return values_.empty(); }
method clear (line 70) | void clear() { values_.clear(); hash_.clear(); }
method values (line 71) | const std::vector<SubSetMapPair> values(void) { return values_; }
FILE: libsass-build/to_c.cpp
type Sass (line 5) | namespace Sass {
FILE: libsass-build/to_c.hpp
type Sass (line 8) | namespace Sass {
class To_C (line 10) | class To_C : public Operation_CRTP<union Sass_Value*, To_C> {
method To_C (line 16) | To_C() { }
FILE: libsass-build/to_value.cpp
type Sass (line 5) | namespace Sass {
function Value_Ptr (line 7) | Value_Ptr To_Value::fallback_impl(AST_Node_Ptr n)
function Value_Ptr (line 15) | Value_Ptr To_Value::operator()(Custom_Error_Ptr e)
function Value_Ptr (line 21) | Value_Ptr To_Value::operator()(Custom_Warning_Ptr w)
function Value_Ptr (line 27) | Value_Ptr To_Value::operator()(Boolean_Ptr b)
function Value_Ptr (line 33) | Value_Ptr To_Value::operator()(Number_Ptr n)
function Value_Ptr (line 39) | Value_Ptr To_Value::operator()(Color_Ptr c)
function Value_Ptr (line 45) | Value_Ptr To_Value::operator()(String_Constant_Ptr s)
function Value_Ptr (line 51) | Value_Ptr To_Value::operator()(String_Quoted_Ptr s)
function Value_Ptr (line 57) | Value_Ptr To_Value::operator()(List_Ptr l)
function Value_Ptr (line 72) | Value_Ptr To_Value::operator()(Map_Ptr m)
function Value_Ptr (line 78) | Value_Ptr To_Value::operator()(Null_Ptr n)
function Value_Ptr (line 84) | Value_Ptr To_Value::operator()(Function_Ptr n)
function Value_Ptr (line 90) | Value_Ptr To_Value::operator()(Argument_Ptr arg)
function Value_Ptr (line 97) | Value_Ptr To_Value::operator()(Selector_List_Ptr s)
function Value_Ptr (line 105) | Value_Ptr To_Value::operator()(Binary_Expression_Ptr s)
FILE: libsass-build/to_value.hpp
type Sass (line 8) | namespace Sass {
class To_Value (line 10) | class To_Value : public Operation_CRTP<Value_Ptr, To_Value> {
method To_Value (line 20) | To_Value(Context& ctx)
method Value_Ptr (line 45) | Value_Ptr fallback(U x) { return fallback_impl(x); }
FILE: libsass-build/units.cpp
type Sass (line 6) | namespace Sass {
function UnitClass (line 53) | UnitClass get_unit_type(UnitType unit)
function get_unit_class (line 66) | std::string get_unit_class(UnitType unit)
function UnitType (line 79) | UnitType get_main_unit(const UnitClass unit)
function UnitType (line 92) | UnitType string_to_unit(const std::string& s)
function unit_to_class (line 150) | std::string unit_to_class(const std::string& s)
function conversion_factor (line 178) | double conversion_factor(const std::string& s1, const std::string& s2)
function conversion_factor (line 193) | double conversion_factor(UnitType u1, UnitType u2, UnitClass t1, UnitC...
function convert_units (line 220) | double convert_units(const std::string& lhs, const std::string& rhs, i...
FILE: libsass-build/units.hpp
type Sass (line 9) | namespace Sass {
type UnitClass (line 13) | enum UnitClass {
type UnitType (line 22) | enum UnitType {
class Units (line 56) | class Units {
method Units (line 62) | Units() :
method Units (line 67) | Units(const Units* ptr) :
type Sass::UnitType (line 97) | enum Sass::UnitType
type Sass::UnitClass (line 99) | enum Sass::UnitClass
FILE: libsass-build/utf8/checked.h
function namespace (line 34) | namespace utf8
function output_iterator (line 130) | output_iterator replace_invalid(octet_iterator start, octet_iterator end...
function operator (line 291) | uint32_t operator * () const
function operator (line 302) | bool operator != (const iterator& rhs) const
function iterator (line 311) | iterator operator ++ (int)
function iterator (line 322) | iterator operator -- (int)
FILE: libsass-build/utf8/core.h
function namespace (line 33) | namespace utf8
FILE: libsass-build/utf8/unchecked.h
function namespace (line 33) | namespace utf8
FILE: libsass-build/utf8_string.cpp
type Sass (line 9) | namespace Sass {
type UTF_8 (line 10) | namespace UTF_8 {
function code_point_count (line 19) | size_t code_point_count(const string& str, size_t start, size_t end) {
function code_point_count (line 23) | size_t code_point_count(const string& str) {
function offset_at_position (line 28) | size_t offset_at_position(const string& str, size_t position) {
function code_point_size_at_offset (line 35) | size_t code_point_size_at_offset(const string& str, size_t offset) {
function normalize_index (line 47) | size_t normalize_index(int index, size_t len) {
function string (line 78) | string convert_from_utf16(const wstring& utf16)
function wstring (line 89) | wstring convert_to_utf16(const string& utf8)
FILE: libsass-build/utf8_string.hpp
type Sass (line 7) | namespace Sass {
type UTF_8 (line 8) | namespace UTF_8 {
FILE: libsass-build/util.cpp
type Sass (line 16) | namespace Sass {
function round (line 18) | double round(double val, size_t precision)
function sass_strtod (line 38) | double sass_strtod(const char *str)
function free_string_array (line 65) | void free_string_array(char ** arr) {
function read_css_string (line 99) | std::string read_css_string(const std::string& str, bool css)
function evacuate_escapes (line 127) | std::string evacuate_escapes(const std::string& str)
function newline_to_space (line 161) | void newline_to_space(std::string& str)
function string_to_output (line 168) | std::string string_to_output(const std::string& str)
function escape_string (line 184) | std::string escape_string(const std::string& str)
function comment_to_string (line 201) | std::string comment_to_string(const std::string& text)
function detect_best_quotemark (line 237) | char detect_best_quotemark(const char* s, char qm)
function read_hex_escapes (line 253) | std::string read_hex_escapes(const std::string& s)
function unquote (line 322) | std::string unquote(const std::string& s, char* qd, bool keep_utf8_seq...
function quote (line 414) | std::string quote(const std::string& s, char q)
function is_hex_doublet (line 475) | bool is_hex_doublet(double n)
function is_color_doublet (line 483) | bool is_color_doublet(double r, double g, double b)
function peek_linefeed (line 488) | bool peek_linefeed(const char* start)
type Util (line 510) | namespace Util {
function rtrim (line 513) | std::string rtrim(const std::string &str) {
function normalize_underscores (line 522) | std::string normalize_underscores(const std::string& str) {
function normalize_decimals (line 532) | std::string normalize_decimals(const std::string& str) {
function isPrintable (line 539) | bool isPrintable(Ruleset_Ptr r, Sass_Output_Style style) {
function isPrintable (line 587) | bool isPrintable(String_Constant_Ptr s, Sass_Output_Style style)
function isPrintable (line 592) | bool isPrintable(String_Quoted_Ptr s, Sass_Output_Style style)
function isPrintable (line 597) | bool isPrintable(Declaration_Ptr d, Sass_Output_Style style)
function isPrintable (line 605) | bool isPrintable(Supports_Block_Ptr f, Sass_Output_Style style) {
function isPrintable (line 636) | bool isPrintable(Media_Block_Ptr m, Sass_Output_Style style)
function isPrintable (line 674) | bool isPrintable(Comment_Ptr c, Sass_Output_Style style)
function isPrintable (line 688) | bool isPrintable(Block_Obj b, Sass_Output_Style style) {
function isAscii (line 728) | bool isAscii(const char chr) {
FILE: libsass-build/util.hpp
type Sass (line 13) | namespace Sass {
type Util (line 37) | namespace Util {
FILE: libsass-build/values.cpp
type Sass (line 7) | namespace Sass {
function Value_Ptr (line 68) | Value_Ptr sass_value_to_ast_node (const union Sass_Value* val)
FILE: libsass-build/values.hpp
type Sass (line 6) | namespace Sass {
FILE: mixins.go
function init (line 4) | func init() {
FILE: options.go
type FuncOpt (line 6) | type FuncOpt
method Option (line 9) | func (c *sass) Option(opts ...FuncOpt) error {
function BasePath (line 22) | func BasePath(basePath string) FuncOpt {
function BuildDir (line 32) | func BuildDir(path string) FuncOpt {
function CacheBust (line 40) | func CacheBust(t string) FuncOpt {
function Comments (line 51) | func Comments(b bool) FuncOpt {
function FontDir (line 59) | func FontDir(path string) FuncOpt {
function HTTPPath (line 68) | func HTTPPath(u string) FuncOpt {
function ImgBuildDir (line 77) | func ImgBuildDir(path string) FuncOpt {
function ImgDir (line 85) | func ImgDir(path string) FuncOpt {
function ImportsOption (line 93) | func ImportsOption(imports *Imports) FuncOpt {
function IncludePaths (line 101) | func IncludePaths(includes []string) FuncOpt {
function LineComments (line 110) | func LineComments(b bool) FuncOpt {
function OutputStyle (line 119) | func OutputStyle(style int) FuncOpt {
function Precision (line 128) | func Precision(prec int) FuncOpt {
function SourceMap (line 138) | func SourceMap(b bool, path, sourceMapRoot string) FuncOpt {
function Path (line 152) | func Path(path string) FuncOpt {
function Payload (line 162) | func Payload(load context.Context) FuncOpt {
type Syntax (line 170) | type Syntax
constant SCSSSyntax (line 173) | SCSSSyntax Syntax = iota
constant SassSyntax (line 174) | SassSyntax
function WithSyntax (line 177) | func WithSyntax(mode Syntax) FuncOpt {
FILE: options_test.go
function TestOption_precision (line 8) | func TestOption_precision(t *testing.T) {
function TestOption_style (line 45) | func TestOption_style(t *testing.T) {
function TestOption_comment (line 110) | func TestOption_comment(t *testing.T) {
function TestOption_include (line 147) | func TestOption_include(t *testing.T) {
function TestOption_new (line 167) | func TestOption_new(t *testing.T) {
FILE: toscss.go
function ToScss (line 10) | func ToScss(r io.Reader, w io.Writer) error {
FILE: toscss_test.go
function TestToScss (line 8) | func TestToScss(t *testing.T) {
FILE: unicode_test.go
function TestUnicode (line 10) | func TestUnicode(t *testing.T) {
FILE: version.go
function Version (line 6) | func Version() string {
FILE: version_test.go
function TestVersion (line 5) | func TestVersion(t *testing.T) {
Condensed preview — 225 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,495K chars).
[
{
"path": ".github/workflows/go.yml",
"chars": 531,
"preview": "# This workflow will build a golang project\n# For more information see: https://docs.github.com/en/actions/automating-bu"
},
{
"path": ".gitignore",
"chars": 27,
"preview": "*.test\nlib/\nlibsass-tmp/\n\n\n"
},
{
"path": ".gitmodules",
"chars": 89,
"preview": "[submodule \"libsass-src\"]\n\tpath = libsass-src\n\turl = https://github.com/sass/libsass.git\n"
},
{
"path": "LICENSE",
"chars": 11339,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "Makefile",
"chars": 1385,
"preview": "export PKG_CONFIG_PATH=$(shell pwd)/lib/pkgconfig\n\ninstall: deps\n\ndeps: fetch\n\nfetch:\n\tgit submodule sync\n\tgit submodule"
},
{
"path": "README.md",
"chars": 1628,
"preview": "libsass\n=========\n\n* Deprecated\nTry this project [https://github.com/bep/godartsass](https://github.com/bep/godartsass)\n"
},
{
"path": "appveyor.yml",
"chars": 973,
"preview": "build: off\n\nclone_folder: c:\\gopath\\src\\github.com\\wellington\\go-libsass\n\nenvironment:\n GOPATH: c:\\gopath\n\nstack: go 1."
},
{
"path": "blah/blah.go",
"chars": 852,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\nfunc main() {\n\t//run(\"blah.scss\")\n\trun(\"error"
},
{
"path": "blah/blah.scss",
"chars": 26,
"preview": "div { p { color: red; } }\n"
},
{
"path": "blah/error.scss",
"chars": 4,
"preview": "p {\n"
},
{
"path": "compiler.go",
"chars": 3850,
"preview": "package libsass\n\nimport (\n\t\"errors\"\n\t\"io\"\n\n\t\"context\"\n)\n\nvar (\n\tErrPayloadEmpty = errors.New(\"empty payload\")\n\t"
},
{
"path": "compiler_test.go",
"chars": 3939,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"testing\"\n)\n\nfunc ExampleCompiler_stdin() {\n\n\ts"
},
{
"path": "context.go",
"chars": 7147,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"g"
},
{
"path": "context_test.go",
"chars": 2772,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\nfunc TestContext"
},
{
"path": "doc.go",
"chars": 280,
"preview": "// Package context wraps access to libsass. Higher level abstractions\n// are used to make the package more like Go than "
},
{
"path": "encoding.go",
"chars": 6027,
"preview": "package libsass\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"image/color\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/wellington/go-l"
},
{
"path": "encoding_test.go",
"chars": 9638,
"preview": "package libsass\n\nimport (\n\t\"fmt\"\n\t\"image/color\"\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\ntype "
},
{
"path": "error.go",
"chars": 1037,
"preview": "package libsass\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n)\n\n// SassError represents an error object returned from Sass. SassEr"
},
{
"path": "error_test.go",
"chars": 3710,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"strings\"\n\n\t\"testing\"\n)\n\ntype ErrorMap struct {\n\tline int\n\tmessage string\n}\n\nfunc"
},
{
"path": "examples/basic/file.scss",
"chars": 30,
"preview": "div {\n p { color: black; }\n}\n"
},
{
"path": "examples/basic/main.go",
"chars": 303,
"preview": "package main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\tlibsass \"github.com/wellington/go-libsass\"\n)\n\nfunc main() {\n\tr, err := os.Open(\"fi"
},
{
"path": "examples/customfunc/README.md",
"chars": 676,
"preview": "Cryptographically secure pseudorandom number generator in Sass. Well that is easy to do with this custom `crypto()` hand"
},
{
"path": "examples/customfunc/main.go",
"chars": 1122,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"crypto/rand\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/wellington/go-libsass\"\n)\n\n//"
},
{
"path": "examples/custompreamble/README.md",
"chars": 289,
"preview": "Example using libSass Headers. Headers include Sass code at the top of every file. It is used by Wellington to include m"
},
{
"path": "examples/custompreamble/main.go",
"chars": 930,
"preview": "// Create a preamble for every CSS file\npackage main\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/wellington/go-libsass"
},
{
"path": "examples/options/file.scss",
"chars": 54,
"preview": "@import \"settings\"\n\nhtml {\n background-color: $bg;\n}\n"
},
{
"path": "examples/options/main.go",
"chars": 462,
"preview": "package main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\tlibsass \"github.com/wellington/go-libsass\"\n)\n\nfunc main() {\n\tr, err := os.Open(\"fi"
},
{
"path": "examples/options/partials/_settings.sass",
"chars": 8,
"preview": "$bg: red"
},
{
"path": "export.go",
"chars": 345,
"preview": "package libsass\n\nimport \"github.com/wellington/go-libsass/libs\"\n\n// Error takes a Go error and returns a libsass Error\nf"
},
{
"path": "export_test.go",
"chars": 554,
"preview": "package libsass\n\nimport (\n\t\"errors\"\n\t\"testing\"\n)\n\nfunc TestRegisterHandler(t *testing.T) {\n\tl := len(globalHandlers)\n\tRe"
},
{
"path": "file_test.go",
"chars": 697,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestFile_resolved(t *testing.T) {\n\tpat"
},
{
"path": "func.go",
"chars": 4706,
"preview": "package libsass\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sync\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\nvar ghMu sync"
},
{
"path": "func_test.go",
"chars": 3855,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"image/color\"\n\t\"reflect\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/wellington/go-libsass/libs"
},
{
"path": "go.mod",
"chars": 110,
"preview": "module github.com/wellington/go-libsass\n\ngo 1.18\n\nrequire golang.org/x/net v0.0.0-20220921203646-d300de134e69\n"
},
{
"path": "go.sum",
"chars": 207,
"preview": "golang.org/x/net v0.0.0-20220921203646-d300de134e69 h1:hUJpGDpnfwdJW8iNypFjmSY0sCBEL+spFTZ2eO+Sfps=\ngolang.org/x/net v0."
},
{
"path": "header.go",
"chars": 1836,
"preview": "package libsass\n\nimport (\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\nvar globalHeaders []string\n\n//"
},
{
"path": "header_test.go",
"chars": 955,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"testing\"\n)\n\nfunc TestSassHeader_single(t *testing.T) {\n\tin := bytes.NewBufferString"
},
{
"path": "importer.go",
"chars": 3429,
"preview": "package libsass\n\nimport (\n\t\"errors\"\n\t\"io\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/wellington/go-libsass/libs\"\n)\n\nvar (\n\tErrImportN"
},
{
"path": "importer_test.go",
"chars": 3553,
"preview": "package libsass\n\nimport (\n\t\"bytes\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestSassImport_single(t *testing.T) {\n\tin := bytes.NewB"
},
{
"path": "libs/SharedPtr.hpp",
"chars": 76,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/memory/SharedPtr.hpp\"\n#endif\n"
},
{
"path": "libs/ast.hpp",
"chars": 63,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/ast.hpp\"\n#endif\n"
},
{
"path": "libs/ast_fwd_decl.hpp",
"chars": 72,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/ast_fwd_decl.hpp\"\n#endif\n"
},
{
"path": "libs/base64vlq.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/base64vlq.hpp\"\n#endif\n"
},
{
"path": "libs/bind.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/bind.hpp\"\n#endif\n"
},
{
"path": "libs/cencode.c",
"chars": 65,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/cencode.c\"\n#endif\n"
},
{
"path": "libs/check_nesting.hpp",
"chars": 73,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/check_nesting.hpp\"\n#endif\n"
},
{
"path": "libs/color_maps.hpp",
"chars": 70,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/color_maps.hpp\"\n#endif\n"
},
{
"path": "libs/color_names.hpp",
"chars": 71,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/color_names.hpp\"\n#endif\n"
},
{
"path": "libs/constants.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/constants.hpp\"\n#endif\n"
},
{
"path": "libs/context.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/context.hpp\"\n#endif\n"
},
{
"path": "libs/cssize.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/cssize.hpp\"\n#endif\n"
},
{
"path": "libs/docs.go",
"chars": 484,
"preview": "// libs is a direct mapping to libsass C API. This package should not be\n// necessary to do any high level operations. I"
},
{
"path": "libs/emitter.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/emitter.hpp\"\n#endif\n"
},
{
"path": "libs/encoding.go",
"chars": 5807,
"preview": "package libs\n\n// #include <stdlib.h>\n// #include \"sass/context.h\"\nimport \"C\"\nimport (\n\t\"image/color\"\n\t\"reflect\"\n\t\"unsafe"
},
{
"path": "libs/environment.hpp",
"chars": 71,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/environment.hpp\"\n#endif\n"
},
{
"path": "libs/error_handling.hpp",
"chars": 74,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/error_handling.hpp\"\n#endif\n"
},
{
"path": "libs/eval.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/eval.hpp\"\n#endif\n"
},
{
"path": "libs/expand.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/expand.hpp\"\n#endif\n"
},
{
"path": "libs/export.go",
"chars": 1060,
"preview": "package libs\n\n// #include \"sass/context.h\"\n//\nimport \"C\"\nimport (\n\t\"fmt\"\n\t\"sync\"\n)\n\n// SassCallback defines the callback"
},
{
"path": "libs/extend.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/extend.hpp\"\n#endif\n"
},
{
"path": "libs/file.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/file.hpp\"\n#endif\n"
},
{
"path": "libs/func.go",
"chars": 1661,
"preview": "package libs\n\n// #include <stdint.h>\n// #include <stdlib.h>\n// #include \"sass/context.h\"\n//\n// extern union Sass_Value* "
},
{
"path": "libs/functions.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/functions.hpp\"\n#endif\n"
},
{
"path": "libs/header.go",
"chars": 1192,
"preview": "package libs\n\n// #include <stdint.h>\n// #include <string.h>\n// #include \"sass/context.h\"\n//\n// extern struct Sass_Import"
},
{
"path": "libs/helpers.go",
"chars": 631,
"preview": "package libs\n\n// #include <stdlib.h>\n// #include \"sass/context.h\"\nimport \"C\"\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\nfunc GetI"
},
{
"path": "libs/importer.go",
"chars": 2482,
"preview": "package libs\n\n// #include <stdint.h>\n// #include <stdlib.h>\n// #include <string.h>\n// #include \"sass/context.h\"\n//\n// ex"
},
{
"path": "libs/inspect.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/inspect.hpp\"\n#endif\n"
},
{
"path": "libs/json.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/json.hpp\"\n#endif\n"
},
{
"path": "libs/kwd_arg_macros.hpp",
"chars": 74,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/kwd_arg_macros.hpp\"\n#endif\n"
},
{
"path": "libs/lexer.hpp",
"chars": 65,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/lexer.hpp\"\n#endif\n"
},
{
"path": "libs/listize.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/listize.hpp\"\n#endif\n"
},
{
"path": "libs/mapping.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/mapping.hpp\"\n#endif\n"
},
{
"path": "libs/node.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/node.hpp\"\n#endif\n"
},
{
"path": "libs/operation.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/operation.hpp\"\n#endif\n"
},
{
"path": "libs/output.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/output.hpp\"\n#endif\n"
},
{
"path": "libs/parser.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/parser.hpp\"\n#endif\n"
},
{
"path": "libs/paths.hpp",
"chars": 65,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/paths.hpp\"\n#endif\n"
},
{
"path": "libs/plugins.hpp",
"chars": 67,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/plugins.hpp\"\n#endif\n"
},
{
"path": "libs/position.hpp",
"chars": 68,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/position.hpp\"\n#endif\n"
},
{
"path": "libs/prelexer.hpp",
"chars": 68,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/prelexer.hpp\"\n#endif\n"
},
{
"path": "libs/remove_placeholders.hpp",
"chars": 79,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/remove_placeholders.hpp\"\n#endif\n"
},
{
"path": "libs/safemap.go",
"chars": 675,
"preview": "package libs\n\nimport \"sync\"\n\n// globalImports stores []ImportEntry in a place where GC won't\n// delete it\ntype SafeMap s"
},
{
"path": "libs/sass_number.go",
"chars": 3631,
"preview": "package libs\n\nimport (\n\t\"math\"\n\t\"strconv\"\n)\n\nfunc (s SassNumber) String() string {\n\treturn strconv.FormatFloat(s.Value, "
},
{
"path": "libs/sass_number_test.go",
"chars": 5495,
"preview": "package libs\n\nimport (\n\t\"math\"\n\t\"testing\"\n)\n\nvar tolerance = float64(0.00001)\n\nfunc TestSassNumberAddDifferentUnits(t *t"
},
{
"path": "libs/sass_util.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/sass_util.hpp\"\n#endif\n"
},
{
"path": "libs/source_map.hpp",
"chars": 70,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/source_map.hpp\"\n#endif\n"
},
{
"path": "libs/subset_map.hpp",
"chars": 70,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/subset_map.hpp\"\n#endif\n"
},
{
"path": "libs/to_c.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/to_c.hpp\"\n#endif\n"
},
{
"path": "libs/to_string.hpp",
"chars": 69,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/to_string.hpp\"\n#endif\n"
},
{
"path": "libs/to_value.hpp",
"chars": 68,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/to_value.hpp\"\n#endif\n"
},
{
"path": "libs/toscss.go",
"chars": 574,
"preview": "package libs\n\n// #include <stdlib.h>\n// #include \"sass2scss.h\"\nimport \"C\"\nimport (\n\t\"io\"\n\t\"io/ioutil\"\n\t\"unsafe\"\n)\n\n// To"
},
{
"path": "libs/units.hpp",
"chars": 65,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/units.hpp\"\n#endif\n"
},
{
"path": "libs/unity.cpp",
"chars": 1880,
"preview": "#ifndef USE_LIBSASS\n\n\n#include \"../libsass-build/ast.cpp\"\n#include \"../libsass-build/ast_fwd_decl.cpp\"\n#include \"../libs"
},
{
"path": "libs/utf8.h",
"chars": 62,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/utf8.h\"\n#endif\n"
},
{
"path": "libs/utf8_string.hpp",
"chars": 71,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/utf8_string.hpp\"\n#endif\n"
},
{
"path": "libs/util.hpp",
"chars": 64,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/util.hpp\"\n#endif\n"
},
{
"path": "libs/values.hpp",
"chars": 66,
"preview": "#ifndef USE_LIBSASS\n#include \"../libsass-build/values.hpp\"\n#endif\n"
},
{
"path": "libs/wrap.go",
"chars": 12068,
"preview": "package libs\n\n// #include \"stdint.h\"\n//\n// extern struct Sass_Import** HeaderBridge(uintptr_t idx);\n//\n// #//for C.free\n"
},
{
"path": "libs/wrap_dev.go",
"chars": 198,
"preview": "// +build dev\n\npackage libs\n\n// #cgo CPPFLAGS: -DUSE_LIBSASS\n// #cgo CPPFLAGS: -I../libsass-build -I../libsass-build/inc"
},
{
"path": "libs/wrap_main.go",
"chars": 241,
"preview": "// +build !dev\n\npackage libs\n\n// #cgo CFLAGS: -O2 -fPIC\n// #cgo CPPFLAGS: -I../libsass-build -I../libsass-build/include\n"
},
{
"path": "libsass-build/ast.cpp",
"chars": 71673,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"context.hpp\"\n#include \"node.hpp\"\n#include \"eval.hpp\"\n#include \"extend.h"
},
{
"path": "libsass-build/ast.hpp",
"chars": 102330,
"preview": "#ifndef SASS_AST_H\n#define SASS_AST_H\n\n#include \"sass.hpp\"\n#include <set>\n#include <deque>\n#include <vector>\n#include <s"
},
{
"path": "libsass-build/ast_def_macros.hpp",
"chars": 2374,
"preview": "#ifndef SASS_AST_DEF_MACROS_H\n#define SASS_AST_DEF_MACROS_H\n\n// Helper class to switch a flag and revert once we go out "
},
{
"path": "libsass-build/ast_fwd_decl.cpp",
"chars": 676,
"preview": "#include \"ast.hpp\"\n\nnamespace Sass {\n\n #define IMPLEMENT_BASE_CAST(T) \\\n template<> \\\n T* Cast(AST_Node* ptr) { \\\n "
},
{
"path": "libsass-build/ast_fwd_decl.hpp",
"chars": 15164,
"preview": "#ifndef SASS_AST_FWD_DECL_H\n#define SASS_AST_FWD_DECL_H\n\n#include <map>\n#include <set>\n#include <deque>\n#include <vector"
},
{
"path": "libsass-build/b64/cencode.h",
"chars": 725,
"preview": "/*\ncencode.h - c header for a base64 encoding algorithm\n\nThis is part of the libb64 project, and has been placed in the "
},
{
"path": "libsass-build/b64/encode.h",
"chars": 1598,
"preview": "// :mode=c++:\n/*\nencode.h - c++ wrapper for a base64 encoding algorithm\n\nThis is part of the libb64 project, and has bee"
},
{
"path": "libsass-build/backtrace.cpp",
"chars": 1087,
"preview": "#include \"backtrace.hpp\"\n\nnamespace Sass {\n\n const std::string traces_to_string(Backtraces traces, std::string indent) "
},
{
"path": "libsass-build/backtrace.hpp",
"chars": 470,
"preview": "#ifndef SASS_BACKTRACE_H\n#define SASS_BACKTRACE_H\n\n#include <vector>\n#include <sstream>\n#include \"file.hpp\"\n#include \"po"
},
{
"path": "libsass-build/base64vlq.cpp",
"chars": 1057,
"preview": "#include \"sass.hpp\"\n#include \"base64vlq.hpp\"\n\nnamespace Sass {\n\n std::string Base64VLQ::encode(const int number) const\n"
},
{
"path": "libsass-build/base64vlq.hpp",
"chars": 477,
"preview": "#ifndef SASS_BASE64VLQ_H\n#define SASS_BASE64VLQ_H\n\n#include <string>\n\nnamespace Sass {\n\n class Base64VLQ {\n\n public:\n\n"
},
{
"path": "libsass-build/bind.cpp",
"chars": 11946,
"preview": "#include \"sass.hpp\"\n#include \"bind.hpp\"\n#include \"ast.hpp\"\n#include \"context.hpp\"\n#include \"expand.hpp\"\n#include \"eval.h"
},
{
"path": "libsass-build/bind.hpp",
"chars": 246,
"preview": "#ifndef SASS_BIND_H\n#define SASS_BIND_H\n\n#include <string>\n#include \"environment.hpp\"\n#include \"ast_fwd_decl.hpp\"\n\nnames"
},
{
"path": "libsass-build/c99func.c",
"chars": 1739,
"preview": "/*\n Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com)\n All rights reserved.\n\n Permission is hereby gran"
},
{
"path": "libsass-build/cencode.c",
"chars": 2548,
"preview": "/*\ncencoder.c - c source to a base64 encoding algorithm implementation\n\nThis is part of the libb64 project, and has been"
},
{
"path": "libsass-build/check_nesting.cpp",
"chars": 10428,
"preview": "#include \"sass.hpp\"\n#include <vector>\n\n#include \"check_nesting.hpp\"\n\nnamespace Sass {\n\n CheckNesting::CheckNesting()\n "
},
{
"path": "libsass-build/check_nesting.hpp",
"chars": 1890,
"preview": "#ifndef SASS_CHECK_NESTING_H\n#define SASS_CHECK_NESTING_H\n\n#include \"ast.hpp\"\n#include \"operation.hpp\"\n\nnamespace Sass {"
},
{
"path": "libsass-build/color_maps.cpp",
"chars": 32851,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"color_maps.hpp\"\n\nnamespace Sass {\n\n namespace ColorNames\n {\n const"
},
{
"path": "libsass-build/color_maps.hpp",
"chars": 10801,
"preview": "\n#ifndef SASS_COLOR_MAPS_H\n#define SASS_COLOR_MAPS_H\n\n#include <map>\n#include \"ast.hpp\"\n\nnamespace Sass {\n\n struct map_"
},
{
"path": "libsass-build/constants.cpp",
"chars": 8299,
"preview": "#include \"sass.hpp\"\n#include \"constants.hpp\"\n\nnamespace Sass {\n namespace Constants {\n\n extern const unsigned long M"
},
{
"path": "libsass-build/constants.hpp",
"chars": 6143,
"preview": "#ifndef SASS_CONSTANTS_H\n#define SASS_CONSTANTS_H\n\nnamespace Sass {\n namespace Constants {\n\n // The maximum call sta"
},
{
"path": "libsass-build/context.cpp",
"chars": 33059,
"preview": "#include \"sass.hpp\"\n#include <string>\n#include <cstdlib>\n#include <cstring>\n#include <iomanip>\n#include <sstream>\n#inclu"
},
{
"path": "libsass-build/context.hpp",
"chars": 4999,
"preview": "#ifndef SASS_CONTEXT_H\n#define SASS_CONTEXT_H\n\n#include <string>\n#include <vector>\n#include <map>\n\n#define BUFFERSIZE 25"
},
{
"path": "libsass-build/cssize.cpp",
"chars": 18607,
"preview": "#include \"sass.hpp\"\n#include <iostream>\n#include <typeinfo>\n#include <vector>\n\n#include \"cssize.hpp\"\n#include \"context.h"
},
{
"path": "libsass-build/cssize.hpp",
"chars": 2432,
"preview": "#ifndef SASS_CSSIZE_H\n#define SASS_CSSIZE_H\n\n#include \"ast.hpp\"\n#include \"context.hpp\"\n#include \"operation.hpp\"\n#include"
},
{
"path": "libsass-build/debug.hpp",
"chars": 814,
"preview": "#ifndef SASS_DEBUG_H\n#define SASS_DEBUG_H\n\n#include <stdint.h>\n\n#ifndef UINT32_MAX\n #define UINT32_MAX 0xffffffffU\n#end"
},
{
"path": "libsass-build/debugger.hpp",
"chars": 41265,
"preview": "#ifndef SASS_DEBUGGER_H\n#define SASS_DEBUGGER_H\n\n#include <string>\n#include <sstream>\n#include \"node.hpp\"\n#include \"ast_"
},
{
"path": "libsass-build/emitter.cpp",
"chars": 7321,
"preview": "#include \"sass.hpp\"\n#include \"util.hpp\"\n#include \"context.hpp\"\n#include \"output.hpp\"\n#include \"emitter.hpp\"\n#include \"ut"
},
{
"path": "libsass-build/emitter.hpp",
"chars": 3174,
"preview": "#ifndef SASS_EMITTER_H\n#define SASS_EMITTER_H\n\n#include <string>\n#include \"sass.hpp\"\n#include \"sass/base.h\"\n#include \"so"
},
{
"path": "libsass-build/environment.cpp",
"chars": 6583,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"environment.hpp\"\n\nnamespace Sass {\n\n template <typename T>\n Environme"
},
{
"path": "libsass-build/environment.hpp",
"chars": 3140,
"preview": "#ifndef SASS_ENVIRONMENT_H\n#define SASS_ENVIRONMENT_H\n\n#include <string>\n#include \"ast_fwd_decl.hpp\"\n#include \"ast_def_m"
},
{
"path": "libsass-build/error_handling.cpp",
"chars": 8106,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"prelexer.hpp\"\n#include \"backtrace.hpp\"\n#include \"error_handling.hpp\"\n\n#"
},
{
"path": "libsass-build/error_handling.hpp",
"chars": 7129,
"preview": "#ifndef SASS_ERROR_HANDLING_H\n#define SASS_ERROR_HANDLING_H\n\n#include <string>\n#include <sstream>\n#include <stdexcept>\n#"
},
{
"path": "libsass-build/eval.cpp",
"chars": 58511,
"preview": "#include \"sass.hpp\"\n#include <cstdlib>\n#include <cmath>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n#inclu"
},
{
"path": "libsass-build/eval.hpp",
"chars": 3582,
"preview": "#ifndef SASS_EVAL_H\n#define SASS_EVAL_H\n\n#include \"ast.hpp\"\n#include \"context.hpp\"\n#include \"listize.hpp\"\n#include \"oper"
},
{
"path": "libsass-build/expand.cpp",
"chars": 27434,
"preview": "#include \"sass.hpp\"\n#include <iostream>\n#include <typeinfo>\n\n#include \"ast.hpp\"\n#include \"expand.hpp\"\n#include \"bind.hpp"
},
{
"path": "libsass-build/expand.hpp",
"chars": 2318,
"preview": "#ifndef SASS_EXPAND_H\n#define SASS_EXPAND_H\n\n#include <vector>\n\n#include \"ast.hpp\"\n#include \"eval.hpp\"\n#include \"operati"
},
{
"path": "libsass-build/extend.cpp",
"chars": 77956,
"preview": "#include \"sass.hpp\"\n#include \"extend.hpp\"\n#include \"context.hpp\"\n#include \"backtrace.hpp\"\n#include \"paths.hpp\"\n#include "
},
{
"path": "libsass-build/extend.hpp",
"chars": 2504,
"preview": "#ifndef SASS_EXTEND_H\n#define SASS_EXTEND_H\n\n#include <string>\n#include <set>\n\n#include \"ast.hpp\"\n#include \"node.hpp\"\n#i"
},
{
"path": "libsass-build/file.cpp",
"chars": 17593,
"preview": "#include \"sass.hpp\"\n#ifdef _WIN32\n# ifdef __MINGW32__\n# ifndef off64_t\n# define off64_t _off64_t /* Workaround for"
},
{
"path": "libsass-build/file.hpp",
"chars": 4057,
"preview": "#ifndef SASS_FILE_H\n#define SASS_FILE_H\n\n#include <string>\n#include <vector>\n\n#include \"sass/context.h\"\n#include \"ast_fw"
},
{
"path": "libsass-build/functions.cpp",
"chars": 81492,
"preview": "#include \"sass.hpp\"\n#include \"functions.hpp\"\n#include \"ast.hpp\"\n#include \"context.hpp\"\n#include \"backtrace.hpp\"\n#include"
},
{
"path": "libsass-build/functions.hpp",
"chars": 5924,
"preview": "#ifndef SASS_FUNCTIONS_H\n#define SASS_FUNCTIONS_H\n\n#include \"listize.hpp\"\n#include \"position.hpp\"\n#include \"environment."
},
{
"path": "libsass-build/include/sass/base.h",
"chars": 2126,
"preview": "#ifndef SASS_BASE_H\n#define SASS_BASE_H\n\n// #define DEBUG_SHARED_PTR\n\n#ifdef _MSC_VER\n #pragma warning(disable : 4503)\n"
},
{
"path": "libsass-build/include/sass/context.h",
"chars": 10428,
"preview": "#ifndef SASS_C_CONTEXT_H\n#define SASS_C_CONTEXT_H\n\n#include <stddef.h>\n#include <stdbool.h>\n#include <sass/base.h>\n#incl"
},
{
"path": "libsass-build/include/sass/functions.h",
"chars": 6632,
"preview": "#ifndef SASS_C_FUNCTIONS_H\n#define SASS_C_FUNCTIONS_H\n\n#include <stddef.h>\n#include <stdbool.h>\n#include <sass/base.h>\n\n"
},
{
"path": "libsass-build/include/sass/values.h",
"chars": 6489,
"preview": "#ifndef SASS_C_VALUES_H\n#define SASS_C_VALUES_H\n\n#include <stddef.h>\n#include <stdbool.h>\n#include <sass/base.h>\n\n#ifdef"
},
{
"path": "libsass-build/include/sass/version.h",
"chars": 198,
"preview": "#ifndef SASS_VERSION_H\n#define SASS_VERSION_H\n\n#ifndef LIBSASS_VERSION\n#define LIBSASS_VERSION \"3.5.5\"\n#endif\n\n#ifndef L"
},
{
"path": "libsass-build/include/sass/version.h.in",
"chars": 210,
"preview": "#ifndef SASS_VERSION_H\n#define SASS_VERSION_H\n\n#ifndef LIBSASS_VERSION\n#define LIBSASS_VERSION \"@PACKAGE_VERSION@\"\n#endi"
},
{
"path": "libsass-build/include/sass.h",
"chars": 234,
"preview": "#ifndef SASS_H\n#define SASS_H\n\n// #define DEBUG 1\n\n// include API headers\n#include <sass/base.h>\n#include <sass/version."
},
{
"path": "libsass-build/include/sass2scss.h",
"chars": 2518,
"preview": "/**\n * sass2scss\n * Licensed under the MIT License\n * Copyright (c) Marcel Greter\n */\n\n#ifndef SASS2SCSS_H\n#define SASS2"
},
{
"path": "libsass-build/inspect.cpp",
"chars": 31216,
"preview": "#include \"sass.hpp\"\n#include <cmath>\n#include <string>\n#include <iostream>\n#include <iomanip>\n#include <stdint.h>\n#inclu"
},
{
"path": "libsass-build/inspect.hpp",
"chars": 3871,
"preview": "#ifndef SASS_INSPECT_H\n#define SASS_INSPECT_H\n\n#include \"position.hpp\"\n#include \"operation.hpp\"\n#include \"emitter.hpp\"\n\n"
},
{
"path": "libsass-build/json.cpp",
"chars": 32467,
"preview": "/*\n Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com)\n All rights reserved.\n\n Permission is hereby gran"
},
{
"path": "libsass-build/json.hpp",
"chars": 3526,
"preview": "/*\n Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com)\n All rights reserved.\n\n Permission is hereby gran"
},
{
"path": "libsass-build/kwd_arg_macros.hpp",
"chars": 514,
"preview": "#ifndef SASS_KWD_ARG_MACROS_H\n#define SASS_KWD_ARG_MACROS_H\n\n// Example usage:\n// KWD_ARG_SET(Args) {\n// KWD_ARG(Args,"
},
{
"path": "libsass-build/lexer.cpp",
"chars": 6244,
"preview": "#include \"sass.hpp\"\n#include <cctype>\n#include <iostream>\n#include <iomanip>\n#include \"lexer.hpp\"\n#include \"constants.hp"
},
{
"path": "libsass-build/lexer.hpp",
"chars": 9484,
"preview": "#ifndef SASS_LEXER_H\n#define SASS_LEXER_H\n\n#include <cstring>\n\nnamespace Sass {\n namespace Prelexer {\n\n //##########"
},
{
"path": "libsass-build/listize.cpp",
"chars": 2344,
"preview": "#include \"sass.hpp\"\n#include <iostream>\n#include <typeinfo>\n#include <string>\n\n#include \"listize.hpp\"\n#include \"context."
},
{
"path": "libsass-build/listize.hpp",
"chars": 646,
"preview": "#ifndef SASS_LISTIZE_H\n#define SASS_LISTIZE_H\n\n#include <vector>\n#include <iostream>\n\n#include \"ast.hpp\"\n#include \"conte"
},
{
"path": "libsass-build/mapping.hpp",
"chars": 361,
"preview": "#ifndef SASS_MAPPING_H\n#define SASS_MAPPING_H\n\n#include \"position.hpp\"\n\nnamespace Sass {\n\n struct Mapping {\n Positio"
},
{
"path": "libsass-build/memory/SharedPtr.cpp",
"chars": 2650,
"preview": "#include \"../sass.hpp\"\n#include <iostream>\n#include <typeinfo>\n\n#include \"SharedPtr.hpp\"\n#include \"../ast_fwd_decl.hpp\"\n"
},
{
"path": "libsass-build/memory/SharedPtr.hpp",
"chars": 4772,
"preview": "#ifndef SASS_MEMORY_SHARED_PTR_H\n#define SASS_MEMORY_SHARED_PTR_H\n\n#include \"sass/base.h\"\n\n#include <vector>\n\nnamespace "
},
{
"path": "libsass-build/node.cpp",
"chars": 10264,
"preview": "#include \"sass.hpp\"\n#include <vector>\n\n#include \"node.hpp\"\n#include \"context.hpp\"\n#include \"parser.hpp\"\n\nnamespace Sass "
},
{
"path": "libsass-build/node.hpp",
"chars": 4416,
"preview": "#ifndef SASS_NODE_H\n#define SASS_NODE_H\n\n#include <deque>\n#include <memory>\n\n#include \"ast.hpp\"\n\n\nnamespace Sass {\n\n\n\n\n "
},
{
"path": "libsass-build/operation.hpp",
"chars": 11143,
"preview": "#ifndef SASS_OPERATION_H\n#define SASS_OPERATION_H\n\n#include \"ast_fwd_decl.hpp\"\n\nnamespace Sass {\n\n template<typename T>"
},
{
"path": "libsass-build/operators.cpp",
"chars": 10313,
"preview": "#include \"sass.hpp\"\n#include \"operators.hpp\"\n\nnamespace Sass {\n\n namespace Operators {\n\n inline double add(double x,"
},
{
"path": "libsass-build/operators.hpp",
"chars": 1336,
"preview": "#ifndef SASS_OPERATORS_H\n#define SASS_OPERATORS_H\n\n#include \"values.hpp\"\n#include \"sass/values.h\"\n\nnamespace Sass {\n\n n"
},
{
"path": "libsass-build/output.cpp",
"chars": 8976,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"output.hpp\"\n\nnamespace Sass {\n\n Output::Output(Sass_Output_Options& op"
},
{
"path": "libsass-build/output.hpp",
"chars": 1285,
"preview": "#ifndef SASS_OUTPUT_H\n#define SASS_OUTPUT_H\n\n#include <string>\n#include <vector>\n\n#include \"util.hpp\"\n#include \"inspect."
},
{
"path": "libsass-build/parser.cpp",
"chars": 109288,
"preview": "#include \"sass.hpp\"\n#include \"parser.hpp\"\n#include \"file.hpp\"\n#include \"inspect.hpp\"\n#include \"constants.hpp\"\n#include \""
},
{
"path": "libsass-build/parser.hpp",
"chars": 14700,
"preview": "#ifndef SASS_PARSER_H\n#define SASS_PARSER_H\n\n#include <string>\n#include <vector>\n\n#include \"ast.hpp\"\n#include \"position."
},
{
"path": "libsass-build/paths.hpp",
"chars": 1608,
"preview": "#ifndef SASS_PATHS_H\n#define SASS_PATHS_H\n\n#include <string>\n#include <vector>\n#include <sstream>\n\n\ntemplate<typename T>"
},
{
"path": "libsass-build/plugins.cpp",
"chars": 6169,
"preview": "#include \"sass.hpp\"\n#include <iostream>\n#include \"output.hpp\"\n#include \"plugins.hpp\"\n\n#ifdef _WIN32\n#include <windows.h>"
},
{
"path": "libsass-build/plugins.hpp",
"chars": 1517,
"preview": "#ifndef SASS_PLUGINS_H\n#define SASS_PLUGINS_H\n\n#include <string>\n#include <vector>\n#include \"utf8_string.hpp\"\n#include \""
},
{
"path": "libsass-build/position.cpp",
"chars": 5191,
"preview": "#include \"sass.hpp\"\n#include \"position.hpp\"\n\nnamespace Sass {\n\n\n Offset::Offset(const char chr)\n : line(chr == '\\n' ? "
},
{
"path": "libsass-build/position.hpp",
"chars": 3825,
"preview": "#ifndef SASS_POSITION_H\n#define SASS_POSITION_H\n\n#include <string>\n#include <cstring>\n// #include <iostream>\n\nnamespace "
},
{
"path": "libsass-build/prelexer.cpp",
"chars": 48857,
"preview": "#include \"sass.hpp\"\n#include <cctype>\n#include <iostream>\n#include <iomanip>\n#include \"util.hpp\"\n#include \"position.hpp\""
},
{
"path": "libsass-build/prelexer.hpp",
"chars": 16436,
"preview": "#ifndef SASS_PRELEXER_H\n#define SASS_PRELEXER_H\n\n#include <cstring>\n#include \"lexer.hpp\"\n\nnamespace Sass {\n // using na"
},
{
"path": "libsass-build/remove_placeholders.cpp",
"chars": 2519,
"preview": "#include \"sass.hpp\"\n#include \"remove_placeholders.hpp\"\n#include \"context.hpp\"\n#include \"inspect.hpp\"\n#include <iostream>"
},
{
"path": "libsass-build/remove_placeholders.hpp",
"chars": 742,
"preview": "#ifndef SASS_REMOVE_PLACEHOLDERS_H\n#define SASS_REMOVE_PLACEHOLDERS_H\n\n#pragma once\n\n#include \"ast.hpp\"\n#include \"operat"
},
{
"path": "libsass-build/sass.cpp",
"chars": 4752,
"preview": "#include \"sass.hpp\"\n#include <cstdlib>\n#include <cstring>\n#include <vector>\n#include <sstream>\n\n#include \"sass.h\"\n#inclu"
},
{
"path": "libsass-build/sass.hpp",
"chars": 3556,
"preview": "// must be the first include in all compile units\n#ifndef SASS_SASS_H\n#define SASS_SASS_H\n\n// undefine extensions macro "
},
{
"path": "libsass-build/sass2scss.cpp",
"chars": 24449,
"preview": "/**\n * sass2scss\n * Licensed under the MIT License\n * Copyright (c) Marcel Greter\n */\n\n#ifdef _MSC_VER\n#define _CRT_SECU"
},
{
"path": "libsass-build/sass_context.cpp",
"chars": 30109,
"preview": "#include \"sass.hpp\"\n#include <cstring>\n#include <stdexcept>\n#include <sstream>\n#include <string>\n#include <vector>\n\n#inc"
},
{
"path": "libsass-build/sass_context.hpp",
"chars": 2799,
"preview": "#ifndef SASS_SASS_CONTEXT_H\n#define SASS_SASS_CONTEXT_H\n\n#include \"sass/base.h\"\n#include \"sass/context.h\"\n#include \"ast_"
},
{
"path": "libsass-build/sass_functions.cpp",
"chars": 8454,
"preview": "#include \"sass.hpp\"\n#include <cstring>\n#include \"util.hpp\"\n#include \"context.hpp\"\n#include \"values.hpp\"\n#include \"sass/f"
},
{
"path": "libsass-build/sass_functions.hpp",
"chars": 975,
"preview": "#ifndef SASS_SASS_FUNCTIONS_H\n#define SASS_SASS_FUNCTIONS_H\n\n#include \"sass.h\"\n#include \"environment.hpp\"\n#include \"func"
},
{
"path": "libsass-build/sass_util.cpp",
"chars": 4111,
"preview": "#include \"sass.hpp\"\n#include \"node.hpp\"\n\nnamespace Sass {\n\n\n /*\n # This is the equivalent of ruby's Sass::Util.paths"
},
{
"path": "libsass-build/sass_util.hpp",
"chars": 7625,
"preview": "#ifndef SASS_SASS_UTIL_H\n#define SASS_SASS_UTIL_H\n\n#include \"ast.hpp\"\n#include \"node.hpp\"\n#include \"debug.hpp\"\n\nnamespac"
},
{
"path": "libsass-build/sass_values.cpp",
"chars": 14839,
"preview": "#include \"sass.hpp\"\n#include <cstdlib>\n#include <cstring>\n#include \"util.hpp\"\n#include \"eval.hpp\"\n#include \"values.hpp\"\n"
},
{
"path": "libsass-build/sass_values.hpp",
"chars": 1403,
"preview": "#ifndef SASS_SASS_VALUES_H\n#define SASS_SASS_VALUES_H\n\n#include \"sass.h\"\n\nstruct Sass_Unknown {\n enum Sass_Tag tag;\n};\n"
},
{
"path": "libsass-build/source_map.cpp",
"chars": 6847,
"preview": "#include \"sass.hpp\"\n#include <string>\n#include <sstream>\n#include <iostream>\n#include <iomanip>\n\n#include \"ast.hpp\"\n#inc"
},
{
"path": "libsass-build/source_map.hpp",
"chars": 1268,
"preview": "#ifndef SASS_SOURCE_MAP_H\n#define SASS_SOURCE_MAP_H\n\n#include <string>\n#include <vector>\n\n#include \"ast_fwd_decl.hpp\"\n#i"
},
{
"path": "libsass-build/subset_map.cpp",
"chars": 1740,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"subset_map.hpp\"\n\nnamespace Sass {\n\n void Subset_Map::put(const Compoun"
},
{
"path": "libsass-build/subset_map.hpp",
"chars": 1680,
"preview": "#ifndef SASS_SUBSET_MAP_H\n#define SASS_SUBSET_MAP_H\n\n#include <map>\n#include <set>\n#include <vector>\n#include <algorithm"
},
{
"path": "libsass-build/to_c.cpp",
"chars": 2144,
"preview": "#include \"sass.hpp\"\n#include \"to_c.hpp\"\n#include \"ast.hpp\"\n\nnamespace Sass {\n\n union Sass_Value* To_C::fallback_impl(AS"
},
{
"path": "libsass-build/to_c.hpp",
"chars": 1062,
"preview": "#ifndef SASS_TO_C_H\n#define SASS_TO_C_H\n\n#include \"ast_fwd_decl.hpp\"\n#include \"operation.hpp\"\n#include \"sass/values.h\"\n\n"
},
{
"path": "libsass-build/to_value.cpp",
"chars": 2499,
"preview": "#include \"sass.hpp\"\n#include \"ast.hpp\"\n#include \"to_value.hpp\"\n\nnamespace Sass {\n\n Value_Ptr To_Value::fallback_impl(AS"
},
{
"path": "libsass-build/to_value.hpp",
"chars": 1162,
"preview": "#ifndef SASS_TO_VALUE_H\n#define SASS_TO_VALUE_H\n\n#include \"operation.hpp\"\n#include \"sass/values.h\"\n#include \"ast_fwd_dec"
}
]
// ... and 25 more files (download for full content)
About this extraction
This page contains the full source code of the wellington/go-libsass GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 225 files (1.4 MB), approximately 372.1k tokens, and a symbol index with 2097 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.