Created
February 24, 2020 18:09
-
-
Save ericmorand/073d2aba55c50da5f686641a2644ccbe to your computer and use it in GitHub Desktop.
no-op trans tag support for Twing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {TwingTokenParser} from "../token-parser"; | |
import {Token, TokenType} from "twig-lexer"; | |
export class TwingTokenParserTrans extends TwingTokenParser { | |
parse(token: Token) { | |
let stream = this.parser.getStream(); | |
stream.expect(TokenType.TAG_END); | |
let body = this.parser.subparse([this, this.decideBlockEnd], true); | |
stream.expect(TokenType.TAG_END); | |
return body; | |
} | |
decideBlockEnd(token: Token) { | |
return token.test(TokenType.NAME, 'endtrans'); | |
} | |
getTag() { | |
return 'trans'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment