Skip to content

Commit

Permalink
Mark a whole bunch of stuff that shouldn't be publically visible as p…
Browse files Browse the repository at this point in the history
…rivate.
  • Loading branch information
nex3 committed Jan 18, 2010
1 parent 14c4a88 commit 9322af3
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions .yardopts
Expand Up @@ -4,4 +4,5 @@
--default-return ""
--hide-void-return
--protected
--no-private
--no-highlight
1 change: 1 addition & 0 deletions lib/haml/helpers.rb
Expand Up @@ -462,6 +462,7 @@ def haml_tag(name, *rest, &block)
end

# Characters that need to be escaped to HTML entities from user input
# @private
HTML_ESCAPE = { '&'=>'&amp;', '<'=>'&lt;', '>'=>'&gt;', '"'=>'&quot;', "'"=>'&#039;', }

# Returns a copy of `text` with ampersands, angle brackets and quotes
Expand Down
8 changes: 8 additions & 0 deletions lib/haml/html.rb
Expand Up @@ -47,6 +47,7 @@ def parse_text(text, tabs)

# Haml monkeypatches various Hpricot classes
# to add methods for conversion to Haml.
# @private
module Hpricot
# @see Hpricot
module Node
Expand Down Expand Up @@ -102,9 +103,11 @@ def render
end
alias_method :to_haml, :render

# @private
TEXT_REGEXP = /^(\s*).*$/

# @see Hpricot
# @private
class ::Hpricot::Doc
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand All @@ -113,6 +116,7 @@ def to_haml(tabs, options)
end

# @see Hpricot
# @private
class ::Hpricot::XMLDecl
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand All @@ -121,6 +125,7 @@ def to_haml(tabs, options)
end

# @see Hpricot
# @private
class ::Hpricot::CData
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand All @@ -129,6 +134,7 @@ def to_haml(tabs, options)
end

# @see Hpricot
# @private
class ::Hpricot::DocType
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand Down Expand Up @@ -160,6 +166,7 @@ def to_haml(tabs, options)
end

# @see Hpricot
# @private
class ::Hpricot::Comment
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand All @@ -168,6 +175,7 @@ def to_haml(tabs, options)
end

# @see Hpricot
# @private
class ::Hpricot::Elem
# @see Haml::HTML::Node#to_haml
def to_haml(tabs, options)
Expand Down
19 changes: 19 additions & 0 deletions lib/haml/precompiler.rb
Expand Up @@ -8,46 +8,60 @@ module Precompiler
include Haml::Util

# Designates an XHTML/XML element.
# @private
ELEMENT = ?%

# Designates a `<div>` element with the given class.
# @private
DIV_CLASS = ?.

# Designates a `<div>` element with the given id.
# @private
DIV_ID = ?#

# Designates an XHTML/XML comment.
# @private
COMMENT = ?/

# Designates an XHTML doctype or script that is never HTML-escaped.
# @private
DOCTYPE = ?!

# Designates script, the result of which is output.
# @private
SCRIPT = ?=

# Designates script that is always HTML-escaped.
# @private
SANITIZE = ?&

# Designates script, the result of which is flattened and output.
# @private
FLAT_SCRIPT = ?~

# Designates script which is run but not output.
# @private
SILENT_SCRIPT = ?-

# When following SILENT_SCRIPT, designates a comment that is not output.
# @private
SILENT_COMMENT = ?#

# Designates a non-parsed line.
# @private
ESCAPE = ?\\

# Designates a block of filtered text.
# @private
FILTER = ?:

# Designates a non-parsed line. Not actually a character.
# @private
PLAIN_TEXT = -1

