File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
testsuite/tests/input/tex Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -665,6 +665,20 @@ describe('Braket', () => {
665665
666666 /********************************************************************************/
667667
668+ it ( 'Braket-braces' , ( ) => {
669+ expectTexError ( '\\braket{' )
670+ . toBe ( 'Missing close brace' ) ;
671+ } ) ;
672+
673+ /********************************************************************************/
674+
675+ it ( 'Braket-braces' , ( ) => {
676+ expectTexError ( '\\braket}' )
677+ . toBe ( 'Extra close brace or missing open brace' ) ;
678+ } ) ;
679+
680+ /********************************************************************************/
681+
668682} ) ;
669683
670684/**********************************************************************************/
Original file line number Diff line number Diff line change @@ -25,15 +25,14 @@ import { ParseMethod, ParseResult } from '../Types.js';
2525import BaseMethods from '../base/BaseMethods.js' ;
2626import TexParser from '../TexParser.js' ;
2727import { TEXCLASS } from '../../../core/MmlTree/MmlNode.js' ;
28- import TexError from '../TexError.js' ;
2928import { BraketItem } from './BraketItems.js' ;
3029
3130const BraketMethods : { [ key : string ] : ParseMethod } = {
3231 /**
3332 * Generate a bra-ket expression.
3433 *
3534 * @param {TexParser } parser The current TeX parser.
36- * @param {string } _name Name of the current control sequence.
35+ * @param {string } name Name of the current control sequence.
3736 * @param {string } open Opening delimiter.
3837 * @param {string } close Closing delimiter.
3938 * @param {boolean } stretchy Is it stretchy.
@@ -42,21 +41,17 @@ const BraketMethods: { [key: string]: ParseMethod } = {
4241 */
4342 Braket (
4443 parser : TexParser ,
45- _name : string ,
44+ name : string ,
4645 open : string ,
4746 close : string ,
4847 stretchy : boolean ,
4948 barmax : number ,
5049 space : boolean = false
5150 ) {
51+ const i = parser . i ;
52+ parser . GetArgument ( name ) ; // Error if there isn't a proper argument
53+ parser . i = i ;
5254 const next = parser . GetNext ( ) ;
53- if ( next === '' ) {
54- throw new TexError (
55- 'MissingArgFor' ,
56- 'Missing argument for %1' ,
57- parser . currentCS
58- ) ;
59- }
6055 let single = true ;
6156 if ( next === '{' ) {
6257 parser . i ++ ;
You can’t perform that action at this time.
0 commit comments