Sha256: 562f1b8fd7da9962844f8caf3ffee73ee9ed7678b64208078a22d908959f35c8

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

/**
 * Original by Samuel Flores
 *
 * Adds the following new token classes:
 * 		constant, builtin, variable, symbol, regex
 */
Prism.languages.ruby = Prism.languages.extend('clike', {
	'comment': /#[^\r\n]*(\r?\n|$)/g,
	'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/g,
	'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
	'constant': /\b[A-Z][a-zA-Z_0-9]*[?!]?\b/g
});

Prism.languages.insertBefore('ruby', 'keyword', {
	'regex': {
		pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
		lookbehind: true
	},
	'variable': /[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g,
	'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyhyhy-1.0.0 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.9 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.8 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.7 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.6 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.5 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js
hyhyhy-0.0.4 lib/hyhyhy/structure/_includes/prism/components/prism-ruby.js