Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merging conflicting changes

  • Loading branch information...
commit d75600605cad3b0464a1587fb8e4df8a25329ce0 1 parent e5d4223
@Aerilius Aerilius authored
View
12 .gitattributes
@@ -0,0 +1,12 @@
+# Ensure that line endings are dealt with properly across platforms.
+# https://help.github.com/articles/dealing-with-line-endings
+
+# text
+# "This setting tells git to always normalize the files specified. When
+# committed they are stored with LF, on checkout they are converted to the OS's
+# native line endings."
+
+*.rb text
+*.js text
+*.css text
+*.html text
View
4 src/sketchup-developer-tools/css/console.css
@@ -467,7 +467,7 @@ html, body {
}
.button:hover {
- background: #f8f5ed; /* Old browsers */
+ background: #fbf8ef; /* Old browsers */
background: -moz-linear-gradient(top, #fbf8ef 0%, #dcd8d0 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fbf8ef), color-stop(100%,#dcd8d0)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fbf8ef 0%,#dcd8d0 100%); /* Chrome10+,Safari5.1+ */
@@ -478,7 +478,7 @@ html, body {
}
.button:active {
- background: #f8f5ed; /* Old browsers */
+ background: #d3cfc8; /* Old browsers */
background: -moz-linear-gradient(top, #d3cfc8 0%, #e7e4dc 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d3cfc8), color-stop(100%,#e7e4dc)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #d3cfc8 0%,#e7e4dc 100%); /* Chrome10+,Safari5.1+ */
View
BIN  src/sketchup-developer-tools/css/icon_error.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  src/sketchup-developer-tools/css/icon_input.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  src/sketchup-developer-tools/css/icon_puts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  src/sketchup-developer-tools/css/icon_result.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  src/sketchup-developer-tools/css/icon_warn.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
544 src/sketchup-developer-tools/highlight/classref.txt
@@ -0,0 +1,544 @@
+This is a full list of available classes corresponding to languages'
+syntactic structures. The parentheses after language name contain identifiers
+used as class names in `<code>` element.
+
+Python ("python"):
+
+ keyword keyword
+ built_in built-in objects (None, False, True and Ellipsis)
+ number number
+ string string (of any type)
+ comment comment
+ decorator @-decorator for functions
+ function function header "def some_name(...):"
+ class class header "class SomeName(...):"
+ title name of a function or a class inside a header
+ params everything inside parentheses in a function's or class' header
+
+Python profiler results ("profile"):
+
+ number number
+ string string
+ builtin builtin function entry
+ filename filename in an entry
+ summary profiling summary
+ header header of table of results
+ keyword column header
+ function function name in an entry (including parentheses)
+ title actual name of a function in an entry (excluding parentheses)
+
+Ruby ("ruby"):
+
+ keyword keyword
+ string string
+ subst in-string substitution (#{...})
+ comment comment
+ yardoctag YARD tag
+ function function header "def some_name(...):"
+ class class header "class SomeName(...):"
+ title name of a function or a class inside a header
+ parent name of a parent class
+ symbol symbol
+ instancevar instance variable
+
+Perl ("perl"):
+
+ keyword keyword
+ comment comment
+ number number
+ string string
+ regexp regular expression
+ sub subroutine header (from "sub" till "{")
+ variable variable starting with "$", "%", "@"
+ operator operator
+ pod plain old doc
+
+PHP ("php"):
+
+ keyword keyword
+ number number
+ string string (of any type)
+ comment comment
+ phpdoc phpdoc params in comments
+ variable variable starting with "$"
+ preprocessor preprocessor marks: "<?php" and "?>"
+
+Scala ("scala"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ annotaion annotation
+ javadoc javadoc comment
+ javadoctag @-tag in javadoc
+ class class header
+ title class name inside a header
+ params everything in parentheses inside a class header
+ inheritance keywords "extends" and "with" inside class header
+
+Go language ("go"):
+ comment comment
+ string string constant
+ number number
+ keyword language keywords
+ constant true false nil iota
+ typename built-in plain types (int, string etc.)
+ built_in built-in functions
+
+XML ("xml"):
+
+ tag any tag from "<" till ">"
+ comment comment
+ pi processing instruction (<? ... ?>)
+ cdata CDATA section
+ attribute attribute
+ value attribute's value
+
+HTML ("html"):
+
+ keyword HTML tag
+ tag any tag from "<" till ">"
+ comment comment
+ doctype <!DOCTYPE ... > declaration
+ attribute tag's attribute with or without value
+ value attribute's value
+
+CSS ("css"):
+
+ tag HTML tag in selectors
+ id #some_name in selectors
+ class .some_name in selectors
+ at_rule @-rule till first "{" or ";"
+ attr_selector attribute selector (square brackets in a[href^=http://])
+ pseudo pseudo classes and elemens (:after, ::after etc.)
+ comment comment
+ rules everything from "{" till "}"
+ property property name inside a rule
+ value property value inside a rule, from ":" till ";" or
+ till the end of rule block
+ number number within a value
+ string string within a value
+ hexcolor hex color (#FFFFFF) within a value
+ function CSS function within a value
+ params everything between "(" and ")" within a function
+ important "!important" symbol
+
+Markdown ("markdown"):
+
+ header header
+ bullet list bullet
+ emphasis emphasis
+ strong strong emphasis
+ blockquote blockquote
+ code code
+ horizontal_rule horizontal rule
+ link_label link label
+ link_url link url
+
+Django ("django"):
+
+ keyword HTML tag in HTML, default tags and default filters in templates
+ tag any tag from "<" till ">"
+ comment comment
+ doctype <!DOCTYPE ... > declaration
+ attribute tag's attribute with or withou value
+ value attribute's value
+ template_tag template tag {% .. %}
+ variable template variable {{ .. }}
+ template_comment template comment, both {# .. #} and {% comment %}
+ filter filter from "|" till the next filter or the end of tag
+ argument filter argument
+
+JSON ("json"):
+
+ number number
+ literal "true", "false" and "null"
+ string string value
+ attribute name of an object property
+ value value of an object property
+
+JavaScript ("javascript"):
+
+ keyword keyword
+ comment comment
+ number number
+ literal special literal: "true", "false" and "null"
+ string string
+ regexp regular expression
+ function header of a function
+ title name of a function inside a header
+ params parentheses and everything inside them in a function's header
+
+CoffeeScript ("coffeescript"):
+
+ keyword keyword
+ comment comment
+ number number
+ literal special literal: "true", "false" and "null"
+ string string
+ regexp regular expression
+ function header of a function
+ title name of a function variable inside a header
+ params parentheses and everything inside them in a function's header
+
+ActionScript ("actionscript"):
+
+ comment comment
+ string string
+ number number
+ keyword keywords
+ literal literal
+ reserved reserved keyword
+ title name of declaration (package, class or function)
+ preprocessor preprocessor directive (import, include)
+ type type of returned value (for functions)
+ package package (named or not)
+ class class/interface
+ function function
+ param params of function
+ rest_arg rest argument of function
+
+VBScript ("vbscript"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ built_in built-in function
+
+HTTP ("http"):
+
+ request first line of a request
+ status first line of a response
+ attribute header name
+ string header value or query string in a request line
+ number status code
+
+Lua ("lua"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ built_in built-in operator
+ function header of a function
+ title name of a function inside a header
+ params everything inside parentheses in a function's header
+ long_brackets multiline string in [=[ .. ]=]
+
+Delphi ("delphi"):
+
+ keyword keyword
+ comment comment (of any type)
+ number number
+ string string
+ function header of a function, procedure, constructor and destructor
+ title name of a function, procedure, constructor or destructor
+ inside a header
+ params everything inside parentheses in a function's header
+ class class' body from "= class" till "end;"
+
+Java ("java"):
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ annotaion annotation
+ javadoc javadoc comment
+ class class header from "class" till "{"
+ title class name inside a header
+ params everything in parentheses inside a class header
+ inheritance keywords "extends" and "implements" inside class header
+
+C++ ("cpp"):
+
+ keyword keyword
+ number number
+ string string and character
+ comment comment
+ preprocessor preprocessor directive
+ stl_container instantiation of STL containers ("vector<...>")
+
+Objective C ("objectivec"):
+ keyword keyword
+ built_in Cocoa/Cocoa Touch constants and classes
+ number number
+ string string
+ comment comment
+ preprocessor preprocessor directive
+ class interface/implementation, protocol and forward class declaration
+ variable properties and struct accesors
+
+Vala ("vala"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ class class definitions
+ title in class definition
+ constant ALL_UPPER_CASE
+
+C# ("cs"):
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ xmlDocTag xmldoc tag ("///", "<!--", "-->", "<..>")
+
+D language ("d"):
+
+ comment comment
+ string string constant
+ number number
+ keyword language keywords (including @attributes)
+ constant true false null
+ built_in built-in plain types (int, string etc.)
+
+RenderMan RSL ("rsl"):
+
+ keyword keyword
+ number number
+ string string (including @"..")
+ comment comment
+ preprocessor preprocessor directive
+ shader sahder keywords
+ shading shading keywords
+ built_in built-in function
+
+RenderMan RIB ("rib"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ commands command
+
+Maya Embedded Language ("mel"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ variable variable
+
+SQL ("sql"):
+
+ keyword keyword (mostly SQL'92 and SQL'99)
+ number number
+ string string (of any type: "..", '..', `..`)
+ comment comment
+ aggregate aggregate function
+
+Smalltalk ("smalltalk"):
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ symbol symbol
+ array array
+ class name of a class
+ char char
+ localvars block of local variables
+
+Lisp ("lisp"):
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ variable variable
+ literal b, t and nil
+ list non-quoted list
+ title first symbol in a non-quoted list
+ body remainder of the non-quoted list
+ quoted quoted list, both "(quote .. )" and "'(..)"
+
+Ini ("ini"):
+
+ title title of a section
+ value value of a setting of any type
+ string string
+ number number
+ keyword boolean value keyword
+
+Apache ("apache"):
+
+ keyword keyword
+ number number
+ comment commment
+ literal On and Off
+ sqbracket variables in rewrites "%{..}"
+ cbracket options in rewrites "[..]"
+ tag begin and end of a configuration section
+
+Nginx ("nginx"):
+
+ title directive title
+ string string
+ number number
+ comment comment
+ built_in built-in constant
+ variable $-variable
+ regexp regexp
+
+Diff ("diff"):
+
+ header file header
+ chunk chunk header within a file
+ addition added lines
+ deletion deleted lines
+ change changed lines
+
+DOS ("dos"):
+
+ keyword keyword
+ flow batch control keyword
+ stream DOS special files ("con", "prn", ...)
+ winutils some commands (see dos.js specifically)
+ envvar environment variables
+
+Bash ("bash"):
+
+ keyword keyword
+ string string
+ number number
+ comment comment
+ literal special literal: "true" и "false"
+ variable variable
+ shebang script interpreter header
+
+CMake ("cmake")
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ envvar $-variable
+
+Axapta ("axapta"):
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ class class header from "class" till "{"
+ title class name inside a header
+ params everything in parentheses inside a class header
+ inheritance keywords "extends" and "implements" inside class header
+ preprocessor preprocessor directive
+
+1C ("1c"):
+
+ keyword keyword
+ number number
+ date date
+ string string
+ comment commment
+ function header of function or procudure
+ title function name inside a header
+ params everything in parentheses inside a function header
+ preprocessor preprocessor directive
+
+AVR assembler ("avrasm"):
+
+ keyword keyword
+ built_in pre-defined register
+ number number
+ string string
+ comment commment
+ label label
+ preprocessor preprocessor directive
+ localvars substitution in .macro
+
+VHDL ("vhdl")
+
+ keyword keyword
+ number number
+ string string
+ comment commment
+ literal signal logical value
+ typename typename
+ attribute signal attribute
+
+Parser3 ("parser3"):
+
+ keyword keyword
+ number number
+ comment commment
+ variable variable starting with "$"
+ preprocessor preprocessor directive
+ title user-defined name starting with "@"
+
+TeX ("tex"):
+
+ comment comment
+ number number
+ command command
+ parameter parameter
+ formula formula
+ special special symbol
+
+Haskell ("haskell"):
+
+ keyword keyword
+ number number
+ string string
+ comment comment
+ class type classes and other data types
+ title function name
+ type type class name
+ typedef definition of types (type, newtype, data)
+
+Erlang ("erlang"):
+
+ comment comment
+ string string
+ number number
+ keyword keyword
+ record_name record access (#record_name)
+ title name of declaration function
+ variable variable (starts with capital letter or with _)
+ pp.keywords module's attribute (-attribute)
+ function_name atom or atom:atom in case of function call
+
+Rust ("rust"):
+
+ comment comment
+ string string
+ number number
+ keyword keyword
+ title name of declaration
+ preprocessor preprocessor directive
+
+Matlab ("matlab"):
+
+ comment comment
+ string string
+ number number
+ keyword keyword
+ title function name
+ function function
+ param params of function
+
+R ("r"):
+
+ comment comment
+ string string constant
+ number number
+ keyword language keywords (function, if) plus "structural"
+ functions (attach, require, setClass)
+ literal special literal: TRUE, FALSE, NULL, NA, etc.
+
+OpenGL Shading Language ("glsl"):
+
+ comment comment
+ number number
+ preprocessor preprocessor directive
+ keyword keyword
+ built_in GLSL built-in functions and variables
+ literal true false
View
126 src/sketchup-developer-tools/highlight/github.css
@@ -0,0 +1,126 @@
+/*
+
+github.com style (c) Vasily Polovnyov <vast@whiteants.net>
+
+*/
+
+pre code {
+ display: block;
+ color: #333;
+}
+
+pre .comment,
+pre .template_comment,
+pre .diff .header,
+pre .javadoc {
+ color: #998;
+ font-style: italic
+}
+
+pre .keyword,
+pre .css .rule .keyword,
+pre .winutils,
+pre .javascript .title,
+pre .nginx .title,
+pre .subst,
+pre .request,
+pre .status {
+ color: #333;
+ font-weight: bold
+}
+
+pre .number,
+pre .hexcolor,
+pre .ruby .constant {
+ color: #099;
+}
+
+pre .string,
+pre .tag .value,
+pre .phpdoc,
+pre .tex .formula {
+ color: #d14
+}
+
+pre .title,
+pre .id {
+ color: #900;
+ font-weight: bold
+}
+
+pre .javascript .title,
+pre .lisp .title,
+pre .clojure .title,
+pre .subst {
+ font-weight: normal
+}
+
+pre .class .title,
+pre .haskell .type,
+pre .vhdl .literal,
+pre .tex .command {
+ color: #458;
+ font-weight: bold
+}
+
+pre .tag,
+pre .tag .title,
+pre .rules .property,
+pre .django .tag .keyword {
+ color: #000080;
+ font-weight: normal
+}
+
+pre .attribute,
+pre .variable,
+pre .lisp .body {
+ color: #008080
+}
+
+pre .regexp {
+ color: #009926
+}
+
+pre .class {
+ color: #458;
+ font-weight: bold
+}
+
+pre .symbol,
+pre .ruby .symbol .string,
+pre .lisp .keyword,
+pre .tex .special,
+pre .prompt {
+ color: #990073
+}
+
+pre .built_in,
+pre .lisp .title,
+pre .clojure .built_in {
+ color: #0086b3
+}
+
+pre .preprocessor,
+pre .pi,
+pre .doctype,
+pre .shebang,
+pre .cdata {
+ color: #999;
+ font-weight: bold
+}
+
+pre .deletion {
+ background: #fdd
+}
+
+pre .addition {
+ background: #dfd
+}
+
+pre .diff .change {
+ background: #0086b3
+}
+
+pre .chunk {
+ color: #aaa
+}
View
1  src/sketchup-developer-tools/highlight/highlight.pack.js
@@ -0,0 +1 @@
+var hljs=new function(){function m(p){return p.replace(/&/gm,"&amp;").replace(/</gm,"&lt;")}function f(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function b(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function h(t,s){var p="";for(var r=0;r<t.childNodes.length;r++){if(t.childNodes[r].nodeType==3){var q=t.childNodes[r].nodeValue;if(s){q=q.replace(/\n/g,"")}p+=q}else{if(t.childNodes[r].nodeName=="BR"){p+="\n"}else{p+=h(t.childNodes[r])}}}if(/MSIE [678]/.test(navigator.userAgent)){p=p.replace(/\r/g,"\n")}return p}function a(s){var r=s.className.split(/\s+/);r=r.concat(s.parentNode.className.split(/\s+/));for(var q=0;q<r.length;q++){var p=r[q].replace(/^language-/,"");if(e[p]||p=="no-highlight"){return p}}}function c(r){var p=[];(function q(t,u){for(var s=0;s<t.childNodes.length;s++){if(t.childNodes[s].nodeType==3){u+=t.childNodes[s].nodeValue.length}else{if(t.childNodes[s].nodeName=="BR"){u+=1}else{if(t.childNodes[s].nodeType==1){p.push({event:"start",offset:u,node:t.childNodes[s]});u=q(t.childNodes[s],u);p.push({event:"stop",offset:u,node:t.childNodes[s]})}}}}return u})(r,0);return p}function k(y,w,x){var q=0;var z="";var s=[];function u(){if(y.length&&w.length){if(y[0].offset!=w[0].offset){return(y[0].offset<w[0].offset)?y:w}else{return w[0].event=="start"?y:w}}else{return y.length?y:w}}function t(D){var A="<"+D.nodeName.toLowerCase();for(var B=0;B<D.attributes.length;B++){var C=D.attributes[B];A+=" "+C.nodeName.toLowerCase();if(C.value!==undefined&&C.value!==false&&C.value!==null){A+='="'+m(C.value)+'"'}}return A+">"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);s.splice(r,1);while(r<s.length){z+=t(s[r]);r++}}}}return z+m(x.substr(q))}function j(){function q(w,y,u){if(w.compiled){return}var s=[];if(w.k){var r={};function x(D,C){var A=C.split(" ");for(var z=0;z<A.length;z++){var B=A[z].split("|");r[B[0]]=[D,B[1]?Number(B[1]):1];s.push(B[0])}}w.lR=f(y,w.l||hljs.IR,true);if(typeof w.k=="string"){x("keyword",w.k)}else{for(var v in w.k){if(!w.k.hasOwnProperty(v)){continue}x(v,w.k[v])}}w.k=r}if(!u){if(w.bWK){w.b="\\b("+s.join("|")+")\\s"}w.bR=f(y,w.b?w.b:"\\B|\\b");if(!w.e&&!w.eW){w.e="\\B|\\b"}if(w.e){w.eR=f(y,w.e)}}if(w.i){w.iR=f(y,w.i)}if(w.r===undefined){w.r=1}if(!w.c){w.c=[]}w.compiled=true;for(var t=0;t<w.c.length;t++){if(w.c[t]=="self"){w.c[t]=w}q(w.c[t],y,false)}if(w.starts){q(w.starts,y,false)}}for(var p in e){if(!e.hasOwnProperty(p)){continue}q(e[p].dM,e[p],true)}}function d(D,E){if(!j.called){j();j.called=true}function s(r,O){for(var N=0;N<O.c.length;N++){var M=O.c[N].bR.exec(r);if(M&&M.index==0){return O.c[N]}}}function w(M,r){if(p[M].e&&p[M].eR.test(r)){return 1}if(p[M].eW){var N=w(M-1,r);return N?N+1:0}return 0}function x(r,M){return M.i&&M.iR.test(r)}function L(O,P){var N=[];for(var M=0;M<O.c.length;M++){N.push(O.c[M].b)}var r=p.length-1;do{if(p[r].e){N.push(p[r].e)}r--}while(p[r+1].eW);if(O.i){N.push(O.i)}return N.length?f(P,N.join("|"),true):null}function q(N,M){var O=p[p.length-1];if(O.t===undefined){O.t=L(O,F)}var r;if(O.t){O.t.lastIndex=M;r=O.t.exec(N)}return r?[N.substr(M,r.index-M),r[0],false]:[N.substr(M),"",true]}function A(O,r){var M=F.cI?r[0].toLowerCase():r[0];var N=O.k[M];if(N&&N instanceof Array){return N}return false}function G(M,Q){M=m(M);if(!Q.k){return M}var r="";var P=0;Q.lR.lastIndex=0;var N=Q.lR.exec(M);while(N){r+=M.substr(P,N.index-P);var O=A(Q,N);if(O){y+=O[1];r+='<span class="'+O[0]+'">'+N[0]+"</span>"}else{r+=N[0]}P=Q.lR.lastIndex;N=Q.lR.exec(M)}return r+M.substr(P)}function B(M,N){var r;if(N.sL==""){r=g(M)}else{r=d(N.sL,M)}if(N.r>0){y+=r.keyword_count;C+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function K(r,M){if(M.sL&&e[M.sL]||M.sL==""){return B(r,M)}else{return G(r,M)}}function J(N,r){var M=N.cN?'<span class="'+N.cN+'">':"";if(N.rB){z+=M;N.buffer=""}else{if(N.eB){z+=m(r)+M;N.buffer=""}else{z+=M;N.buffer=r}}p.push(N);C+=N.r}function H(O,N,R){var S=p[p.length-1];if(R){z+=K(S.buffer+O,S);return false}var Q=s(N,S);if(Q){z+=K(S.buffer+O,S);J(Q,N);return Q.rB}var M=w(p.length-1,N);if(M){var P=S.cN?"</span>":"";if(S.rE){z+=K(S.buffer+O,S)+P}else{if(S.eE){z+=K(S.buffer+O,S)+P+m(N)}else{z+=K(S.buffer+O+N,S)+P}}while(M>1){P=p[p.length-2].cN?"</span>":"";z+=P;M--;p.length--}var r=p[p.length-1];p.length--;p[p.length-1].buffer="";if(r.starts){J(r.starts,"")}return S.rE}if(x(N,S)){throw"Illegal"}}var F=e[D];var p=[F.dM];var C=0;var y=0;var z="";try{var t,v=0;F.dM.buffer="";do{t=q(E,v);var u=H(t[0],t[1],t[2]);v+=t[0].length;if(!u){v+=t[1].length}}while(!t[2]);return{r:C,keyword_count:y,value:z,language:D}}catch(I){if(I=="Illegal"){return{r:0,keyword_count:0,value:m(E)}}else{throw I}}}function g(t){var p={keyword_count:0,r:0,value:m(t)};var r=p;for(var q in e){if(!e.hasOwnProperty(q)){continue}var s=d(q,t);s.language=q;if(s.keyword_count+s.r>r.keyword_count+r.r){r=s}if(s.keyword_count+s.r>p.keyword_count+p.r){r=p;p=s}}if(r.language){p.second_best=r}return p}function i(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function n(t,w,r){var x=h(t,r);var v=a(t);var y,s;if(v=="no-highlight"){return}if(v){y=d(v,x)}else{y=g(x);v=y.language}var q=c(t);if(q.length){s=document.createElement("pre");s.innerHTML=y.value;y.value=k(q,c(s),x)}y.value=i(y.value,w,r);var u=t.className;if(!u.match("(\\s|^)(language-)?"+v+"(\\s|$)")){u=u?(u+" "+v):v}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){s=t.parentNode;var p=document.createElement("div");p.innerHTML="<pre><code>"+y.value+"</code></pre>";t=p.firstChild.firstChild;p.firstChild.cN=s.cN;s.parentNode.replaceChild(p.firstChild,s)}else{t.innerHTML=y.value}t.className=u;t.result={language:v,kw:y.keyword_count,re:y.r};if(y.second_best){t.second_best={language:y.second_best.language,kw:y.second_best.keyword_count,re:y.second_best.r}}}function o(){if(o.called){return}o.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=b(r[p]);if(q){n(q,hljs.tabReplace)}}}function l(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",o,false);window.addEventListener("load",o,false)}else{if(window.attachEvent){window.attachEvent("onload",o)}else{window.onload=o}}}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=n;this.initHighlighting=o;this.initHighlightingOnLoad=l;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(r,s){var p={};for(var q in r){p[q]=r[q]}if(s){for(var q in s){p[q]=s[q]}}return p}}();hljs.LANGUAGES.ruby=function(e){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var k="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var g={keyword:"and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or def",keymethods:"__id__ __send__ abort abs all? allocate ancestors any? arity assoc at at_exit autoload autoload? between? binding binmode block_given? call callcc caller capitalize capitalize! casecmp catch ceil center chomp chomp! chop chop! chr class class_eval class_variable_defined? class_variables clear clone close close_read close_write closed? coerce collect collect! compact compact! concat const_defined? const_get const_missing const_set constants count crypt default default_proc delete delete! delete_at delete_if detect display div divmod downcase downcase! downto dump dup each each_byte each_index each_key each_line each_pair each_value each_with_index empty? entries eof eof? eql? equal? eval exec exit exit! extend fail fcntl fetch fileno fill find find_all first flatten flatten! floor flush for_fd foreach fork format freeze frozen? fsync getc gets global_variables grep gsub gsub! has_key? has_value? hash hex id include include? included_modules index indexes indices induced_from inject insert inspect instance_eval instance_method instance_methods instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables integer? intern invert ioctl is_a? isatty iterator? join key? keys kind_of? lambda last length lineno ljust load local_variables loop lstrip lstrip! map map! match max member? merge merge! method method_defined? method_missing methods min module_eval modulo name nesting new next next! nil? nitems nonzero? object_id oct open pack partition pid pipe pop popen pos prec prec_f prec_i print printf private_class_method private_instance_methods private_method_defined? private_methods proc protected_instance_methods protected_method_defined? protected_methods public_class_method public_instance_methods public_method_defined? public_methods push putc puts quo raise rand rassoc read read_nonblock readchar readline readlines readpartial rehash reject reject! remainder reopen replace require respond_to? reverse reverse! reverse_each rewind rindex rjust round rstrip rstrip! scan seek select send set_trace_func shift singleton_method_added singleton_methods size sleep slice slice! sort sort! sort_by split sprintf squeeze squeeze! srand stat step store strip strip! sub sub! succ succ! sum superclass swapcase swapcase! sync syscall sysopen sysread sysseek system syswrite taint tainted? tell test throw times to_a to_ary to_f to_hash to_i to_int to_io to_proc to_s to_str to_sym tr tr! tr_s tr_s! trace_var transpose trap truncate tty? type ungetc uniq uniq! unpack unshift untaint untrace_var upcase upcase! update upto value? values values_at warn write write_nonblock zero? zip"};var c={cN:"yardoctag",b:"@[A-Za-z]+"};var l=[{cN:"comment",b:"#",e:"$",c:[c]},{cN:"comment",b:"^\\=begin",e:"^\\=end",c:[c],r:10},{cN:"comment",b:"^__END__",e:"\\n$"}];var d={cN:"subst",b:"#\\{",e:"}",l:a,k:g};var j=[e.BE,d];var b=[{cN:"string",b:"'",e:"'",c:j,r:0},{cN:"string",b:'"',e:'"',c:j,r:0},{cN:"string",b:"%[qw]?\\(",e:"\\)",c:j},{cN:"string",b:"%[qw]?\\[",e:"\\]",c:j},{cN:"string",b:"%[qw]?{",e:"}",c:j},{cN:"string",b:"%[qw]?<",e:">",c:j,r:10},{cN:"string",b:"%[qw]?/",e:"/",c:j,r:10},{cN:"string",b:"%[qw]?%",e:"%",c:j,r:10},{cN:"string",b:"%[qw]?-",e:"-",c:j,r:10},{cN:"string",b:"%[qw]?\\|",e:"\\|",c:j,r:10}];var i={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:a,k:g,c:[{cN:"title",b:k,l:a,k:g},{cN:"params",b:"\\(",e:"\\)",l:a,k:g}].concat(l)};var h={cN:"identifier",b:a,l:a,k:g,r:0};var f=l.concat(b.concat([{cN:"class",bWK:true,e:"$|;",k:"class module",c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]}].concat(l)},i,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:b.concat([h]),r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},h,{b:"("+e.RSR+")\\s*",c:l.concat([{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[e.BE]}]),r:0}]));d.c=f;i.c[1].c=f;return{dM:{l:a,k:g,c:f}}}(hljs);hljs.LANGUAGES.javascript=function(a){return{dM:{k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete",literal:"true false null undefined NaN Infinity"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",bWK:true,e:"{",k:"function",c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[a.CLCM,a.CBLCLM],i:"[\"'\\(]"}],i:"\\[|%"}]}}}(hljs);hljs.LANGUAGES.css=function(a){var b={cN:"function",b:a.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[a.NM,a.ASM,a.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[a.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:"import page media charset",c:[b,a.ASM,a.QSM,a.NM]},{cN:"tag",b:a.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[b,a.NM,a.QSM,a.ASM,a.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{dM:{c:d,k:e,i:"\\S"}}}(hljs);
View
666 src/sketchup-developer-tools/highlight/highlight.source.js
@@ -0,0 +1,666 @@
+/*
+Syntax highlighting with language autodetection.
+http://softwaremaniacs.org/soft/highlight/
+*/
+
+var hljs = new function() {
+
+ /* Utility functions */
+
+ function escape(value) {
+ return value.replace(/&/gm, '&amp;').replace(/</gm, '&lt;');
+ }
+
+ function langRe(language, value, global) {
+ return RegExp(
+ value,
+ 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')
+ );
+ }
+
+ function findCode(pre) {
+ for (var i = 0; i < pre.childNodes.length; i++) {
+ var node = pre.childNodes[i];
+ if (node.nodeName == 'CODE')
+ return node;
+ if (!(node.nodeType == 3 && node.nodeValue.match(/\s+/)))
+ break;
+ }
+ }
+
+ function blockText(block, ignoreNewLines) {
+ var result = '';
+ for (var i = 0; i < block.childNodes.length; i++)
+ if (block.childNodes[i].nodeType == 3) {
+ var chunk = block.childNodes[i].nodeValue;
+ if (ignoreNewLines)
+ chunk = chunk.replace(/\n/g, '');
+ result += chunk;
+ } else if (block.childNodes[i].nodeName == 'BR')
+ result += '\n';
+ else
+ result += blockText(block.childNodes[i]);
+ // Thank you, MSIE...
+ if (/MSIE [678]/.test(navigator.userAgent))
+ result = result.replace(/\r/g, '\n');
+ return result;
+ }
+
+ function blockLanguage(block) {
+ var classes = block.className.split(/\s+/);
+ classes = classes.concat(block.parentNode.className.split(/\s+/));
+ for (var i = 0; i < classes.length; i++) {
+ var class_ = classes[i].replace(/^language-/, '');
+ if (languages[class_] || class_ == 'no-highlight') {
+ return class_;
+ }
+ }
+ }
+
+ /* Stream merging */
+
+ function nodeStream(node) {
+ var result = [];
+ (function _nodeStream(node, offset) {
+ for (var i = 0; i < node.childNodes.length; i++) {
+ if (node.childNodes[i].nodeType == 3)
+ offset += node.childNodes[i].nodeValue.length;
+ else if (node.childNodes[i].nodeName == 'BR')
+ offset += 1;
+ else if (node.childNodes[i].nodeType == 1) {
+ result.push({
+ event: 'start',
+ offset: offset,
+ node: node.childNodes[i]
+ });
+ offset = _nodeStream(node.childNodes[i], offset);
+ result.push({
+ event: 'stop',
+ offset: offset,
+ node: node.childNodes[i]
+ });
+ }
+ }
+ return offset;
+ })(node, 0);
+ return result;
+ }
+
+ function mergeStreams(stream1, stream2, value) {
+ var processed = 0;
+ var result = '';
+ var nodeStack = [];
+
+ function selectStream() {
+ if (stream1.length && stream2.length) {
+ if (stream1[0].offset != stream2[0].offset)
+ return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2;
+ else {
+ /*
+ To avoid starting the stream just before it should stop the order is
+ ensured that stream1 always starts first and closes last:
+
+ if (event1 == 'start' && event2 == 'start')
+ return stream1;
+ if (event1 == 'start' && event2 == 'stop')
+ return stream2;
+ if (event1 == 'stop' && event2 == 'start')
+ return stream1;
+ if (event1 == 'stop' && event2 == 'stop')
+ return stream2;
+
+ ... which is collapsed to:
+ */
+ return stream2[0].event == 'start' ? stream1 : stream2;
+ }
+ } else {
+ return stream1.length ? stream1 : stream2;
+ }
+ }
+
+ function open(node) {
+ var result = '<' + node.nodeName.toLowerCase();
+ for (var i = 0; i < node.attributes.length; i++) {
+ var attribute = node.attributes[i];
+ result += ' ' + attribute.nodeName.toLowerCase();
+ if (attribute.value !== undefined && attribute.value !== false && attribute.value !== null) {
+ result += '="' + escape(attribute.value) + '"';
+ }
+ }
+ return result + '>';
+ }
+
+ while (stream1.length || stream2.length) {
+ var current = selectStream().splice(0, 1)[0];
+ result += escape(value.substr(processed, current.offset - processed));
+ processed = current.offset;
+ if ( current.event == 'start') {
+ result += open(current.node);
+ nodeStack.push(current.node);
+ } else if (current.event == 'stop') {
+ var node, i = nodeStack.length;
+ do {
+ i--;
+ node = nodeStack[i];
+ result += ('</' + node.nodeName.toLowerCase() + '>');
+ } while (node != current.node);
+ nodeStack.splice(i, 1);
+ while (i < nodeStack.length) {
+ result += open(nodeStack[i]);
+ i++;
+ }
+ }
+ }
+ return result + escape(value.substr(processed));
+ }
+
+ /* Initialization */
+
+ function compileModes(language_name) {
+
+ function compileMode(mode, language, is_default) {
+ if (mode.compiled)
+ return;
+
+ var keywords = []; // used later with beginWithKeyword but filled as a side-effect of keywords compilation
+ if (mode.keywords) {
+ var compiled_keywords = {};
+
+ function flatten(className, str) {
+ var group = str.split(' ');
+ for (var i = 0; i < group.length; i++) {
+ var pair = group[i].split('|');
+ compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1];
+ keywords.push(pair[0]);
+ }
+ }
+
+ mode.lexemsRe = langRe(language, mode.lexems || hljs.IDENT_RE, true);
+ if (typeof mode.keywords == 'string') { // string
+ flatten('keyword', mode.keywords)
+ } else {
+ for (var className in mode.keywords) {
+ if (!mode.keywords.hasOwnProperty(className))
+ continue;
+ flatten(className, mode.keywords[className]);
+ }
+ }
+ mode.keywords = compiled_keywords;
+ }
+ if (!is_default) {
+ if (mode.beginWithKeyword) {
+ mode.begin = '\\b(' + keywords.join('|') + ')\\s';
+ }
+ mode.beginRe = langRe(language, mode.begin ? mode.begin : '\\B|\\b');
+ if (!mode.end && !mode.endsWithParent)
+ mode.end = '\\B|\\b';
+ if (mode.end)
+ mode.endRe = langRe(language, mode.end);
+ }
+ if (mode.illegal)
+ mode.illegalRe = langRe(language, mode.illegal);
+ if (mode.relevance === undefined)
+ mode.relevance = 1;
+ if (!mode.contains) {
+ mode.contains = [];
+ }
+ // compiled flag is set before compiling submodes to avoid self-recursion
+ // (see lisp where quoted_list contains quoted_list)
+ mode.compiled = true;
+ for (var i = 0; i < mode.contains.length; i++) {
+ if (mode.contains[i] == 'self') {
+ mode.contains[i] = mode;
+ }
+ compileMode(mode.contains[i], language, false);
+ }
+ if (mode.starts) {
+ compileMode(mode.starts, language, false);
+ }
+ }
+ compileMode(languages[language_name].defaultMode, languages[language_name], true);
+ }
+
+ var compiled_languages = {};
+
+ /*
+ Core highlighting function. Accepts a language name and a string with the
+ code to highlight. Returns an object with the following properties:
+
+ - relevance (int)
+ - keyword_count (int)
+ - value (an HTML string with highlighting markup)
+
+ */
+ function highlight(language_name, value) {
+ if (!compiled_languages[language_name]) {
+ compileModes(language_name);
+ compiled_languages[language_name] = true;
+ }
+
+ function subMode(lexem, mode) {
+ for (var i = 0; i < mode.contains.length; i++) {
+ var match = mode.contains[i].beginRe.exec(lexem);
+ if (match && match.index == 0) {
+ return mode.contains[i];
+ }
+ }
+ }
+
+ function endOfMode(mode_index, lexem) {
+ if (modes[mode_index].end && modes[mode_index].endRe.test(lexem))
+ return 1;
+ if (modes[mode_index].endsWithParent) {
+ var level = endOfMode(mode_index - 1, lexem);
+ return level ? level + 1 : 0;
+ }
+ return 0;
+ }
+
+ function isIllegal(lexem, mode) {
+ return mode.illegal && mode.illegalRe.test(lexem);
+ }
+
+ function compileTerminators(mode, language) {
+ var terminators = [];
+
+ for (var i = 0; i < mode.contains.length; i++) {
+ terminators.push(mode.contains[i].begin);
+ }
+
+ var index = modes.length - 1;
+ do {
+ if (modes[index].end) {
+ terminators.push(modes[index].end);
+ }
+ index--;
+ } while (modes[index + 1].endsWithParent);
+
+ if (mode.illegal) {
+ terminators.push(mode.illegal);
+ }
+
+ return terminators.length ? langRe(language, terminators.join('|'), true) : null;
+ }
+
+ function eatModeChunk(value, index) {
+ var mode = modes[modes.length - 1];
+ if (mode.terminators === undefined) {
+ mode.terminators = compileTerminators(mode, language);
+ }
+ var match;
+ if (mode.terminators) {
+ mode.terminators.lastIndex = index;
+ match = mode.terminators.exec(value);
+ }
+ return match ? [value.substr(index, match.index - index), match[0], false] : [value.substr(index), '', true];
+ }
+
+ function keywordMatch(mode, match) {
+ var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];
+ var value = mode.keywords[match_str];
+ if (value && value instanceof Array)
+ return value;
+ return false;
+ }
+
+ function processKeywords(buffer, mode) {
+ buffer = escape(buffer);
+ if (!mode.keywords)
+ return buffer;
+ var result = '';
+ var last_index = 0;
+ mode.lexemsRe.lastIndex = 0;
+ var match = mode.lexemsRe.exec(buffer);
+ while (match) {
+ result += buffer.substr(last_index, match.index - last_index);
+ var keyword_match = keywordMatch(mode, match);
+ if (keyword_match) {
+ keyword_count += keyword_match[1];
+ result += '<span class="'+ keyword_match[0] +'">' + match[0] + '</span>';
+ } else {
+ result += match[0];
+ }
+ last_index = mode.lexemsRe.lastIndex;
+ match = mode.lexemsRe.exec(buffer);
+ }
+ return result + buffer.substr(last_index);
+ }
+
+ function processSubLanguage(buffer, mode) {
+ var result;
+ if (mode.subLanguage == '') {
+ result = highlightAuto(buffer);
+ } else {
+ result = highlight(mode.subLanguage, buffer);
+ }
+ // Counting embedded language score towards the host language may be disabled
+ // with zeroing the containing mode relevance. Usecase in point is Markdown that
+ // allows XML everywhere and makes every XML snippet to have a much larger Markdown
+ // score.
+ if (mode.relevance > 0) {
+ keyword_count += result.keyword_count;
+ relevance += result.relevance;
+ }
+ return '<span class="' + result.language + '">' + result.value + '</span>';
+ }
+
+ function processBuffer(buffer, mode) {
+ if (mode.subLanguage && languages[mode.subLanguage] || mode.subLanguage == '') {
+ return processSubLanguage(buffer, mode);
+ } else {
+ return processKeywords(buffer, mode);
+ }
+ }
+
+ function startNewMode(mode, lexem) {
+ var markup = mode.className?'<span class="' + mode.className + '">':'';
+ if (mode.returnBegin) {
+ result += markup;
+ mode.buffer = '';
+ } else if (mode.excludeBegin) {
+ result += escape(lexem) + markup;
+ mode.buffer = '';
+ } else {
+ result += markup;
+ mode.buffer = lexem;
+ }
+ modes.push(mode);
+ relevance += mode.relevance;
+ }
+
+ function processModeInfo(buffer, lexem, end) {
+ var current_mode = modes[modes.length - 1];
+ if (end) {
+ result += processBuffer(current_mode.buffer + buffer, current_mode);
+ return false;
+ }
+
+ var new_mode = subMode(lexem, current_mode);
+ if (new_mode) {
+ result += processBuffer(current_mode.buffer + buffer, current_mode);
+ startNewMode(new_mode, lexem);
+ return new_mode.returnBegin;
+ }
+
+ var end_level = endOfMode(modes.length - 1, lexem);
+ if (end_level) {
+ var markup = current_mode.className?'</span>':'';
+ if (current_mode.returnEnd) {
+ result += processBuffer(current_mode.buffer + buffer, current_mode) + markup;
+ } else if (current_mode.excludeEnd) {
+ result += processBuffer(current_mode.buffer + buffer, current_mode) + markup + escape(lexem);
+ } else {
+ result += processBuffer(current_mode.buffer + buffer + lexem, current_mode) + markup;
+ }
+ while (end_level > 1) {
+ markup = modes[modes.length - 2].className?'</span>':'';
+ result += markup;
+ end_level--;
+ modes.length--;
+ }
+ var last_ended_mode = modes[modes.length - 1];
+ modes.length--;
+ modes[modes.length - 1].buffer = '';
+ if (last_ended_mode.starts) {
+ startNewMode(last_ended_mode.starts, '');
+ }
+ return current_mode.returnEnd;
+ }
+
+ if (isIllegal(lexem, current_mode))
+ throw 'Illegal';
+ }
+
+ var language = languages[language_name];
+ var modes = [language.defaultMode];
+ var relevance = 0;
+ var keyword_count = 0;
+ var result = '';
+ try {
+ var mode_info, index = 0;
+ language.defaultMode.buffer = '';
+ do {
+ mode_info = eatModeChunk(value, index);
+ var return_lexem = processModeInfo(mode_info[0], mode_info[1], mode_info[2]);
+ index += mode_info[0].length;
+ if (!return_lexem) {
+ index += mode_info[1].length;
+ }
+ } while (!mode_info[2]);
+ return {
+ relevance: relevance,
+ keyword_count: keyword_count,
+ value: result,
+ language: language_name
+ };
+ } catch (e) {
+ if (e == 'Illegal') {
+ return {
+ relevance: 0,
+ keyword_count: 0,
+ value: escape(value)
+ };
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ /*
+ Highlighting with language detection. Accepts a string with the code to
+ highlight. Returns an object with the following properties:
+
+ - language (detected language)
+ - relevance (int)
+ - keyword_count (int)
+ - value (an HTML string with highlighting markup)
+ - second_best (object with the same structure for second-best heuristically
+ detected language, may be absent)
+
+ */
+ function highlightAuto(text) {
+ var result = {
+ keyword_count: 0,
+ relevance: 0,
+ value: escape(text)
+ };
+ var second_best = result;
+ for (var key in languages) {
+ if (!languages.hasOwnProperty(key))
+ continue;
+ var current = highlight(key, text);
+ current.language = key;
+ if (current.keyword_count + current.relevance > second_best.keyword_count + second_best.relevance) {
+ second_best = current;
+ }
+ if (current.keyword_count + current.relevance > result.keyword_count + result.relevance) {
+ second_best = result;
+ result = current;
+ }
+ }
+ if (second_best.language) {
+ result.second_best = second_best;
+ }
+ return result;
+ }
+
+ /*
+ Post-processing of the highlighted markup:
+
+ - replace TABs with something more useful
+ - replace real line-breaks with '<br>' for non-pre containers
+
+ */
+ function fixMarkup(value, tabReplace, useBR) {
+ if (tabReplace) {
+ value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) {
+ return p1.replace(/\t/g, tabReplace);
+ });
+ }
+ if (useBR) {
+ value = value.replace(/\n/g, '<br>');
+ }
+ return value;
+ }
+
+ /*
+ Applies highlighting to a DOM node containing code. Accepts a DOM node and
+ two optional parameters for fixMarkup.
+ */
+ function highlightBlock(block, tabReplace, useBR) {
+ var text = blockText(block, useBR);
+ var language = blockLanguage(block);
+ var result, pre;
+ if (language == 'no-highlight')
+ return;
+ if (language) {
+ result = highlight(language, text);
+ } else {
+ result = highlightAuto(text);
+ language = result.language;
+ }
+ var original = nodeStream(block);
+ if (original.length) {
+ pre = document.createElement('pre');
+ pre.innerHTML = result.value;
+ result.value = mergeStreams(original, nodeStream(pre), text);
+ }
+ result.value = fixMarkup(result.value, tabReplace, useBR);
+
+ var class_name = block.className;
+ if (!class_name.match('(\\s|^)(language-)?' + language + '(\\s|$)')) {
+ class_name = class_name ? (class_name + ' ' + language) : language;
+ }
+ if (/MSIE [678]/.test(navigator.userAgent) && block.tagName == 'CODE' && block.parentNode.tagName == 'PRE') {
+ // This is for backwards compatibility only. IE needs this strange
+ // hack becasue it cannot just cleanly replace <code> block contents.
+ pre = block.parentNode;
+ var container = document.createElement('div');
+ container.innerHTML = '<pre><code>' + result.value + '</code></pre>';
+ block = container.firstChild.firstChild;
+ container.firstChild.className = pre.className;
+ pre.parentNode.replaceChild(container.firstChild, pre);
+ } else {
+ block.innerHTML = result.value;
+ }
+ block.className = class_name;
+ block.result = {
+ language: language,
+ kw: result.keyword_count,
+ re: result.relevance
+ };
+ if (result.second_best) {
+ block.second_best = {
+ language: result.second_best.language,
+ kw: result.second_best.keyword_count,
+ re: result.second_best.relevance
+ };
+ }
+ }
+
+ /*
+ Applies highlighting to all <pre><code>..</code></pre> blocks on a page.
+ */
+ function initHighlighting() {
+ if (initHighlighting.called)
+ return;
+ initHighlighting.called = true;
+ var pres = document.getElementsByTagName('pre');
+ for (var i = 0; i < pres.length; i++) {
+ var code = findCode(pres[i]);
+ if (code)
+ highlightBlock(code, hljs.tabReplace);
+ }
+ }
+
+ /*
+ Attaches highlighting to the page load event.
+ */
+ function initHighlightingOnLoad() {
+ if (window.addEventListener) {
+ window.addEventListener('DOMContentLoaded', initHighlighting, false);
+ window.addEventListener('load', initHighlighting, false);
+ } else if (window.attachEvent)
+ window.attachEvent('onload', initHighlighting);
+ else
+ window.onload = initHighlighting;
+ }
+
+ var languages = {}; // a shortcut to avoid writing "this." everywhere
+
+ /* Interface definition */
+
+ this.LANGUAGES = languages;
+ this.highlight = highlight;
+ this.highlightAuto = highlightAuto;
+ this.fixMarkup = fixMarkup;
+ this.highlightBlock = highlightBlock;
+ this.initHighlighting = initHighlighting;
+ this.initHighlightingOnLoad = initHighlightingOnLoad;
+
+ // Common regexps
+ this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*';
+ this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*';
+ this.NUMBER_RE = '\\b\\d+(\\.\\d+)?';
+ this.C_NUMBER_RE = '\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float
+ this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b...
+ this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
+
+ // Common modes
+ this.BACKSLASH_ESCAPE = {
+ begin: '\\\\.', relevance: 0
+ };
+ this.APOS_STRING_MODE = {
+ className: 'string',
+ begin: '\'', end: '\'',
+ illegal: '\\n',
+ contains: [this.BACKSLASH_ESCAPE],
+ relevance: 0
+ };
+ this.QUOTE_STRING_MODE = {
+ className: 'string',
+ begin: '"', end: '"',
+ illegal: '\\n',
+ contains: [this.BACKSLASH_ESCAPE],
+ relevance: 0
+ };
+ this.C_LINE_COMMENT_MODE = {
+ className: 'comment',
+ begin: '//', end: '$'
+ };
+ this.C_BLOCK_COMMENT_MODE = {
+ className: 'comment',
+ begin: '/\\*', end: '\\*/'
+ };
+ this.HASH_COMMENT_MODE = {
+ className: 'comment',
+ begin: '#', end: '$'
+ };
+ this.NUMBER_MODE = {
+ className: 'number',
+ begin: this.NUMBER_RE,
+ relevance: 0
+ };
+ this.C_NUMBER_MODE = {
+ className: 'number',
+ begin: this.C_NUMBER_RE,
+ relevance: 0
+ };
+ this.BINARY_NUMBER_MODE = {
+ className: 'number',
+ begin: this.BINARY_NUMBER_RE,
+ relevance: 0
+ };
+
+ // Utility functions
+ this.inherit = function(parent, obj) {
+ var result = {}
+ for (var key in parent)
+ result[key] = parent[key];
+ if (obj)
+ for (var key in obj)
+ result[key] = obj[key];
+ return result;
+ }
+}
+
View
24 src/sketchup-developer-tools/highlight/highlight_LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2006, Ivan Sagalaev
+All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of highlight.js nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
120 src/sketchup-developer-tools/highlight/highlight_README.md
@@ -0,0 +1,120 @@
+# Highlight.js
+
+Highlight.js highlights syntax in code examples on blogs, forums and,
+in fact, on any web page. It's very easy to use because it works
+automatically: finds blocks of code, detects a language, highlights it.
+
+Autodetection can be fine tuned when it fails by itself (see "Heuristics").
+
+
+## Basic usage
+
+Link the library and a stylesheet from your page and hook highlighting to
+the page load event:
+
+```html
+<link rel="stylesheet" href="styles/default.css">
+<script src="highlight.pack.js"></script>
+<script>hljs.initHighlightingOnLoad();</script>
+```
+
+This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`.
+If you use different markup or need to apply highlighting dynamically, read
+"Custom initialization" below.
+
+- You can download your own customized version of "highlight.pack.js" or
+ use the hosted one as described on the download page:
+ <http://softwaremaniacs.org/soft/highlight/en/download/>
+
+- Style themes are available in the download package or as hosted files.
+ To create a custom style for your site see the class reference in the file
+ [classref.txt][cr] from the downloaded package.
+
+[cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt
+
+
+## Tab replacement
+
+You can replace TAB ('\x09') characters used for indentation in your code
+with some fixed number of spaces or with a `<span>` to give them special
+styling:
+
+```html
+<script type="text/javascript">
+ hljs.tabReplace = ' '; // 4 spaces
+ // ... or
+ hljs.tabReplace = '<span class="indent">\t</span>';
+
+ hljs.initHighlightingOnLoad();
+</script>
+```
+
+## Custom initialization
+
+If you use different markup for code blocks you can initialize them manually
+with `highlightBlock(code, tabReplace, useBR)` function. It takes a DOM element
+containing the code to highlight and optionally a string with which to replace
+TAB characters.
+
+Initialization using, for example, jQuery might look like this:
+
+```javascript
+$(document).ready(function() {
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
+});
+```
+
+You can use `highlightBlock` to highlight blocks dynamically inserted into
+the page. Just make sure you don't do it twice for already highlighted
+blocks.
+
+If your code container relies on `<br>` tags instead of line breaks (i.e. if
+it's not `<pre>`) pass `true` into the third parameter of `highlightBlock`
+to make highlight.js use `<br>` in the output:
+
+```javascript
+$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)});
+```
+
+
+## Heuristics
+
+Autodetection of a code's language is done using a simple heuristic:
+the program tries to highlight a fragment with all available languages and
+counts all syntactic structures that it finds along the way. The language
+with greatest count wins.
+
+This means that in short fragments the probability of an error is high
+(and it really happens sometimes). In this cases you can set the fragment's
+language explicitly by assigning a class to the `<code>` element:
+
+```html
+<pre><code class="html">...</code></pre>
+```
+
+You can use class names recommended in HTML5: "language-html",
+"language-php". Classes also can be assigned to the `<pre>` element.
+
+To disable highlighting of a fragment altogether use "no-highlight" class:
+
+```html
+<pre><code class="no-highlight">...</code></pre>
+```
+
+
+## Export
+
+File export.html contains a little program that allows you to paste in a code
+snippet and then copy and paste the resulting HTML code generated by the
+highlighter. This is useful in situations when you can't use the script itself
+on a site.
+
+
+## Meta
+
+- Version: 7.0
+- URL: http://softwaremaniacs.org/soft/highlight/en/
+- Author: Ivan Sagalaev (<maniac@softwaremaniacs.org>)
+
+For the license terms see LICENSE files.
+For the list of contributors see AUTHORS.en.txt file.
View
132 src/sketchup-developer-tools/highlight/highlight_default.css
@@ -0,0 +1,132 @@
+/*
+
+Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
+
+*/
+
+pre code {
+ display: block;
+}
+
+pre code,
+pre .ruby .subst,
+pre .tag .title,
+pre .lisp .title,
+pre .nginx .title {
+ color: black;
+}
+
+pre .string,
+pre .title,
+pre .constant,
+pre .parent,
+pre .tag .value,
+pre .rules .value,
+pre .rules .value .number,
+pre .preprocessor,
+pre .ruby .symbol,
+pre .ruby .symbol .string,
+pre .ruby .symbol .keyword,
+pre .ruby .symbol .keymethods,
+pre .instancevar,
+pre .aggregate,
+pre .template_tag,
+pre .django .variable,
+pre .smalltalk .class,
+pre .addition,
+pre .flow,
+pre .stream,
+pre .bash .variable,
+pre .apache .tag,
+pre .apache .cbracket,
+pre .tex .command,
+pre .tex .special,
+pre .erlang_repl .function_or_atom,
+pre .markdown .header {
+ color: #800;
+}
+
+pre .comment,
+pre .annotation,
+pre .template_comment,
+pre .diff .header,
+pre .chunk,
+pre .markdown .blockquote {
+ color: #888;
+}
+
+pre .number,
+pre .date,
+pre .regexp,
+pre .literal,
+pre .smalltalk .symbol,
+pre .smalltalk .char,
+pre .go .constant,
+pre .change,
+pre .markdown .bullet,
+pre .markdown .link_url {
+ color: #080;
+}
+
+pre .label,
+pre .javadoc,
+pre .ruby .string,
+pre .decorator,
+pre .filter .argument,
+pre .localvars,
+pre .array,
+pre .attr_selector,
+pre .important,
+pre .pseudo,
+pre .pi,
+pre .doctype,
+pre .deletion,
+pre .envvar,
+pre .shebang,
+pre .apache .sqbracket,
+pre .nginx .built_in,
+pre .tex .formula,
+pre .erlang_repl .reserved,
+pre .input_number,
+pre .markdown .link_label,
+pre .vhdl .attribute {
+ color: #88F
+}
+
+pre .keyword,
+pre .id,
+pre .phpdoc,
+pre .title,
+pre .built_in,
+pre .aggregate,
+pre .css .tag,
+pre .javadoctag,
+pre .phpdoc,
+pre .yardoctag,
+pre .smalltalk .class,
+pre .winutils,
+pre .bash .variable,
+pre .apache .tag,
+pre .go .typename,
+pre .tex .command,
+pre .markdown .strong,
+pre .request,
+pre .status {
+ font-weight: bold;
+}
+
+pre .markdown .emphasis {
+ font-style: italic;
+}
+
+pre .nginx .built_in {
+ font-weight: normal;
+}
+
+pre .coffeescript .javascript,
+pre .xml .css,
+pre .xml .javascript,
+pre .xml .vbscript,
+pre .tex .formula {
+ opacity: 0.5;
+}
View
6 src/sketchup-developer-tools/html/console.html
@@ -27,8 +27,8 @@
<body onload="console.initialize()" border="none">
<div id="background">
<div id="header" unselectable="on">
- <div id="clear" title=" Clear the console" class="button-container"><a class="button">clear</a></div>
- <div id="reload" title=" Reload plugins folder" class="button-container"><a class="button">reload</a></div>
+ <div id="clear" title=" Clear the console" class="button-container"><a class="button">Clear</a></div>
+ <div id="reload" title=" Reload plugins folder" class="button-container"><a class="button">Reload</a></div>
<div id="logged" title=" Write to logfile">
<label>
<input type="checkbox" id="logged_check"/>
@@ -57,7 +57,7 @@
<div id="input">
<textarea id="command" rows="1" title=" Shift+return to add lines"></textarea>
</div>
- <div id="go" title=" Execute the command" class="button-container"><a class="button">go</a></div>
+ <div id="go" title=" Execute the command" class="button-container"><a class="button">Go</a></div>
</div>
</div>
</body>
View
24 src/sketchup-developer-tools/ruby/devl_console.rb
@@ -501,6 +501,7 @@ def do_exec(dialog, query)
buffer = params['command']
+ # Output the buffer/command string to the log.
puts!('> ' + buffer)
Developer::Console.log('> ' + buffer)
@@ -508,30 +509,23 @@ def do_exec(dialog, query)
# Note we do the eval here in the context of a reused proc. This
# approach means that each call can build upon prior results and
# variables which might have been created.
- result = eval buffer, @binding
+ result = eval(buffer, TOPLEVEL_BINDING)
fault = false
- # Now it turns out that inspect likes to misbehave in some sense, in
- # that a string that started out as str='blah"s' will end up as
- # str="blah"s" which is ok from a Ruby sense but not a JavaScript one.
- # Here we massage that case a little to mirror what a Ruby user expects.
- #if result.kind_of? String
- # result = '"' + result.gsub(/([^\\])"/, '\1\\"') + '"'
- #else
- # result = result.nil? ? 'nil' : Bridge.clean_for_xml(result.inspect)
- #end
-
result = result.inspect
Developer::Console.outputContent(result, {"type"=>"ruby result"})
rescue Exception => e
- #result = Bridge.clean_for_xml(e.class.to_s + ': ' + e.message.to_s)
result = e.class.to_s + ': ' + e.message.to_s
- Developer::Console.outputContent(result, {"backtrace"=>e.backtrace, "type"=>"error"})
+ # When eval is called with TOPLEVEL_BINDING it's the first item in the
+ # traceback that refer to the developer console. We omit this as it's
+ # misleading.
+ backtrace = e.backtrace[1..-1]
+ # Send the error to the output:
+ Developer::Console.outputContent(result, {"backtrace"=>backtrace, "type"=>"error"})
fault = true
end
- result = Bridge.clean_for_xml(result)
Bridge.js_callback(dialog, 'do_exec', query, result, fault) # TODO: What does this?
end
@@ -790,9 +784,9 @@ module Kernel
#
#
# Args:
- # - args: Object, the object (usually a string) to output.
# - output_method: Symbol, method to forward the data to. May be :puts! or
# :print!
+ # - args: Object, the object (usually a string) to output.
#
# TODO: do we need this method really?
def puts_or_print(output_method, *args)
Please sign in to comment.
Something went wrong with that request. Please try again.