ulmul 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/README-en +118 -63
  2. data/README-ja +92 -58
  3. data/Rakefile +26 -10
  4. data/bin/ulmul2html5 +7 -58
  5. data/bin/ulmul2latex +34 -0
  6. data/bin/ulmul2xhtml +6 -58
  7. data/google-code-prettify/CHANGES.html +130 -0
  8. data/google-code-prettify/COPYING +202 -0
  9. data/google-code-prettify/README-zh-Hans.html +143 -0
  10. data/google-code-prettify/README.html +203 -0
  11. data/google-code-prettify/src/lang-apollo.js +51 -0
  12. data/google-code-prettify/src/lang-css.js +78 -0
  13. data/google-code-prettify/src/lang-fortran.js +53 -0
  14. data/google-code-prettify/src/lang-hs.js +101 -0
  15. data/google-code-prettify/src/lang-lisp.js +93 -0
  16. data/google-code-prettify/src/lang-lua.js +59 -0
  17. data/google-code-prettify/src/lang-ml.js +56 -0
  18. data/google-code-prettify/src/lang-proto.js +35 -0
  19. data/google-code-prettify/src/lang-scala.js +54 -0
  20. data/google-code-prettify/src/lang-sql.js +57 -0
  21. data/google-code-prettify/src/lang-vb.js +61 -0
  22. data/google-code-prettify/src/lang-vhdl.js +34 -0
  23. data/google-code-prettify/src/lang-wiki.js +53 -0
  24. data/google-code-prettify/src/lang-yaml.js +27 -0
  25. data/google-code-prettify/src/prettify.css +44 -0
  26. data/google-code-prettify/src/prettify.js +1508 -0
  27. data/google-code-prettify/tests/large_input_test.html +122 -0
  28. data/google-code-prettify/tests/prettify_test.html +2772 -0
  29. data/google-code-prettify/tests/test_base.js +132 -0
  30. data/google-code-prettify/tests/test_styles.css +5 -0
  31. data/hello.c +7 -0
  32. data/index.en.html +221 -120
  33. data/index.ja.html +182 -115
  34. data/lib/ulmul.rb +477 -276
  35. data/test/unit/ulmul_test.rb +21 -0
  36. data/ulmul-slidy.css +21 -8
  37. data/ulmul.gemspec +9 -5
  38. data/ulmul2html5.css +19 -5
  39. data/ulmul2xhtml.css +17 -1
  40. metadata +90 -12
  41. data/tests/ulmul_test.rb +0 -14
