'*******************************************************************************
' EverEdit Syntax File
' Language:    Less
' Maintainer:  yulanggong  
' History:
'   2012/07/01 First Version
'*******************************************************************************
Include( ".\const.mac" )

Set rLessScript=CreateParser()

'comment
Set rLessLineComment=rLessScript.CreateRegion( COLOR_COMMENT1, "+//+", "$", False )
Set rLessBlockComment=rLessScript.CreateRegion( COLOR_COMMENT1, "+/*+", "+*/+", False )
rLessScript.AddRegion( rLessLineComment )
rLessScript.AddRegion( rLessBlockComment )

'string
Set rLessString2=rLessScript.CreateStringRegion( COLOR_STRING2, """", "", True )
Set rLessString1=rLessScript.CreateStringRegion( COLOR_STRING1, "'", "", True )

rLessScript.AddRegion( rLessString2 )
rLessScript.AddRegion( rLessString1 )


'tag
rLessScript.AddWord( rLessScript.CreateWord(COLOR_WORD2, "a abbr acronym address area article aside audio b base big blockquote body br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em eventsource fieldset figure figcaption footer form frame frameset h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label legend li link map mark menu meta meter nav noframes noscript object ol optgroup option output p param pre progress q samp script section select small span strike strong style sub summary sup svg table tbody td textarea tfoot th thead time title tr tt ul var video", False, "-") )

'property name
rLessScript.AddWord( rLessScript.CreateWord(COLOR_WORD1, "animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth background-attachment background-color background-clip background-image background-origin background-position background-repeat background-size background backface-visibility behavior border-bottom-color border-bottom-style border-bottom-width border-bottom-left-radius border-bottom-right-radius border-bottom border-collapse border-color border-left-color border-left-style border-left-width border-left border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-style border-top-width border-top-left-radius border-top-right-radius border-top border-width border-radius border-box border box-align box-shadow box-sizing bottom caption-side clear clip color-stop color column-count column-gap columns content-box content counter-increment counter-reset cue-after cue-before cue cursor direction display elevation empty-cells float font-family font-size-adjust font-size font-stretch font-style font-variant font-weight font height hyphens left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top marker-offset margin marks max-height max-width min-device-pixel-ratio min-height min-width opacity orientation orphans outline-offset outline-color outline-style outline-width outline overflow overflow-x overflow-y padding-bottom padding-left padding-right padding-top padding-box padding page-break-after page-break-before page-break-inside page pause-after pause-before pause perspective-origin perspective-origin-x perspective-origin-y perspective pitch-range pitch play-during position quotes resize richness right size speak-header speak-numeral speak-punctuation speech-rate speak stress table-layout text-align text-decoration text-indent text-shadow text-transform top transform-origin transform-origin-x transform-origin-y transform-origin-z transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-family volume white-space widows width word-spacing word-wrap z-index zoom filter word-break user-select text-rendering", False, "-") )

'property name vender
rLessScript.AddItem( rLessScript.CreateItem(COLOR_WORD3, "(-(?:webkit|moz|khtml|o|ms|icab)-(?:animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|backface-visibility|background-clip|background-origin|background-size|border-image|border-radius-topleft|border-radius-bottomleft|border-radius-topright|border-radius-bottomright|border-radius|box-align|box-shadow|box-sizing|column-count|column-gap|columns|font-smoothing|min-device-pixel-ratio|opacity|perspective-origin-x|perspective-origin-y|perspective-origin|perspective|tap-highlight-color|text-size-adjust|text-stroke|transform-origin-x|transform-origin-y|transform-origin-z|transform-style|transform-origin|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|input-placeholder|placeholder|inline-stack|border-top-left-radius|border-top-right-radius|border-bottom-left-radius|border-bottom-right-radius|focus-inner|margin-top-collapse|focus-ring-color|user-select|touch-callout|filter))\s*(?:)", True) )

'property value
rLessScript.AddWord( rLessScript.CreateWord(COLOR_WORD3, "absolute all-scroll all always auto baseline below bidi-override block bold bolder border-box both bottom break-all break-word capitalize center char circle col-resize collapse content-box crosshair dashed decimal default disabled disc distribute-all-lines distribute-letter distribute-space distribute dotted double e-resize ease-in-out ease-in ease-out ease ellipsis fixed groove hand help hidden horizontal ideograph-alpha ideograph-numeric ideograph-parenthesis ideograph-space inactive inherit inline-block inline inset inside inter-ideograph inter-word italic justify keep-all landscape left lighter line-edge line-through line linear-gradient linear list-item loose lower-alpha lower-roman lowercase lr-tb ltr medium middle move n-resize ne-resize newspaper no-drop no-repeat cover contain nw-resize none normal not-allowed nowrap oblique outset outside overline padding-box pointer-events pointer portrait pre-wrap progress relative repeat-x repeat-y repeat right ridge rotate row-resize rtl s-resize scroll se-resize separate small-caps solid square static strict super sw-resize table-footer-group table-header-group tb-rl text-bottom text-top text thick thin top transparent underline upper-alpha upper-roman uppercase vertical-ideographic vertical-text vertical visible w-resize wait whitespace initial radial bicubic textfield", False, "-") )

'function (mixin)
Set mixin = rLessScript.CreateItem(COLOR_DEFAULT, "(\.[a-zA-Z0-9_-]+)\s*(;|\()", False)
mixin.Capture 1, COLOR_FUNCTION
rLessScript.AddItem( mixin )

'buildin function
rLessScript.AddWord( rLessScript.CreateWord(COLOR_FUNCTION, "color saturate desaturate lighten darken grayscale fade fadein fadeout spin mix hue saturation lightness alpha round ceil floor percentage translate rotate scale skew matrix matrix3d translate3d translateX translateY translateZ scale3d scaleX scaleY scaleZ rotate3d rotateX rotateY rotateZ perspective rgb rgba hsl hsla url format src cubic-bezier", False, "-"))

'@
rLessScript.AddItem( rLessScript.CreateItem(COLOR_WORD4, "@[a-zA-Z0-9_-]+)\b", True) )

'color
rLessScript.AddItem( rLessScript.CreateItem(COLOR_NUMBER, "#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b", True) )

'number
Set number = rLessScript.CreateItem(COLOR_DEFAULT, "(\s|\(|\/|,)(-?(\d+(\.\d+)?|\.\d+)[\w%]{0,4})", True)
number.Capture 2, COLOR_NUMBER
rLessScript.AddItem( number )

'pseudo class, pseudo element
rLessScript.AddItem( rLessScript.CreateItem(COLOR_WORD4, "(:+)\b(after|before|disabled|empty|enabled|first-child|first-letter|first-line|first-of-type|invalid|last-of-type|last-child|only-child|only-of-type|selection|target|valid|required|nth-child|active|hover|link|visited|focus)\b", True) )


Call rLessScript.CommentBlock("/*", "*/")
Call rLessScript.CommentLine("//")
Call rLessScript.SetPairs( "()[]{}""""''" )
Call rLessScript.FoldText( "\{", False )
Call rLessScript.UnfoldText( "\}", False )
Call rLessScript.IndentText( "\{\s$", False )
Call rLessScript.UnindentText( "^\s*}$", False )

