-
Notifications
You must be signed in to change notification settings - Fork 1
/
shbrushdax.js
23 lines (20 loc) · 5.8 KB
/
shbrushdax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* SQLBI - info@sqlbi.com
* https://www.sqlbi.com
*/
SyntaxHighlighter.brushes.DAX = function() {
const funcs = 'INFO.GENERALSEGMENTMAPSEGMENTMETADATASTORAGES INFO.ATTRIBUTEHIERARCHYSTORAGES INFO.DELTATABLEMETADATASTORAGES INFO.STORAGETABLECOLUMNSEGMENTS INFO.RELATIONSHIPINDEXSTORAGES INFO.COLUMNPARTITIONSTORAGES INFO.DATACOVERAGEDEFINITIONS INFO.FORMATSTRINGDEFINITIONS SAMPLECARTESIANPOINTSBYCOVER INFO.ALTERNATEOFDEFINITIONS INFO.PERSPECTIVEHIERARCHIES SELECTEDMEASUREFORMATSTRING INFO.DETAILROWSDEFINITIONS INFO.ATTRIBUTEHIERARCHIES INFO.RELATEDCOLUMNDETAILS INFO.RELATIONSHIPSTORAGES SAMPLEAXISWITHLOCALMINMAX APPROXIMATEDISTINCTCOUNT INFO.PARQUETFILESTORAGES INFO.PERSPECTIVEMEASURES INFO.STORAGETABLECOLUMNS INFO.DICTIONARYSTORAGES INFO.EXTENDEDPROPERTIES INFO.LINGUISTICMETADATA INFO.OBJECTTRANSLATIONS INFO.PERSPECTIVECOLUMNS INFO.SEGMENTMAPSTORAGES INFO.CALCULATIONGROUPS INFO.CHANGEDPROPERTIES INFO.COLUMNPERMISSIONS INFO.EXCLUDEDARTIFACTS INFO.HIERARCHYSTORAGES INFO.PARTITIONSTORAGES INFO.PERSPECTIVETABLES CLOSINGBALANCEQUARTER INFO.CALCULATIONITEMS INFO.TABLEPERMISSIONS OPENINGBALANCEQUARTER DISTINCTCOUNTNOBLANK INFO.REFRESHPOLICIES INFO.ROLEMEMBERSHIPS INFO.SEGMENTSTORAGES NATURALLEFTOUTERJOIN CLOSINGBALANCEMONTH CONTAINSSTRINGEXACT INFO.CALCDEPENDENCY INFO.COLUMNSTORAGES INFO.GROUPBYCOLUMNS INFO.STORAGEFOLDERS OPENINGBALANCEMONTH ROLLUPADDISSUBTOTAL SELECTEDMEASURENAME SUBSTITUTEWITHINDEX CLOSINGBALANCEYEAR FIRSTNONBLANKVALUE INFO.RELATIONSHIPS INFO.STORAGETABLES INFO.TABLESTORAGES OPENINGBALANCEYEAR SAMEPERIODLASTYEAR INFO.PERSPECTIVES INFO.STORAGEFILES ISSELECTEDMEASURE LASTNONBLANKVALUE USERPRINCIPALNAME ALLCROSSFILTERED COLUMNSTATISTICS INFO.ANNOTATIONS INFO.DATASOURCES INFO.EXPRESSIONS INFO.HIERARCHIES INFO.QUERYGROUPS NATURALINNERJOIN ROLLUPISSUBTOTAL SUMMARIZECOLUMNS ADDMISSINGITEMS CONFIDENCE.NORM EXTERNALMEASURE INFO.PARTITIONS INFO.PROPERTIES INFO.VARIATIONS ISCROSSFILTERED PATHITEMREVERSE PERCENTILEX.EXC PERCENTILEX.INC PREVIOUSQUARTER SELECTEDMEASURE USERELATIONSHIP CALCULATETABLE CONTAINSSTRING EVALUATEANDLOG GENERATESERIES INFO.FUNCTIONS PARALLELPERIOD PERCENTILE.EXC PERCENTILE.INC STARTOFQUARTER ALLNOBLANKROW CHISQ.DIST.RT COMBINEVALUES DATESINPERIOD DISTINCTCOUNT FIRSTNONBLANK INFO.CATALOGS INFO.CULTURES INFO.MEASURES MOVINGAVERAGE PREVIOUSMONTH REMOVEFILTERS SELECTCOLUMNS SELECTEDVALUE CALENDARAUTO CHISQ.INV.RT CONCATENATEX CONFIDENCE.T CURRENTGROUP DATESBETWEEN ENDOFQUARTER HASONEFILTER INFO.COLUMNS KEYWORDMATCH LASTNONBLANK PATHCONTAINS POISSON.DIST PREVIOUSYEAR RELATEDTABLE STARTOFMONTH TOPNPERLEVEL USEROBJECTID ALLSELECTED COLLAPSEALL CONCATENATE CONTAINSROW CROSSFILTER GENERATEALL HASONEVALUE INFO.LEVELS INFO.TABLES ISO.CEILING ISONORAFTER KEEPFILTERS LOOKUPVALUE NETWORKDAYS NEXTQUARTER NORM.S.DIST PARTITIONBY PREVIOUSDAY RANDBETWEEN ROLLUPGROUP STARTOFYEAR USERCULTURE ADDCOLUMNS CHISQ.DIST COUNTBLANK COUPDAYSNC CUSTOMDATA DETAILROWS ENDOFMONTH EXPON.DIST INFO.MODEL INFO.ROLES ISFILTERED ISSUBTOTAL NORM.S.INV PATHLENGTH RUNNINGSUM SUBSTITUTE TBILLPRICE TBILLYIELD ALLEXCEPT AMORDEGRC BETA.DIST BITLSHIFT BITRSHIFT CALCULATE CHISQ.INV COUNTROWS COUPDAYBS CROSSJOIN DATATABLE DATEVALUE ENDOFYEAR EXPANDALL FIRSTDATE INFO.KPIS INTERSECT ISATLEVEL ISINSCOPE ISLOGICAL ISNONTEXT MDURATION NEXTMONTH NONVISUAL NORM.DIST ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD PDURATION PRICEDISC ROUNDDOWN ROWNUMBER SUMMARIZE T.DIST.2T T.DIST.RT TIMEVALUE YIELDDISC ACCRINTM AMORLINC AVERAGEA AVERAGEX BETA.INV CALENDAR COALESCE COLLAPSE CONTAINS COUPDAYS CUMPRINC CURRENCY DATEDIFF DATESMTD DATESQTD DATESYTD DISTINCT DOLLARDE DOLLARFR DURATION EARLIEST GENERATE GEOMEANX IF.EAGER ISNUMBER LASTDATE NEXTYEAR NORM.INV PATHITEM PREVIOUS PRICEMAT PRODUCTX QUOTIENT RECEIVED STDEVX.P STDEVX.S T.INV.2T TOPNSKIP TOTALMTD TOTALQTD TOTALYTD USERNAME UTCTODAY YEARFRAC YIELDMAT ACCRINT AVERAGE CEILING COMBINA CONVERT COUNTAX COUPNCD COUPNUM COUPPCD CUMIPMT DATEADD DEGREES EARLIER EOMONTH FILTERS GEOMEAN GROUPBY IFERROR INTRATE ISAFTER ISBLANK ISEMPTY ISERROR LINESTX MATCHBY MEDIANX NEXTDAY NOMINAL ORDERBY PRODUCT QUARTER RADIANS RANK.EQ RELATED REPLACE ROUNDUP STDEV.P STDEV.S TBILLEQ TREATAS UNICHAR UNICODE WEEKDAY WEEKNUM BITAND BITXOR COMBIN COUNTA COUNTX DIVIDE EFFECT EXCEPT EXPAND FILTER FORMAT IGNORE ISEVEN ISTEXT LINEST LOOKUP MEDIAN MINUTE MROUND NAMEOF OFFSET PERMUT ROLLUP SAMPLE SEARCH SECOND SQRTPI SWITCH T.DIST TOJSON UTCNOW VALUES VARX.P VARX.S WINDOW ACOSH ACOTH ASINH ATANH BITOR BLANK COUNT EDATE ERROR EXACT FALSE FIRST FIXED FLOOR INDEX ISODD ISPMT LOG10 LOWER MONTH POWER PRICE RANGE RANKX RIGHT ROUND T.INV TOCSV TODAY TRUNC UNION UPPER VALUE VAR.P VAR.S YIELD ACOS ACOT ASIN ATAN COSH COTH DATE DISC EVEN FACT FIND HASH HOUR IPMT LAST LEFT MAXA MAXX MINA MINX NEXT NPER PATH PPMT RAND RANK RATE REPT SIGN SINH SQRT SUMX TANH TIME TOPN TRIM TRUE XIRR XNPV YEAR ABS ALL AND COS COT DAY DDB EXP GCD INT LCM LEN LOG MAX MID MIN MOD NOT NOW ODD PMT ROW RRI SIN SLN SUM SYD TAN VDB DB FV IF LN OR PI PV';
this.regexList = [
{ regex: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/).*)/gm, css: 'comments' },
{ regex: /"(?:[^"]|"")*"(?!")/gm, css: 'string' },
{ regex: /'(?:[^']|'')*'(?!')(?:\[[ \w\xA0-\uFFFF]+\])?|\w+\[[ \w\xA0-\uFFFF]+\]/gm, css: 'columns' },
{ regex: /\[[ \w\xA0-\uFFFF]+\]/gm, css: 'measures' },
{ regex: new RegExp(this.getKeywords(funcs), 'gm'), css: 'functions' },
{ regex: /\b(?:AXIS|ROWS|COLUMN|DEFINE|DENSIFY|EVALUATE|GROUP|MEASURE|MPARAMETER|ORDER BY|RETURN|START AT|TABLE|TOTAL|VAR|WITH VISUAL SHAPE)\b/gm, css: 'keyword' },
{ regex: /:=|[-+*\/=^]|\b(?:IN|NOT)\b/i, css: 'operator' },
{ regex: /\b\d+\.?\d*|\B\.\d+\b/i, css: 'number' },
{ regex: /[\[\](){}`,.]/gm, css: 'parenthesis' }
];
};
SyntaxHighlighter.brushes.DAX.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.DAX.aliases = ['dax'];