@@ -0,0 +1,53 @@
1
+ // Copyright (C) 2010 Nicky Sandhu.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+ /**
17
+ * @fileoverview
18
+ * Registers a language handler for Fortran code
19
+ * <p>
20
+ * This file could be used by google code to allow syntax highlighting.
21
+ * Use <pre class="prettyprint lang-fortran"> inject fortran code here <pre>
22
+ * <p>
23
+ * Known Limitations
24
+ * <ol>
25
+ * <li> Cannot handle case of comments on first line of file. The reason is that it matches
26
+ * for an end of line followed by a character to indicate comment (fortran reserves the first 6 columns
27
+ * for special meaning) </li>
28
+ * </ol>
29
+ * @author karajdaar@gmail.com
30
+ */
31
+
32
+ PR.registerLangHandler(
33
+ PR.createSimpleLexer(
34
+ [
35
+ // A single quoted string
36
+ [PR.PR_STRING, /^'([^\'\\]|\\[\s\S])*(?:\'|$)/, null, '\''],
37
+ ],
38
+ [
39
+ // A line comment that starts with after a new line with *,c or ! or ! anywhere on the line and ends on end of line
40
+ [PR.PR_COMMENT, /^(([\n]+([*|c|!]))|[!]).*(?=[\n]*)/i],
41
+ // A number is a hex integer literal, a decimal real literal, or in scientific notation.
42
+ [PR.PR_LITERAL, /^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:[e|d][+\-]?\d+)?))/i],
43
+ // a boolean literal
44
+ [PR.PR_LITERAL, /^([\.](TRUE|FALSE)[\.])/i],
45
+ // type keywords
46
+ [PR.PR_TYPE, /^(?:\s)+(CHARACTER|COMPLEX|DATA|DIMENSION|DOUBLE|DOUBLEPRECISION|EQUIVALENCE|EXTERNAL|INTEGER|INTRINSIC|PARAMETER|POINTER|PRECISION|LOGICAL|PURE|REAL)(\*(\d+))?(?:(\s|\(|$))/i,null],
47
+ // reserved keywords
48
+ [PR.PR_KEYWORD, /^(?:\s)(ALLOCATABLE|ALLOCATE|ASSIGNMENT|BACKSPACE|BLOCK|BLOCKDATA|CALL|CASE|CLOSE|COMMON|COMPLEX|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DEFAULT|DIMENSION|DO|ELEMENTAL|ELSE|ELSEIF|ELSEWHERE|END(BLOCK(DATA)?|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)?|ENTRY|EQUIVALENCE|ERR|EXIT|EXTERNAL|FOR(ALL|MAT)|GO(TO)?|IF|IMPLICIT|INCLUDE|INQUIRE|INTENT|INTERFACE|INTRINSIC|MODULE|NAMELIST|NONE|NULL(IFY)?|ONLY|OPEN|OPERATOR|OPTIONAL|PRECISION|PRINT|PRIVATE|PROCEDURE|PROGRAM|PUBLIC|READ|RECURSIVE|RESULT|RETURN|REWIND|SAVE|SELECT|SELECTCASE|SEQUENCE|STOP|SUBROUTINE|TARGET|THEN|TO|TYPE|USE|WHERE|WHILE|WRITE)(?=[^\w-]|$)/i,null],
49
+ // continuation marker
50
+ [PR.PR_PUNCTUATION, /^([\n]+[ ]{5}[\&])/],
51
+ ]),
52
+ ['fortran']);
53
+
@@ -0,0 +1,101 @@
1
+ // Copyright (C) 2009 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+
17
+ /**
18
+ * @fileoverview
19
+ * Registers a language handler for Haskell.
20
+ *
21
+ *
22
+ * To use, include prettify.js and this file in your HTML page.
23
+ * Then put your code in an HTML tag like
24
+ * <pre class="prettyprint lang-hs">(my lisp code)</pre>
25
+ * The lang-cl class identifies the language as common lisp.
26
+ * This file supports the following language extensions:
27
+ * lang-cl - Common Lisp
28
+ * lang-el - Emacs Lisp
29
+ * lang-lisp - Lisp
30
+ * lang-scm - Scheme
31
+ *
32
+ *
33
+ * I used http://www.informatik.uni-freiburg.de/~thiemann/haskell/haskell98-report-html/syntax-iso.html
34
+ * as the basis, but ignore the way the ncomment production nests since this
35
+ * makes the lexical grammar irregular. It might be possible to support
36
+ * ncomments using the lookbehind filter.
37
+ *
38
+ *
39
+ * @author mikesamuel@gmail.com
40
+ */
41
+
42
+ PR.registerLangHandler(
43
+ PR.createSimpleLexer(
44
+ [
45
+ // Whitespace
46
+ // whitechar -> newline | vertab | space | tab | uniWhite
47
+ // newline -> return linefeed | return | linefeed | formfeed
48
+ [PR.PR_PLAIN, /^[\t\n\x0B\x0C\r ]+/, null, '\t\n\x0B\x0C\r '],
49
+ // Single line double and single-quoted strings.
50
+ // char -> ' (graphic<' | \> | space | escape<\&>) '
51
+ // string -> " {graphic<" | \> | space | escape | gap}"
52
+ // escape -> \ ( charesc | ascii | decimal | o octal
53
+ // | x hexadecimal )
54
+ // charesc -> a | b | f | n | r | t | v | \ | " | ' | &
55
+ [PR.PR_STRING, /^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,
56
+ null, '"'],
57
+ [PR.PR_STRING, /^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,
58
+ null, "'"],
59
+ // decimal -> digit{digit}
60
+ // octal -> octit{octit}
61
+ // hexadecimal -> hexit{hexit}
62
+ // integer -> decimal
63
+ // | 0o octal | 0O octal
64
+ // | 0x hexadecimal | 0X hexadecimal
65
+ // float -> decimal . decimal [exponent]
66
+ // | decimal exponent
67
+ // exponent -> (e | E) [+ | -] decimal
68
+ [PR.PR_LITERAL,
69
+ /^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,
70
+ null, '0123456789']
71
+ ],
72
+ [
73
+ // Haskell does not have a regular lexical grammar due to the nested
74
+ // ncomment.
75
+ // comment -> dashes [ any<symbol> {any}] newline
76
+ // ncomment -> opencom ANYseq {ncomment ANYseq}closecom
77
+ // dashes -> '--' {'-'}
78
+ // opencom -> '{-'
79
+ // closecom -> '-}'
80
+ [PR.PR_COMMENT, /^(?:(?:--+(?:[^\r\n\x0C]*)?)|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],
81
+ // reservedid -> case | class | data | default | deriving | do
82
+ // | else | if | import | in | infix | infixl | infixr
83
+ // | instance | let | module | newtype | of | then
84
+ // | type | where | _
85
+ [PR.PR_KEYWORD, /^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/, null],
86
+ // qvarid -> [ modid . ] varid
87
+ // qconid -> [ modid . ] conid
88
+ // varid -> (small {small | large | digit | ' })<reservedid>
89
+ // conid -> large {small | large | digit | ' }
90
+ // modid -> conid
91
+ // small -> ascSmall | uniSmall | _
92
+ // ascSmall -> a | b | ... | z
93
+ // uniSmall -> any Unicode lowercase letter
94
+ // large -> ascLarge | uniLarge
95
+ // ascLarge -> A | B | ... | Z
96
+ // uniLarge -> any uppercase or titlecase Unicode letter
97
+ [PR.PR_PLAIN, /^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],
98
+ // matches the symbol production
99
+ [PR.PR_PUNCTUATION, /^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]
100
+ ]),
101
+ ['hs']);
@@ -0,0 +1,93 @@
1
+ // Copyright (C) 2008 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+
17
+ /**
18
+ * @fileoverview
19
+ * Registers a language handler for Common Lisp and related languages.
20
+ *
21
+ *
22
+ * To use, include prettify.js and this file in your HTML page.
23
+ * Then put your code in an HTML tag like
24
+ * <pre class="prettyprint lang-lisp">(my lisp code)</pre>
25
+ * The lang-cl class identifies the language as common lisp.
26
+ * This file supports the following language extensions:
27
+ * lang-cl - Common Lisp
28
+ * lang-el - Emacs Lisp
29
+ * lang-lisp - Lisp
30
+ * lang-scm - Scheme
31
+ *
32
+ *
33
+ * I used http://www.devincook.com/goldparser/doc/meta-language/grammar-LISP.htm
34
+ * as the basis, but added line comments that start with ; and changed the atom
35
+ * production to disallow unquoted semicolons.
36
+ *
37
+ * "Name" = 'LISP'
38
+ * "Author" = 'John McCarthy'
39
+ * "Version" = 'Minimal'
40
+ * "About" = 'LISP is an abstract language that organizes ALL'
41
+ * | 'data around "lists".'
42
+ *
43
+ * "Start Symbol" = [s-Expression]
44
+ *
45
+ * {Atom Char} = {Printable} - {Whitespace} - [()"\'']
46
+ *
47
+ * Atom = ( {Atom Char} | '\'{Printable} )+
48
+ *
49
+ * [s-Expression] ::= [Quote] Atom
50
+ * | [Quote] '(' [Series] ')'
51
+ * | [Quote] '(' [s-Expression] '.' [s-Expression] ')'
52
+ *
53
+ * [Series] ::= [s-Expression] [Series]
54
+ * |
55
+ *
56
+ * [Quote] ::= '' !Quote = do not evaluate
57
+ * |
58
+ *
59
+ *
60
+ * I used <a href="http://gigamonkeys.com/book/">Practical Common Lisp</a> as
61
+ * the basis for the reserved word list.
62
+ *
63
+ *
64
+ * @author mikesamuel@gmail.com
65
+ */
66
+
67
+ PR.registerLangHandler(
68
+ PR.createSimpleLexer(
69
+ [
70
+ ['opn', /^\(/, null, '('],
71
+ ['clo', /^\)/, null, ')'],
72
+ // A line comment that starts with ;
73
+ [PR.PR_COMMENT, /^;[^\r\n]*/, null, ';'],
74
+ // Whitespace
75
+ [PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
76
+ // A double quoted, possibly multi-line, string.
77
+ [PR.PR_STRING, /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
78
+ ],
79
+ [
80
+ [PR.PR_KEYWORD, /^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/, null],
81
+ [PR.PR_LITERAL,
82
+ /^[+\-]?(?:0x[0-9a-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[ed][+\-]?\d+)?)/i],
83
+ // A single quote possibly followed by a word that optionally ends with
84
+ // = ! or ?.
85
+ [PR.PR_LITERAL,
86
+ /^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
87
+ // A word that optionally ends with = ! or ?.
88
+ [PR.PR_PLAIN,
89
+ /^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
90
+ // A printable non-space non-special character
91
+ [PR.PR_PUNCTUATION, /^[^\w\t\n\r \xA0()\"\\\';]+/]
92
+ ]),
93
+ ['cl', 'el', 'lisp', 'scm']);
@@ -0,0 +1,59 @@
1
+ // Copyright (C) 2008 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+
17
+ /**
18
+ * @fileoverview
19
+ * Registers a language handler for Lua.
20
+ *
21
+ *
22
+ * To use, include prettify.js and this file in your HTML page.
23
+ * Then put your code in an HTML tag like
24
+ * <pre class="prettyprint lang-lua">(my Lua code)</pre>
25
+ *
26
+ *
27
+ * I used http://www.lua.org/manual/5.1/manual.html#2.1
28
+ * Because of the long-bracket concept used in strings and comments, Lua does
29
+ * not have a regular lexical grammar, but luckily it fits within the space
30
+ * of irregular grammars supported by javascript regular expressions.
31
+ *
32
+ * @author mikesamuel@gmail.com
33
+ */
34
+
35
+ PR.registerLangHandler(
36
+ PR.createSimpleLexer(
37
+ [
38
+ // Whitespace
39
+ [PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
40
+ // A double or single quoted, possibly multi-line, string.
41
+ [PR.PR_STRING, /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/, null, '"\'']
42
+ ],
43
+ [
44
+ // A comment is either a line comment that starts with two dashes, or
45
+ // two dashes preceding a long bracketed block.
46
+ [PR.PR_COMMENT, /^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],
47
+ // A long bracketed block not preceded by -- is a string.
48
+ [PR.PR_STRING, /^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],
49
+ [PR.PR_KEYWORD, /^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/, null],
50
+ // A number is a hex integer literal, a decimal real literal, or in
51
+ // scientific notation.
52
+ [PR.PR_LITERAL,
53
+ /^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
54
+ // An identifier
55
+ [PR.PR_PLAIN, /^[a-z_]\w*/i],
56
+ // A run of punctuation
57
+ [PR.PR_PUNCTUATION, /^[^\w\t\n\r \xA0][^\w\t\n\r \xA0\"\'\-\+=]*/]
58
+ ]),
59
+ ['lua']);
@@ -0,0 +1,56 @@
1
+ // Copyright (C) 2008 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+
17
+ /**
18
+ * @fileoverview
19
+ * Registers a language handler for OCaml, SML, F# and similar languages.
20
+ *
21
+ * Based on the lexical grammar at
22
+ * http://research.microsoft.com/fsharp/manual/spec2.aspx#_Toc202383715
23
+ *
24
+ * @author mikesamuel@gmail.com
25
+ */
26
+
27
+ PR.registerLangHandler(
28
+ PR.createSimpleLexer(
29
+ [
30
+ // Whitespace is made up of spaces, tabs and newline characters.
31
+ [PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
32
+ // #if ident/#else/#endif directives delimit conditional compilation
33
+ // sections
34
+ [PR.PR_COMMENT,
35
+ /^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,
36
+ null, '#'],
37
+ // A double or single quoted, possibly multi-line, string.
38
+ // F# allows escaped newlines in strings.
39
+ [PR.PR_STRING, /^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/, null, '"\'']
40
+ ],
41
+ [
42
+ // Block comments are delimited by (* and *) and may be
43
+ // nested. Single-line comments begin with // and extend to
44
+ // the end of a line.
45
+ // TODO: (*...*) comments can be nested. This does not handle that.
46
+ [PR.PR_COMMENT, /^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],
47
+ [PR.PR_KEYWORD, /^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
48
+ // A number is a hex integer literal, a decimal real literal, or in
49
+ // scientific notation.
50
+ [PR.PR_LITERAL,
51
+ /^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],
52
+ [PR.PR_PLAIN, /^(?:[a-z_]\w*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],
53
+ // A printable non-space non-special character
54
+ [PR.PR_PUNCTUATION, /^[^\t\n\r \xA0\"\'\w]+/]
55
+ ]),
56
+ ['fs', 'ml']);
@@ -0,0 +1,35 @@
1
+ // Copyright (C) 2006 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+ /**
17
+ * @fileoverview
18
+ * Registers a language handler for Protocol Buffers as described at
19
+ * http://code.google.com/p/protobuf/.
20
+ *
21
+ * Based on the lexical grammar at
22
+ * http://research.microsoft.com/fsharp/manual/spec2.aspx#_Toc202383715
23
+ *
24
+ * @author mikesamuel@gmail.com
25
+ */
26
+
27
+ PR.registerLangHandler(PR.sourceDecorator({
28
+ keywords: (
29
+ 'bool bytes default double enum extend extensions false fixed32 '
30
+ + 'fixed64 float group import int32 int64 max message option '
31
+ + 'optional package repeated required returns rpc service '
32
+ + 'sfixed32 sfixed64 sint32 sint64 string syntax to true uint32 '
33
+ + 'uint64'),
34
+ cStyleComments: true
35
+ }), ['proto']);
@@ -0,0 +1,54 @@
1
+ // Copyright (C) 2010 Google Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+
16
+ /**
17
+ * @fileoverview
18
+ * Registers a language handler for Scala.
19
+ *
20
+ * Derived from http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/SyntaxSummary.tex
21
+ *
22
+ * @author mikesamuel@gmail.com
23
+ */
24
+
25
+ PR.registerLangHandler(
26
+ PR.createSimpleLexer(
27
+ [
28
+ // Whitespace
29
+ [PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
30
+ // A double or single quoted string
31
+ // or a triple double-quoted multi-line string.
32
+ [PR.PR_STRING,
33
+ /^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/,
34
+ null, '"'],
35
+ [PR.PR_LITERAL, /^`(?:[^\r\n\\`]|\\.)*`?/, null, '`'],
36
+ [PR.PR_PUNCTUATION, /^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/, null,
37
+ '!#%&()*+,-:;<=>?@[\\]^{|}~']
38
+ ],
39
+ [
40
+ // A symbol literal is a single quote followed by an identifier with no
41
+ // single quote following
42
+ // A character literal has single quotes on either side
43
+ [PR.PR_STRING, /^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/],
44
+ [PR.PR_LITERAL, /^'[a-zA-Z_$][\w$]*(?!['$\w])/],
45
+ [PR.PR_KEYWORD, /^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
46
+ [PR.PR_LITERAL, /^(?:true|false|null|this)\b/],
47
+ [PR.PR_LITERAL, /^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i],
48
+ // Treat upper camel case identifiers as types.
49
+ [PR.PR_TYPE, /^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/],
50
+ [PR.PR_PLAIN, /^[$a-zA-Z_][\w$]*/],
51
+ [PR.PR_COMMENT, /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],
52
+ [PR.PR_PUNCTUATION, /^(?:\.+|\/)/]
53
+ ]),
54
+ ['scala']);