(parser)
| 6248 | } |
| 6249 | }; |
| 6250 | function _parseScrollModifiers(parser) { |
| 6251 | parser.matchToken("the"); |
| 6252 | var verticalPosition = parser.matchAnyToken("top", "middle", "bottom"); |
| 6253 | var horizontalPosition = parser.matchAnyToken("left", "center", "right"); |
| 6254 | if (verticalPosition || horizontalPosition) { |
| 6255 | parser.requireToken("of"); |
| 6256 | } |
| 6257 | var target = parser.requireElement("unaryExpression"); |
| 6258 | var plusOrMinus = parser.matchAnyOpToken("+", "-"); |
| 6259 | var offset; |
| 6260 | if (plusOrMinus) { |
| 6261 | parser.pushFollow("px"); |
| 6262 | try { |
| 6263 | offset = parser.requireElement("expression"); |
| 6264 | } finally { |
| 6265 | parser.popFollow(); |
| 6266 | } |
| 6267 | } |
| 6268 | parser.matchToken("px"); |
| 6269 | var container; |
| 6270 | if (parser.matchToken("in")) { |
| 6271 | container = parser.requireElement("unaryExpression"); |
| 6272 | } |
| 6273 | var smoothness = parser.matchAnyToken("smoothly", "instantly"); |
| 6274 | var scrollOptions = { block: "start", inline: "nearest" }; |
| 6275 | var blockMap = { top: "start", bottom: "end", middle: "center" }; |
| 6276 | var inlineMap = { left: "start", center: "center", right: "end" }; |
| 6277 | var behaviorMap = { smoothly: "smooth", instantly: "instant" }; |
| 6278 | if (verticalPosition) scrollOptions.block = blockMap[verticalPosition.value]; |
| 6279 | if (horizontalPosition) scrollOptions.inline = inlineMap[horizontalPosition.value]; |
| 6280 | if (smoothness) scrollOptions.behavior = behaviorMap[smoothness.value]; |
| 6281 | return { target, offset, plusOrMinus, scrollOptions, container }; |
| 6282 | } |
| 6283 | function _parseSmoothness(parser) { |
| 6284 | var smoothness = parser.matchAnyToken("smoothly", "instantly"); |
| 6285 | if (!smoothness) return void 0; |
no test coverage detected