@@ -116,13 +116,13 @@ impl<'i, T> From<BasicParseError<'i>> for ParseError<'i, T> {
116116impl SourceLocation {
117117 /// Create a new BasicParseError at this location for an unexpected token
118118 #[ inline]
119- pub fn new_basic_unexpected_token_error ( self , token : Token < ' _ > ) -> BasicParseError < ' _ > {
119+ pub const fn new_basic_unexpected_token_error ( self , token : Token < ' _ > ) -> BasicParseError < ' _ > {
120120 self . new_basic_error ( BasicParseErrorKind :: UnexpectedToken ( token) )
121121 }
122122
123123 /// Create a new BasicParseError at this location
124124 #[ inline]
125- pub fn new_basic_error ( self , kind : BasicParseErrorKind < ' _ > ) -> BasicParseError < ' _ > {
125+ pub const fn new_basic_error ( self , kind : BasicParseErrorKind < ' _ > ) -> BasicParseError < ' _ > {
126126 BasicParseError {
127127 kind,
128128 location : self ,
@@ -131,13 +131,13 @@ impl SourceLocation {
131131
132132 /// Create a new ParseError at this location for an unexpected token
133133 #[ inline]
134- pub fn new_unexpected_token_error < E > ( self , token : Token < ' _ > ) -> ParseError < ' _ , E > {
134+ pub const fn new_unexpected_token_error < E > ( self , token : Token < ' _ > ) -> ParseError < ' _ , E > {
135135 self . new_error ( BasicParseErrorKind :: UnexpectedToken ( token) )
136136 }
137137
138138 /// Create a new basic ParseError at the current location
139139 #[ inline]
140- pub fn new_error < E > ( self , kind : BasicParseErrorKind < ' _ > ) -> ParseError < ' _ , E > {
140+ pub const fn new_error < E > ( self , kind : BasicParseErrorKind < ' _ > ) -> ParseError < ' _ , E > {
141141 ParseError {
142142 kind : ParseErrorKind :: Basic ( kind) ,
143143 location : self ,
@@ -240,7 +240,7 @@ struct CachedToken<'i> {
240240
241241impl < ' i > ParserInput < ' i > {
242242 /// Create a new input for a parser.
243- pub fn new ( input : & ' i str ) -> ParserInput < ' i > {
243+ pub const fn new ( input : & ' i str ) -> ParserInput < ' i > {
244244 ParserInput {
245245 tokenizer : Tokenizer :: new ( input) ,
246246 cached_token : None ,
@@ -383,7 +383,7 @@ macro_rules! expect {
383383impl < ' i : ' t , ' t > Parser < ' i , ' t > {
384384 /// Create a new parser
385385 #[ inline]
386- pub fn new ( input : & ' t mut ParserInput < ' i > ) -> Parser < ' i , ' t > {
386+ pub const fn new ( input : & ' t mut ParserInput < ' i > ) -> Parser < ' i , ' t > {
387387 Parser {
388388 input,
389389 at_start_of : None ,
@@ -435,7 +435,7 @@ impl<'i: 't, 't> Parser<'i, 't> {
435435
436436 /// The current line number and column number.
437437 #[ inline]
438- pub fn current_source_location ( & self ) -> SourceLocation {
438+ pub const fn current_source_location ( & self ) -> SourceLocation {
439439 self . input . tokenizer . current_source_location ( )
440440 }
441441
@@ -459,13 +459,13 @@ impl<'i: 't, 't> Parser<'i, 't> {
459459
460460 /// Create a new BasicParseError at the current location
461461 #[ inline]
462- pub fn new_basic_error ( & self , kind : BasicParseErrorKind < ' i > ) -> BasicParseError < ' i > {
462+ pub const fn new_basic_error ( & self , kind : BasicParseErrorKind < ' i > ) -> BasicParseError < ' i > {
463463 self . current_source_location ( ) . new_basic_error ( kind)
464464 }
465465
466466 /// Create a new basic ParseError at the current location
467467 #[ inline]
468- pub fn new_error < E > ( & self , kind : BasicParseErrorKind < ' i > ) -> ParseError < ' i , E > {
468+ pub const fn new_error < E > ( & self , kind : BasicParseErrorKind < ' i > ) -> ParseError < ' i , E > {
469469 self . current_source_location ( ) . new_error ( kind)
470470 }
471471
@@ -477,13 +477,13 @@ impl<'i: 't, 't> Parser<'i, 't> {
477477
478478 /// Create a new unexpected token BasicParseError at the current location
479479 #[ inline]
480- pub fn new_basic_unexpected_token_error ( & self , token : Token < ' i > ) -> BasicParseError < ' i > {
480+ pub const fn new_basic_unexpected_token_error ( & self , token : Token < ' i > ) -> BasicParseError < ' i > {
481481 self . new_basic_error ( BasicParseErrorKind :: UnexpectedToken ( token) )
482482 }
483483
484484 /// Create a new unexpected token ParseError at the current location
485485 #[ inline]
486- pub fn new_unexpected_token_error < E > ( & self , token : Token < ' i > ) -> ParseError < ' i , E > {
486+ pub const fn new_unexpected_token_error < E > ( & self , token : Token < ' i > ) -> ParseError < ' i , E > {
487487 self . new_error ( BasicParseErrorKind :: UnexpectedToken ( token) )
488488 }
489489
0 commit comments