@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121THE SOFTWARE.
2222
2323*/
24- /* Version v0.1.9 , Build time: 23-July -2012 10:52:31 */
24+ /* Version v0.2.0 , Build time: 13-November -2012 01:17:54 */
2525var parserlib = { } ;
2626( function ( ) {
2727
@@ -908,7 +908,7 @@ TokenStreamBase : TokenStreamBase
908908} ) ( ) ;
909909
910910
911- /*
911+ /*
912912Parser-Lib
913913Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
914914
@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931THE SOFTWARE.
932932
933933*/
934- /* Version v0.1.9 , Build time: 23-July -2012 10:52:31 */
934+ /* Version v0.2.0 , Build time: 13-November -2012 01:17:54 */
935935( function ( ) {
936936var EventTarget = parserlib . util . EventTarget ,
937937TokenStreamBase = parserlib . util . TokenStreamBase ,
@@ -2145,7 +2145,7 @@ Parser.prototype = function(){
21452145
21462146 //there must be a next selector
21472147 if ( nextSelector === null ) {
2148- this . _unexpectedToken ( this . LT ( 1 ) ) ;
2148+ this . _unexpectedToken ( tokenStream . LT ( 1 ) ) ;
21492149 } else {
21502150
21512151 //nextSelector is an instance of SelectorPart
@@ -3597,7 +3597,7 @@ var Properties = {
35973597 valid = ValidationTypes . isAny ( expression , numeric ) ;
35983598 if ( ! valid ) {
35993599
3600- if ( expression . peek ( ) == "/" && count > 1 && ! slash ) {
3600+ if ( expression . peek ( ) == "/" && count > 0 && ! slash ) {
36013601 slash = true ;
36023602 max = count + 5 ;
36033603 expression . next ( ) ;
@@ -5980,7 +5980,7 @@ var ValidationTypes = {
59805980 } ,
59815981
59825982 /**
5983- * Determines if the next part(s) of the given expresion
5983+ * Determines if the next part(s) of the given expression
59845984 * are one of a group.
59855985 */
59865986 isAnyOfGroup : function ( expression , types ) {
@@ -6127,10 +6127,16 @@ var ValidationTypes = {
61276127 var types = this ,
61286128 result = false ,
61296129 numeric = "<percentage> | <length>" ,
6130- xDir = "left | center | right" ,
6131- yDir = "top | center | bottom" ,
6132- part ,
6133- i , len ;
6130+ xDir = "left | right" ,
6131+ yDir = "top | bottom" ,
6132+ count = 0 ,
6133+ hasNext = function ( ) {
6134+ return expression . hasNext ( ) && expression . peek ( ) != "," ;
6135+ } ;
6136+
6137+ while ( expression . peek ( count ) && expression . peek ( count ) != "," ) {
6138+ count ++ ;
6139+ }
61346140
61356141/*
61366142<position> = [
@@ -6142,40 +6148,48 @@ var ValidationTypes = {
61426148 [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
61436149 [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
61446150]
6151+ */
61456152
6146- */
6147-
6148- if ( ValidationTypes . isAny ( expression , "top | bottom" ) ) {
6149- result = true ;
6153+ if ( count < 3 ) {
6154+ if ( ValidationTypes . isAny ( expression , xDir + " | center | " + numeric ) ) {
6155+ result = true ;
6156+ ValidationTypes . isAny ( expression , yDir + " | center | " + numeric ) ;
6157+ } else if ( ValidationTypes . isAny ( expression , yDir ) ) {
6158+ result = true ;
6159+ ValidationTypes . isAny ( expression , xDir + " | center" ) ;
6160+ }
61506161 } else {
6151-
6152- //must be two-part
6153- if ( ValidationTypes . isAny ( expression , numeric ) ) {
6154- if ( expression . hasNext ( ) ) {
6155- result = ValidationTypes . isAny ( expression , numeric + " | " + yDir ) ;
6156- }
6157- } else if ( ValidationTypes . isAny ( expression , xDir ) ) {
6158- if ( expression . hasNext ( ) ) {
6159-
6160- //two- or three-part
6161- if ( ValidationTypes . isAny ( expression , yDir ) ) {
6162+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6163+ if ( ValidationTypes . isAny ( expression , yDir ) ) {
6164+ result = true ;
6165+ ValidationTypes . isAny ( expression , numeric ) ;
6166+ } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6167+ if ( ValidationTypes . isAny ( expression , yDir ) ) {
61626168 result = true ;
6163-
61646169 ValidationTypes . isAny ( expression , numeric ) ;
6165-
6166- } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6167-
6168- //could also be two-part, so check the next part
6169- if ( ValidationTypes . isAny ( expression , yDir ) ) {
6170- ValidationTypes . isAny ( expression , numeric ) ;
6171- }
6172-
6170+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
61736171 result = true ;
61746172 }
61756173 }
6176- }
6177- }
6178-
6174+ } else if ( ValidationTypes . isAny ( expression , yDir ) ) {
6175+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6176+ result = true ;
6177+ ValidationTypes . isAny ( expression , numeric ) ;
6178+ } else if ( ValidationTypes . isAny ( expression , numeric ) ) {
6179+ if ( ValidationTypes . isAny ( expression , xDir ) ) {
6180+ result = true ;
6181+ ValidationTypes . isAny ( expression , numeric ) ;
6182+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
6183+ result = true ;
6184+ }
6185+ }
6186+ } else if ( ValidationTypes . isAny ( expression , "center" ) ) {
6187+ if ( ValidationTypes . isAny ( expression , xDir + " | " + yDir ) ) {
6188+ result = true ;
6189+ ValidationTypes . isAny ( expression , numeric ) ;
6190+ }
6191+ }
6192+ }
61796193
61806194 return result ;
61816195 } ,
@@ -6282,9 +6296,10 @@ var ValidationTypes = {
62826296} ;
62836297
62846298
6299+
62856300parserlib . css = {
6286- Colors :Colors ,
6287- Combinator :Combinator ,
6301+ Colors :Colors ,
6302+ Combinator :Combinator ,
62886303Parser :Parser ,
62896304PropertyName :PropertyName ,
62906305PropertyValue :PropertyValue ,
0 commit comments