Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Unified Diff: lib/src/prism/components/prism-inform7.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-http.min.js ('k') | lib/src/prism/components/prism-inform7.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-inform7.js
diff --git a/lib/src/prism/components/prism-inform7.js b/lib/src/prism/components/prism-inform7.js
new file mode 100644
index 0000000000000000000000000000000000000000..91aca0e2cad707d48a6278bce2e622ceb9568c22
--- /dev/null
+++ b/lib/src/prism/components/prism-inform7.js
@@ -0,0 +1,58 @@
+Prism.languages.inform7 = {
+ 'string': {
+ pattern: /"[^"]*"/,
+ inside: {
+ 'substitution': {
+ pattern: /\[[^\]]+\]/,
+ inside: {
+ 'delimiter': {
+ pattern:/\[|\]/,
+ alias: 'punctuation'
+ }
+ // See rest below
+ }
+ }
+ }
+ },
+ 'comment': /\[[^\]]+\]/,
+ 'title': {
+ pattern: /^[ \t]*(?:volume|book|part(?! of)|chapter|section|table)\b.+/im,
+ alias: 'important'
+ },
+ 'number': {
+ pattern: /(^|[^-])(?:(?:\b|-)\d+(?:\.\d+)?(?:\^\d+)?\w*|\b(?:one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve))\b(?!-)/i,
+ lookbehind: true
+ },
+ 'verb': {
+ pattern: /(^|[^-])\b(?:applying to|are|attacking|answering|asking|be(?:ing)?|burning|buying|called|carries|carry(?! out)|carrying|climbing|closing|conceal(?:s|ing)?|consulting|contain(?:s|ing)?|cutting|drinking|dropping|eating|enclos(?:es?|ing)|entering|examining|exiting|getting|giving|going|ha(?:ve|s|ving)|hold(?:s|ing)?|impl(?:y|ies)|incorporat(?:es?|ing)|inserting|is|jumping|kissing|listening|locking|looking|mean(?:s|ing)?|opening|provid(?:es?|ing)|pulling|pushing|putting|relat(?:es?|ing)|removing|searching|see(?:s|ing)?|setting|showing|singing|sleeping|smelling|squeezing|switching|support(?:s|ing)?|swearing|taking|tasting|telling|thinking|throwing|touching|turning|tying|unlock(?:s|ing)?|var(?:y|ies|ying)|waiting|waking|waving|wear(?:s|ing)?)\b(?!-)/i,
+ lookbehind: true,
+ alias: 'operator'
+ },
+ 'keyword': {
+ pattern: /(^|[^-])\b(?:after|before|carry out|check|continue the action|definition(?= *:)|do nothing|else|end (?:if|unless|the story)|every turn|if|include|instead(?: of)?|let|move|no|now|otherwise|repeat|report|resume the story|rule for|running through|say(?:ing)?|stop the action|test|try(?:ing)?|understand|unless|use|when|while|yes)\b(?!-)/i,
+ lookbehind: true
+ },
+ 'property': {
+ pattern: /(^|[^-])\b(?:adjacent(?! to)|carried|closed|concealed|contained|dark|described|edible|empty|enclosed|enterable|even|female|fixed in place|full|handled|held|improper-named|incorporated|inedible|invisible|lighted|lit|lock(?:able|ed)|male|marked for listing|mentioned|negative|neuter|non-(?:empty|full|recurring)|odd|opaque|open(?:able)?|plural-named|portable|positive|privately-named|proper-named|provided|publically-named|pushable between rooms|recurring|related|rubbing|scenery|seen|singular-named|supported|swinging|switch(?:able|ed(?: on| off)?)|touch(?:able|ed)|transparent|unconcealed|undescribed|unlit|unlocked|unmarked for listing|unmentioned|unopenable|untouchable|unvisited|variable|visible|visited|wearable|worn)\b(?!-)/i,
+ lookbehind: true,
+ alias: 'symbol'
+ },
+ 'position': {
+ pattern: /(^|[^-])\b(?:above|adjacent to|back side of|below|between|down|east|everywhere|front side|here|in|inside(?: from)?|north(?:east|west)?|nowhere|on(?: top of)?|other side|outside(?: from)?|parts? of|regionally in|south(?:east|west)?|through|up|west|within)\b(?!-)/i,
+ lookbehind: true,
+ alias: 'keyword'
+ },
+ 'type': {
+ pattern: /(^|[^-])\b(?:actions?|activit(?:y|ies)|actors?|animals?|backdrops?|containers?|devices?|directions?|doors?|holders?|kinds?|lists?|m[ae]n|nobody|nothing|nouns?|numbers?|objects?|people|persons?|player(?:'s holdall)?|regions?|relations?|rooms?|rule(?:book)?s?|scenes?|someone|something|supporters?|tables?|texts?|things?|time|vehicles?|wom[ae]n)\b(?!-)/i,
+ lookbehind: true,
+ alias: 'variable'
+ },
+ 'punctuation': /[.,:;(){}]/
+};
+
+Prism.languages.inform7['string'].inside['substitution'].inside.rest = Prism.util.clone(Prism.languages.inform7);
+// We don't want the remaining text in the substitution to be highlighted as the string.
+Prism.languages.inform7['string'].inside['substitution'].inside.rest.text = {
+ pattern: /\S(?:\s*\S)*/,
+ alias: 'comment'
+};
« no previous file with comments | « lib/src/prism/components/prism-http.min.js ('k') | lib/src/prism/components/prism-inform7.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698