jasy.style.parse package

Submodules

jasy.style.parse.Node module

class jasy.style.parse.Node.Node(tokenizer=None, type=None, args=[])[source]

Bases: jasy.parse.AbstractNode.AbstractNode

assignOp
comments
condition
dynamic
elsePart
end
fileId
initializer
line
name
names
noscope
params
parent
parenthesized
quote
rel
rules
scope
selector
start
statement
statements
thenPart
token
tokenizer
type
unit
value
variables
vendor

jasy.style.parse.Parser module

jasy.style.parse.Parser.AddExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.AndExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.ArgumentList(tokenizer, staticContext)[source]
jasy.style.parse.Parser.AssignExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Block(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Charset(tokenizer, staticContext)[source]
jasy.style.parse.Parser.CssArgumentList(tokenizer, staticContext)[source]
jasy.style.parse.Parser.EqualityExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Expression(tokenizer, staticContext)[source]

Top-down expression parser for stylestyles.

jasy.style.parse.Parser.ExpressionArgument(tokenizer, staticContext)[source]
jasy.style.parse.Parser.FontFace(tokenizer, staticContext)[source]
jasy.style.parse.Parser.KeyFrames(tokenizer, staticContext)[source]

Supports e.g.:

@keyframes fade{
from, 10%{
background-color: #000000;

}

100%{
background-color: #FFFFFF;

}

}

jasy.style.parse.Parser.Media(tokenizer, staticContext)[source]

Supports e.g.:

@media print{
body{
background-color: #000000;

}

}

@media handheld, tv{
body{
background-color: yellow;

}

}

@media screen and (max-width: 300px) {
body{
background-color: orange;

}

}

jasy.style.parse.Parser.MemberExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.MultiplyExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.OrExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Page(tokenizer, staticContext)[source]

Supports e.g.:

@page{
margin: 1cm;

}

@page :first{
margin: 5cm 2cm;

}

jasy.style.parse.Parser.ParenExpression(tokenizer, staticContext)[source]

An expression in parens.

Sometimes to force priority of math operations etc.

exception jasy.style.parse.Parser.ParseError(message, tokenizer)[source]

Bases: Exception

jasy.style.parse.Parser.PrimaryExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Property(tokenizer, staticContext)[source]

Parses all CSS properties e.g.

  • background: red
  • font: 12px bold Arial;
jasy.style.parse.Parser.RawArgument(tokenizer, staticContext)[source]
jasy.style.parse.Parser.RelationalExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.Root(tokenizer, staticContext)[source]

Supports e.g.:

h1{

font-size: 20px;

@root html.desktop &{
font-size: 30px;

}

}

.date{

color: black; background: white;

@root{
&__dialog{
position: absolute;

}

}

}

jasy.style.parse.Parser.Selector(tokenizer, staticContext)[source]

CSS selector parser e.g.

h1 .infobox #header h1::after h2:first-child

jasy.style.parse.Parser.Sheet(tokenizer, staticContext)[source]

Parses the toplevel and rule bodies.

jasy.style.parse.Parser.Statement(tokenizer, staticContext)[source]

Parses a Statement.

jasy.style.parse.Parser.Statements(tokenizer, staticContext)[source]

Parses a list of Statements.

class jasy.style.parse.Parser.StaticContext[source]

Bases: object

jasy.style.parse.Parser.Supports(tokenizer, staticContext)[source]
jasy.style.parse.Parser.UnaryExpression(tokenizer, staticContext)[source]
jasy.style.parse.Parser.UrlArgumentList(tokenizer, staticContext)[source]
jasy.style.parse.Parser.ValueExpression(tokenizer, staticContext)[source]

Top-down expression parser for rule values in stylestyles.

jasy.style.parse.Parser.Variable(tokenizer, staticContext)[source]

All kind of variable usage:

  • variable access
  • variable declaration
  • mixin declaration
  • mixin call
jasy.style.parse.Parser.addComments(currNode, prevNode, comments)[source]
jasy.style.parse.Parser.parse(source, fileId=None, line=1)[source]
jasy.style.parse.Parser.parseExpression(source, fileId=None, line=1)[source]

jasy.style.parse.ScopeScanner module

jasy.style.parse.ScopeScanner.scan(tree)[source]

Scans the given tree and attaches variable data instances (core/ScopeData.py) to every scope (aka function).

This data is being stored independently from the real tree so that if you modifiy the tree the data is not automatically updated. This means that every time you modify the tree heavily, it might make sense to re-execute this method to bring it in sync to the current tree structure.

Module contents