# Keeps track of the ASCII values of the characters that begin a
# specially-interpreted line.
# @private
SPECIAL_CHARACTERS = [
ELEMENT,
DIV_CLASS,
Expand All @@ -64,6 +78,7 @@ module Precompiler

# The value of the character that designates that a line is part
# of a multiline string.
# @private
MULTILINE_CHAR_VALUE = ?|

# Regex to match keywords that appear in the middle of a Ruby block
Expand All @@ -79,12 +94,15 @@ module Precompiler
#
# The block is ended after `%p no!`, because `else`
# is a member of this array.
# @private
MID_BLOCK_KEYWORD_REGEX = /^-\s*(#{%w[else elsif rescue ensure when end].join('|')})\b/

# The Regex that matches a Doctype command.
# @private
DOCTYPE_REGEX = /(\d(?:\.\d)?)?[\s]*([a-z]*)/i

# The Regex that matches a literal string or symbol value
# @private
LITERAL_VALUE_REGEX = /:(\w*)|(["'])((?![\\#]|\2).|\\.)*\2/

private
Expand Down Expand Up @@ -124,6 +142,7 @@ def locals_code(names)
end.join(';') + ';'
end

# @private
class Line < Struct.new(:text, :unstripped, :full, :index, :precompiler, :eod)
alias_method :eod?, :eod

Expand Down
12 changes: 12 additions & 0 deletions lib/sass/engine.rb
Expand Up @@ -76,45 +76,57 @@ def comment?
end

# The character that begins a CSS property.
# @private
PROPERTY_CHAR = ?:

# The character that designates that
# a property should be assigned to a SassScript expression.
# @private
SCRIPT_CHAR = ?=

# The character that designates the beginning of a comment,
# either Sass or CSS.
# @private
COMMENT_CHAR = ?/

# The character that follows the general COMMENT_CHAR and designates a Sass comment,
# which is not output as a CSS comment.
# @private
SASS_COMMENT_CHAR = ?/

# The character that follows the general COMMENT_CHAR and designates a CSS comment,
# which is embedded in the CSS document.
# @private
CSS_COMMENT_CHAR = ?*

# The character used to denote a compiler directive.
# @private
DIRECTIVE_CHAR = ?@

# Designates a non-parsed rule.
# @private
ESCAPE_CHAR = ?\\

# Designates block as mixin definition rather than CSS rules to output
# @private
MIXIN_DEFINITION_CHAR = ?=

# Includes named mixin declared using MIXIN_DEFINITION_CHAR
# @private
MIXIN_INCLUDE_CHAR = ?+

# The regex that matches properties of the form `name: prop`.
# @private
PROPERTY_NEW_MATCHER = /^[^\s:"\[]+\s*[=:](\s|$)/

# The regex that matches and extracts data from
# properties of the form `name: prop`.
# @private
PROPERTY_NEW = /^([^\s=:"]+)(\s*=|:)(?:\s+|$)(.*)/

# The regex that matches and extracts data from
# properties of the form `:name prop`.
# @private
PROPERTY_OLD = /^:([^\s=:"]+)\s*(=?)(?:\s+|$)(.*)/

# The default options for Sass::Engine.
Expand Down
3 changes: 3 additions & 0 deletions lib/sass/script.rb
Expand Up @@ -13,12 +13,15 @@ module Sass
# This module contains code that handles the parsing and evaluation of SassScript.
module Script
# The character that begins a variable.
# @private
VARIABLE_CHAR = ?!

# The regular expression used to parse variables.
# @private
MATCH = /^!([a-zA-Z_]\w*)\s*((?:\|\|)?=)\s*(.+)/

# The regular expression used to validate variables without matching.
# @private
VALIDATE = /^![a-zA-Z_]\w*$/

# Parses and evaluates a string of SassScript.
Expand Down
2 changes: 2 additions & 0 deletions lib/sass/script/color.rb
Expand Up @@ -6,6 +6,7 @@ class Color < Literal
class << self; include Haml::Util; end

# A hash from color names to `[red, green, blue]` value arrays.
# @private
HTML4_COLORS = map_vals({
'black' => 0x000000,
'silver' => 0xc0c0c0,
Expand All @@ -25,6 +26,7 @@ class << self; include Haml::Util; end
'aqua' => 0x00ffff
}) {|color| (0..2).map {|n| color >> (n << 3) & 0xff}.reverse}
# A hash from `[red, green, blue]` value arrays to color names.
# @private
HTML4_COLORS_REVERSE = map_hash(HTML4_COLORS) {|k, v| [v, k]}

# Creates a new color from RGB components.
Expand Down
3 changes: 3 additions & 0 deletions lib/sass/script/lexer.rb
Expand Up @@ -22,6 +22,7 @@ class Lexer
Token = Struct.new(:type, :value, :line, :offset)

# A hash from operator strings to the corresponding token types.
# @private
OPERATORS = {
'+' => :plus,
'-' => :minus,
Expand All @@ -47,9 +48,11 @@ class Lexer

# A list of operator strings ordered with longer names first
# so that `>` and `<` don't clobber `>=` and `<=`.
# @private
OP_NAMES = OPERATORS.keys.sort_by {|o| -o.size}

# A hash of regular expressions that are used for tokenizing.
# @private
REGULAR_EXPRESSIONS = {
:whitespace => /\s*/,
:variable => /!(\w+)/,
Expand Down
2 changes: 2 additions & 0 deletions lib/sass/script/number.rb
Expand Up @@ -351,7 +351,9 @@ def normalize!
end

# A hash of unit names to their index in the conversion table
# @private
CONVERTABLE_UNITS = {"in" => 0, "cm" => 1, "pc" => 2, "mm" => 3, "pt" => 4}
# @private
CONVERSION_TABLE = [[ 1, 2.54, 6, 25.4, 72 ], # in
[ nil, 1, 2.36220473, 10, 28.3464567], # cm
[ nil, nil, 1, 4.23333333, 12 ], # pc
Expand Down
1 change: 1 addition & 0 deletions lib/sass/tree/rule_node.rb
Expand Up @@ -6,6 +6,7 @@ module Sass::Tree
# @see Sass::Tree
class RuleNode < Node
# The character used to include the parent selector
# @private
PARENT = '&'

# The CSS selectors for this rule.
Expand Down

0 comments on commit 9322af3

Please sign in to comment.