(parser)
| 5889 | } |
| 5890 | }; |
| 5891 | function _parseScrollModifiers(parser) { |
| 5892 | parser.matchToken("the"); |
| 5893 | var verticalPosition = parser.matchAnyToken("top", "middle", "bottom"); |
| 5894 | var horizontalPosition = parser.matchAnyToken("left", "center", "right"); |
| 5895 | if (verticalPosition || horizontalPosition) { |
| 5896 | parser.requireToken("of"); |
| 5897 | } |
| 5898 | var target = parser.requireElement("unaryExpression"); |
| 5899 | var plusOrMinus = parser.matchAnyOpToken("+", "-"); |
| 5900 | var offset; |
| 5901 | if (plusOrMinus) { |
| 5902 | parser.pushFollow("px"); |
| 5903 | try { |
| 5904 | offset = parser.requireElement("expression"); |
| 5905 | } finally { |
| 5906 | parser.popFollow(); |
| 5907 | } |
| 5908 | } |
| 5909 | parser.matchToken("px"); |
| 5910 | var container; |
| 5911 | if (parser.matchToken("in")) { |
| 5912 | container = parser.requireElement("unaryExpression"); |
| 5913 | } |
| 5914 | var smoothness = parser.matchAnyToken("smoothly", "instantly"); |
| 5915 | var scrollOptions = { block: "start", inline: "nearest" }; |
| 5916 | var blockMap = { top: "start", bottom: "end", middle: "center" }; |
| 5917 | var inlineMap = { left: "start", center: "center", right: "end" }; |
| 5918 | var behaviorMap = { smoothly: "smooth", instantly: "instant" }; |
| 5919 | if (verticalPosition) scrollOptions.block = blockMap[verticalPosition.value]; |
| 5920 | if (horizontalPosition) scrollOptions.inline = inlineMap[horizontalPosition.value]; |
| 5921 | if (smoothness) scrollOptions.behavior = behaviorMap[smoothness.value]; |
| 5922 | return { target, offset, plusOrMinus, scrollOptions, container }; |
| 5923 | } |
| 5924 | function _parseSmoothness(parser) { |
| 5925 | var smoothness = parser.matchAnyToken("smoothly", "instantly"); |
| 5926 | if (!smoothness) return void 0; |
no test coverage detected