@@ -944,12 +944,28 @@ namespace Sass {
944944 return 0 ;
945945 }
946946
947+ const char * Parser::re_attr_sensitive_close (const char * src)
948+ {
949+ return alternatives < exactly<' ]' >, exactly<' /' > >(src);
950+ }
951+
952+ const char * Parser::re_attr_insensitive_close (const char * src)
953+ {
954+ return sequence < insensitive<' i' >, re_attr_sensitive_close >(src);
955+ }
956+
947957 Attribute_Selector_Obj Parser::parse_attribute_selector ()
948958 {
949959 ParserState p = pstate;
950960 if (!lex_css< attribute_name >()) error (" invalid attribute name in attribute selector" , pstate);
951961 std::string name (lexed);
952- if (lex_css< alternatives < exactly<' ]' >, exactly<' /' > > >()) return SASS_MEMORY_NEW (Attribute_Selector, p, name, " " , 0 );
962+ if (lex_css< re_attr_sensitive_close >()) {
963+ return SASS_MEMORY_NEW (Attribute_Selector, p, name, " " , 0 , 0 );
964+ }
965+ else if (lex_css< re_attr_insensitive_close >()) {
966+ char modifier = lexed.begin [0 ];
967+ return SASS_MEMORY_NEW (Attribute_Selector, p, name, " " , 0 , modifier);
968+ }
953969 if (!lex_css< alternatives< exact_match, class_match, dash_match,
954970 prefix_match, suffix_match, substring_match > >()) {
955971 error (" invalid operator in attribute selector for " + name, pstate);
@@ -967,8 +983,15 @@ namespace Sass {
967983 error (" expected a string constant or identifier in attribute selector for " + name, pstate);
968984 }
969985
970- if (!lex_css< alternatives < exactly<' ]' >, exactly<' /' > > >()) error (" unterminated attribute selector for " + name, pstate);
971- return SASS_MEMORY_NEW (Attribute_Selector, p, name, matcher, value);
986+ if (lex_css< re_attr_sensitive_close >()) {
987+ return SASS_MEMORY_NEW (Attribute_Selector, p, name, matcher, value, 0 );
988+ }
989+ else if (lex_css< re_attr_insensitive_close >()) {
990+ char modifier = lexed.begin [0 ];
991+ return SASS_MEMORY_NEW (Attribute_Selector, p, name, matcher, value, modifier);
992+ }
993+ error (" unterminated attribute selector for " + name, pstate);
994+ return NULL ; // to satisfy compilers (error must not return)
972995 }
973996
974997 /* parse block comment and add to block */
0 commit comments