Permalink
Browse files

Created gh-pages branch via GitHub

  • Loading branch information...
0 parents commit 60e741549c39ffa6cacbcf74349b44a711cad493 @michaelficarra committed Apr 4, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,52 @@
+(function($) {
+$(document).ready(function(){
+
+ // putting lines by the pre blocks
+ $("pre").each(function(){
+ var pre = $(this).text().split("\n");
+ var lines = new Array(pre.length+1);
+ for(var i = 0; i < pre.length; i++) {
+ var wrap = Math.floor(pre[i].split("").length / 70)
+ if (pre[i]==""&&i==pre.length-1) {
+ lines.splice(i, 1);
+ } else {
+ lines[i] = i+1;
+ for(var j = 0; j < wrap; j++) {
+ lines[i] += "\n";
+ }
+ }
+ }
+ $(this).before("<pre class='lines'>" + lines.join("\n") + "</pre>");
+ });
+
+ var headings = [];
+
+ var collectHeaders = function(){
+ headings.push({"top":$(this).offset().top - 15,"text":$(this).text()});
+ }
+
+ if($(".markdown-body h1").length > 1) $(".markdown-body h1").each(collectHeaders)
+ else if($(".markdown-body h2").length > 1) $(".markdown-body h2").each(collectHeaders)
+ else if($(".markdown-body h3").length > 1) $(".markdown-body h3").each(collectHeaders)
+
+ $(window).scroll(function(){
+ if(headings.length==0) return true;
+ var scrolltop = $(window).scrollTop() || 0;
+ if(headings[0] && scrolltop < headings[0].top) {
+ $(".current-section").css({"opacity":0,"visibility":"hidden"});
+ return false;
+ }
+ $(".current-section").css({"opacity":1,"visibility":"visible"});
+ for(var i in headings) {
+ if(scrolltop >= headings[i].top) {
+ $(".current-section .name").text(headings[i].text);
+ }
+ }
+ });
+
+ $(".current-section a").click(function(){
+ $(window).scrollTop(0);
+ return false;
+ })
+});
+})(jQuery)
@@ -0,0 +1 @@
+{"name":"StringScanner","body":"StringScanner performs lexical scanning operations on a string.\r\nInspired by [Ruby's StringScanner class](http://ruby-doc.org/core/classes/StringScanner.html)\r\n\r\n\r\nHow To Use\r\n----------\r\n\r\nInstantiate a new `StringScanner` by passing its constructor the string to scan.\r\n\r\n var StringScanner = require(\"StringScanner\");\r\n var ss = new StringScanner(\"abc123 def456\");\r\n // #<StringScanner 0/13 @ \"abc12...\">\r\n\r\nFor the following examples, `ss` represents the `StringScanner` instance\r\ndefined above.\r\n\r\n### bol / beginningOfLine\r\nReturns `true` if the scan pointer is at the beginning of a line (right after\r\n`\\n`) or the beginning of the string, `false` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.pointer() // 0\r\n ss.bol() // true\r\n ss.scan(/./) // \"a\"\r\n ss.pointer() // 1\r\n ss.bol() // false\r\n\r\n### captures\r\nReturns an Array containing the contents of the capturing groups in the last\r\nevaluated pattern match.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.check(/.*(..) (..)/ // \"abc123 de\"\r\n ss.captures() // [\"23\",\"de\"]\r\n ss.check(/\\w+/) // \"abc123\"\r\n ss.captures() // []\r\n ss.check(/\\s+/) // null\r\n ss.captures() // []\r\n\r\n\r\n### check(pattern)\r\n*Note: this method alters last match results*\r\n\r\nChecks if a `scan` of the given pattern would succeed without advancing the\r\nscan pointer. Returns the portion of the string matched on successful match,\r\n`null` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.check(/[a-z]+/i) // \"abc\"\r\n ss.check(/[a-z]+/i) // \"abc\"\r\n ss.scan(/[a-z]+/i) // \"abc\"\r\n ss.check(/[a-z]+/i) // null\r\n ss.check(/[\\d\\s]+/) // \"123 \"\r\n\r\n### checkUntil(pattern)\r\n*Note: this method alters last match results*\r\n\r\nChecks if a `scanUntil` would succeed without advancing the scan pointer.\r\nReturns the portion of the string being scanned from the scan pointer to the\r\nend of the matched string on successful match, `null` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.checkUntil(/\\s/) // \"abc123 \"\r\n ss.checkUntil(/\\s/) // \"abc123 \"\r\n ss.checkUntil(/r/) // null\r\n ss.scanUntil(/e/) // \"abc123 de\"\r\n ss.checkUntil(/\\s/) // null\r\n\r\n### clone / dup\r\nCreates a duplicate of this instance of `StringScanner`.\r\n\r\n### concat(str)\r\nAppends the given string to the string being scanned.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.checkUntil(/h/) // null\r\n ss.concat(\" ghi789\") // #<StringScanner 0/20 @ \"abc12...\"\r\n ss.checkUntil(/h/) // \"abc123 def456 gh\"\r\n\r\n### eos / endOfString\r\nReturns `true` if the scan pointer is at the end of the string being scanned,\r\n`false` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.pointer() // 0\r\n ss.eos() // false\r\n ss.scan(/.*/) // \"abc123 def456\"\r\n ss.pointer() // 13\r\n ss.eos() // true\r\n\r\n### exists(pattern) / exist(pattern)\r\n*Note: this method alters last match results*\r\n\r\n*Warning: this method may return `0` on a successful operation. Use `===`\r\ncomparision to `null` for failure check, for example: `ss.exists(/a/i)===null`*\r\n\r\nChecks if the given pattern matches anywhere after the current scan pointer.\r\nThis will determine if a `scanUntil` operation will succeed. Returns the\r\nnumber of characters between the scan pointer and the position in which the\r\nmatch was found on success, `null` otherwise.\r\n\r\n ss.reset()\r\n // ----\r\n ss.exists(/c/) // 2\r\n ss.match() // \"c\"\r\n ss.matched() // true\r\n // ----\r\n ss.exists(/a/) // 0\r\n ss.match() // \"a\"\r\n ss.matched() // true\r\n // ----\r\n ss.exists(/b*/) // 0\r\n ss.match() // \"\"\r\n ss.matched() // true\r\n // ----\r\n ss.exists(/m/) // null\r\n ss.match() // null\r\n ss.matched() // false\r\n\r\n### getch / getChar\r\n*Note: this method alters last match results*\r\n\r\n*Note: Ruby equivalent: `get_byte`*\r\n\r\n`scan`s one character and returns it; exactly equivalent to `scan(/./)`.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.getch() // \"a\"\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/./) // \"a\"\r\n\r\n### match\r\n*Note: Ruby equivalent: `matched`*\r\n\r\nReturns the last string matched or `null` if the last attempted match failed.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/[a-z]+/i) // \"abc\"\r\n ss.match() // \"abc\"\r\n ss.check(/[a-z]+/i) // null\r\n ss.match() // null\r\n\r\n### matches(pattern)\r\n*Note: Ruby equivalent: `match?`*\r\n\r\nChecks if a scan of the given pattern would succeed without advancing the scan\r\npointer. Returns the length of the string matched on successful match, `null`\r\notherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.matches(/[a-z]+/i) // 3\r\n ss.matches(/[a-z]+/i) // 3\r\n ss.scan(/[a-z]+/i) // \"abc\"\r\n ss.matches(/[a-z]+/i) // null\r\n ss.matches(/[\\d\\s]+/) // 4\r\n\r\n### matched\r\n*Note: Ruby equivalent: `matched?`*\r\n\r\nReturns `true` if the last attempted match was successful, `false` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/\\w+/) // \"abc123\"\r\n ss.matched() // true\r\n ss.scan(/\\w+/) // null\r\n ss.matched() // false\r\n\r\n### matchSize\r\n*Warning: this method may return `0` on a successful operation. Use `===`\r\ncomparision to `null` for failure check, for example: `ss.matchSize()===null`*\r\n\r\nReturns the length of the most recently matched string if the most recent match\r\nattempt succeeded, `null` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/\\w+/) // \"abc123\"\r\n ss.matchSize() // 6\r\n ss.check(/\\w*/) // \"\"\r\n ss.matchSize() // 0\r\n ss.check(/\\w+/) // null\r\n ss.matchSize() // null\r\n\r\n### peek(len)\r\nReturns *len* characters after the scan pointer, or the rest of the string,\r\nwhichever is shorter.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/.*d/) // \"abc123 d\"\r\n ss.peek(3) // \"ef4\"\r\n ss.peek(9001) // \"ef456\"\r\n ss.peek(0) // \"\"\r\n ss.peek(-3) // \"\"\r\n\r\n### pointer / position\r\nReturns the scan pointer position as an integer.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.pointer() // 0\r\n ss.scan(/\\w+\\d+\\s+/) // \"abc123 \"\r\n ss.pointer() // 7\r\n ss.scan([a-z]+) // \"def\"\r\n ss.pointer() // 10\r\n\r\n### setPointer(pos)\r\nManually move the scan pointer to *pos* characters from the beginning of the\r\nstring. The scan pointer is bounded between zero and the scanning string's\r\nlength. Returns the position to which the scan pointer was moved. `setPointer`\r\nneither resets nor modifies the last match results.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.setPointer(4) // 4\r\n ss.scan(/\\d+/) // \"23\"\r\n ss.pointer() // 6\r\n ss.setPointer(-4) // 0\r\n ss.setPointer(99) // 13\r\n\r\n### reset\r\nMoves the scan pointer back to the beginning of the string being scanned and\r\nclears the last match results.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scanUntil(/(\\s)/) // \"abc123 \"\r\n ss.pointer() // 7\r\n ss.match() // \"abc123 \"\r\n ss.captures() // [\" \"]\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.pointer() // 0\r\n ss.match() // null\r\n ss.captures() // []\r\n\r\n### rest\r\nReturns the portion of the string being scanned after the scan pointer.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scanUntil(/\\s/) // \"abc123 \"\r\n ss.rest() // \"def456\"\r\n\r\n### scan(pattern)\r\n*Note: this method alters last match results*\r\n\r\nAttempts to match the given pattern at the position of the scan pointer.\r\nReturns the matched string and advances the string pointer upon successful\r\nmatch. A failed match will result in a `null` value being returned.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scan(/[a-z]+/) // \"abc\"\r\n ss // #<StringScanner 3/13 @ \"abc12...\">\r\n ss.scan(/[a-z]+/) // null\r\n ss // #<StringScanner 3/13 @ \"abc12...\">\r\n ss.scan(/[0-9]+/) // \"123\"\r\n ss // #<StringScanner 6/13 @ \"abc12...\">\r\n\r\n### scanUntil(pattern)\r\n*Note: this method alters last match results*\r\n\r\nAttempts to match the pattern against the string being scanned. On a successful\r\nmatch, the scan pointer is advanced to the end of the matched portion of the\r\nstring and the portion of the string being scanned up to and including the\r\nmatched string is returned. On a failed match, `null` is returned.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.scanUntil(/ /) // \"abc123 \"\r\n ss.scanUntil(/f/) // \"def\"\r\n ss.scanUntil(/f/) // null\r\n\r\n### skip(pattern)\r\n*Note: this method alters last match results*\r\n\r\nPerforms a `scan`, returning the length of the matched string on successful\r\nmatch, `null` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.skip(/[a-z]+/) // 3\r\n ss.skip(/[a-z]+/) // null\r\n ss.skip(/[0-9]+/) // 3\r\n\r\n### skipUntil(pattern)\r\n*Note: this method alters last match results*\r\n\r\nPerforms a `scanUntil`, returning the length of the matched string on\r\nsuccessful match, `null` otherwise.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.skipUntil(/ /) // 7\r\n ss.skipUntil(/f/) // 3\r\n ss.skipUntil(/f/) // null\r\n\r\n### string\r\nReturns the entire string being scanned.\r\n\r\n ss.string() // \"abc123 def456\"\r\n ss.getch() // \"a\"\r\n ss.string() // \"abc123 def456\"\r\n\r\n### terminate / clear\r\nAdvances the scan pointer to the end of the string being scanned and resets the\r\nlast match results.\r\n\r\n ss.reset() // #<StringScanner 0/13 @ \"abc12...\">\r\n ss.getch() // \"a\"\r\n ss.pointer() // 1\r\n ss.terminate() // #<StringScanner fin>\r\n ss.pointer() // 13\r\n ss.eos() // true\r\n ss.match() // null\r\n\r\nKnown Issues\r\n------------\r\n\r\nNot really an issue, but `StringScanner` assumes the global flag (g) is\r\ndisabled on any RegExp objects passed as patterns to any of its methods. If the\r\nglobal flag is enabled, `StringScanner` may produce unexpected results.\r\n\r\nAdditional Info\r\n---------------\r\n\r\nI am always open for feature requests or any feedback. I can be reached at\r\n[Github](http://github.com/michaelficarra).\r\n\r\nThanks to the Ruby community for the original idea and implementation.","tagline":"string-tokenizing CommonJS module; mimicks Ruby's StringScanner API","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
@@ -0,0 +1,69 @@
+.highlight { background: #ffffff; }
+.highlight .c { color: #999988; font-style: italic } /* Comment */
+.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
+.highlight .k { font-weight: bold } /* Keyword */
+.highlight .o { font-weight: bold } /* Operator */
+.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
+.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
+.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #aa0000 } /* Generic.Error */
+.highlight .gh { color: #999999 } /* Generic.Heading */
+.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
+.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
+.highlight .go { color: #888888 } /* Generic.Output */
+.highlight .gp { color: #555555 } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
+.highlight .gt { color: #aa0000 } /* Generic.Traceback */
+.highlight .kc { font-weight: bold } /* Keyword.Constant */
+.highlight .kd { font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
+.highlight .kr { font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
+.highlight .m { color: #009999 } /* Literal.Number */
+.highlight .s { color: #d14 } /* Literal.String */
+.highlight .na { color: #008080 } /* Name.Attribute */
+.highlight .nb { color: #0086B3 } /* Name.Builtin */
+.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
+.highlight .no { color: #008080 } /* Name.Constant */
+.highlight .ni { color: #800080 } /* Name.Entity */
+.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
+.highlight .nn { color: #555555 } /* Name.Namespace */
+.highlight .nt { color: #000080 } /* Name.Tag */
+.highlight .nv { color: #008080 } /* Name.Variable */
+.highlight .ow { font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #009999 } /* Literal.Number.Float */
+.highlight .mh { color: #009999 } /* Literal.Number.Hex */
+.highlight .mi { color: #009999 } /* Literal.Number.Integer */
+.highlight .mo { color: #009999 } /* Literal.Number.Oct */
+.highlight .sb { color: #d14 } /* Literal.String.Backtick */
+.highlight .sc { color: #d14 } /* Literal.String.Char */
+.highlight .sd { color: #d14 } /* Literal.String.Doc */
+.highlight .s2 { color: #d14 } /* Literal.String.Double */
+.highlight .se { color: #d14 } /* Literal.String.Escape */
+.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
+.highlight .si { color: #d14 } /* Literal.String.Interpol */
+.highlight .sx { color: #d14 } /* Literal.String.Other */
+.highlight .sr { color: #009926 } /* Literal.String.Regex */
+.highlight .s1 { color: #d14 } /* Literal.String.Single */
+.highlight .ss { color: #990073 } /* Literal.String.Symbol */
+.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #008080 } /* Name.Variable.Class */
+.highlight .vg { color: #008080 } /* Name.Variable.Global */
+.highlight .vi { color: #008080 } /* Name.Variable.Instance */
+.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
+
+.type-csharp .highlight .k { color: #0000FF }
+.type-csharp .highlight .kt { color: #0000FF }
+.type-csharp .highlight .nf { color: #000000; font-weight: normal }
+.type-csharp .highlight .nc { color: #2B91AF }
+.type-csharp .highlight .nn { color: #000000 }
+.type-csharp .highlight .s { color: #A31515 }
+.type-csharp .highlight .sc { color: #A31515 }
Oops, something went wrong.

0 comments on commit 60e7415

Please sign in to comment.