Skip to content

Commit

Permalink
SAS: Simplified datalines and optimized operator patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Aug 30, 2015
1 parent 8b97850 commit 6ebb96f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions components/prism-sas.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
Prism.languages.sas = {
'datalines': {
pattern: /(^|[\r\n])\s*(?:(?:data)?lines|cards);[\s\S]+?[\r\n];/i,
lookbehind: true,
pattern: /^\s*(?:(?:data)?lines|cards);[\s\S]+?(?:\r?\n|\r);/im,
alias: 'string',
inside: {
'keyword': {
pattern: /^(\s*)(?:(?:data)?lines|cards)/i,
lookbehind: true
},
'punctuation': /;/,
'data': {
pattern: /[\s\S]+/,
alias: 'string'
}
'punctuation': /;/
}
},
'comment': [
Expand All @@ -23,13 +19,13 @@ Prism.languages.sas = {
],
'datetime': {
// '1jan2013'd, '9:25:19pm't, '18jan2003:9:27:05am'dt
pattern: /'[^']+'(?:d|d?t)\b/i,
pattern: /'[^']+'(?:dt?|t)\b/i,
alias: 'number'
},
'string': /(["'])(?:\1\1|(?!\1)[\s\S])*\1/,
'keyword': /\b(?:data|else|format|if|input|proc|run|then)\b/i,
// Decimal (1.2e23), hexadecimal (0c1x)
'number': /(?:\B-|\b)(?:[\da-f]+x|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,
'operator': /\*\*|\|\||!!|¦¦|<>|><|[~¬^<>]?=|[*\/+\-<>&\|!¦~¬^]|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,
'operator': /\*\*?|\|\|?|!!?|¦¦?|<[>=]?|>[<=]?|[-+\/=&]|[~¬^]=?|\b(?:eq|ne|gt|lt|ge|le|in|not)\b/i,
'punctuation': /[$%@.(){}\[\];,\\]/
};
2 changes: 1 addition & 1 deletion components/prism-sas.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ebb96f

Please sign in to comment.