@@ -186,9 +186,9 @@ fn extract_sign(cap: &Captures) -> Result<Option<Sign>, String> {
186186 ( false , false ) => Ok ( None ) ,
187187 ( false , true ) => Ok ( Some ( Sign :: Minus ) ) ,
188188 ( true , false ) => Ok ( Some ( Sign :: Plus ) ) ,
189- ( true , true ) => Err ( format ! (
189+ ( true , true ) => Err (
190190 "expected to find a single optional leading sign in a numeric literal but found both + and -"
191- ) ) ,
191+ . to_string ( ) ) ,
192192 }
193193}
194194
@@ -199,7 +199,7 @@ fn capture_subscript_digits(lex: &mut logos::Lexer<Token>) -> NumericLiteral {
199199 lex. slice( )
200200 ) ;
201201 } ;
202- const RX_PARTS : LazyRegex = LazyRegex :: new ( concat ! (
202+ static CAPTURE_SUBSCRIPT_DIGITS_RX_PARTS : LazyRegex = LazyRegex :: new ( concat ! (
203203 "((?<plus>\u{208A} )|(?<minus>\u{208B} ))?" ,
204204 "(?<digits>" ,
205205 "([₀₁₂₃₄₅₆₇₈₉]" ,
@@ -208,18 +208,18 @@ fn capture_subscript_digits(lex: &mut logos::Lexer<Token>) -> NumericLiteral {
208208 ")+)" ,
209209 "(?<dot>@sub_dot@)?" ,
210210 ) ) ;
211- const RX_DIGIT : LazyRegex = LazyRegex :: new ( concat ! (
211+ static RX_DIGIT : LazyRegex = LazyRegex :: new ( concat ! (
212212 "(?<sub>[₀₁₂₃₄₅₆₇₈₉])" ,
213213 "|" ,
214214 "(@sub_(?<markup_digit>[0-9])@)" ,
215215 ) ) ;
216- let parts_cap = match ( * RX_PARTS ) . captures ( lex. slice ( ) ) {
216+ let parts_cap = match ( * CAPTURE_SUBSCRIPT_DIGITS_RX_PARTS ) . captures ( lex. slice ( ) ) {
217217 Some ( cap) => cap,
218218 None => {
219219 internal_error ( format ! (
220220 "token {} does not match parts regex {}" ,
221221 lex. slice( ) ,
222- RX_PARTS . as_str( )
222+ CAPTURE_SUBSCRIPT_DIGITS_RX_PARTS . as_str( )
223223 ) ) ;
224224 }
225225 } ;
@@ -294,7 +294,7 @@ fn capture_superscript_digits(lex: &mut logos::Lexer<Token>) -> NumericLiteral {
294294 lex. slice( )
295295 ) ;
296296 } ;
297- const RX_PARTS : LazyRegex = LazyRegex :: new ( concat ! (
297+ static RX_PARTS : LazyRegex = LazyRegex :: new ( concat ! (
298298 "((?<plus>\u{207A} )|(?<minus>\u{207B} ))?" ,
299299 "(?<digits>" ,
300300 "([\u{2070} \u{00B9} \u{00B2} \u{00B3} \u{2074} \u{2075} \u{2076} \u{2077} \u{2078} \u{2079} ]" ,
@@ -303,7 +303,7 @@ fn capture_superscript_digits(lex: &mut logos::Lexer<Token>) -> NumericLiteral {
303303 ")+)" ,
304304 "(?<dot>@sup_dot@)?" ,
305305 ) ) ;
306- const RX_DIGIT : LazyRegex = LazyRegex :: new ( concat ! (
306+ static RX_DIGIT : LazyRegex = LazyRegex :: new ( concat ! (
307307 "(?<sup>[\u{2070} \u{00B9} \u{00B2} \u{00B3} \u{2074} \u{2075} \u{2076} \u{2077} \u{2078} \u{2079} ])" ,
308308 "|" ,
309309 "(@sup_(?<markup_digit>[0-9])@)" ,
@@ -382,7 +382,7 @@ fn capture_superscript_digits(lex: &mut logos::Lexer<Token>) -> NumericLiteral {
382382}
383383
384384fn capture_name ( lex : & mut logos:: Lexer < Token > ) -> String {
385- const RX_GREEK_GLYPHS : LazyRegex =
385+ static RX_GREEK_GLYPHS : LazyRegex =
386386 LazyRegex :: new ( "(@(?<glyph>alpha|beta|gamma|delta|eps|lambda|apostrophe)@|[^@])+" ) ;
387387 let slice = lex. slice ( ) ;
388388 let mut name: String = String :: with_capacity ( slice. len ( ) ) ;
@@ -562,30 +562,30 @@ fn decode_glyphs_by_regex(tokname: &'static str, rx: &Regex, text: &str, script:
562562}
563563
564564fn capture_possible_subscript_glyphs ( lex : & mut logos:: Lexer < Token > ) -> String {
565- const RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@sub_(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
565+ static RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@sub_(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
566566 decode_glyphs_by_regex (
567567 "SubscriptSymexSyllable" ,
568- & * RX_GLYPHS ,
568+ & RX_GLYPHS ,
569569 lex. slice ( ) ,
570570 Script :: Sub ,
571571 )
572572}
573573
574574fn capture_possible_superscript_glyphs ( lex : & mut logos:: Lexer < Token > ) -> String {
575- const RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@sup_(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
575+ static RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@sup_(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
576576 decode_glyphs_by_regex (
577577 "SuperscriptSymexSyllable" ,
578- & * RX_GLYPHS ,
578+ & RX_GLYPHS ,
579579 lex. slice ( ) ,
580580 Script :: Super ,
581581 )
582582}
583583
584584fn capture_possible_normal_glyphs ( lex : & mut logos:: Lexer < Token > ) -> String {
585- const RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
585+ static RX_GLYPHS : LazyRegex = LazyRegex :: new ( "(@(?<glyphname>[^@]+)@)|(?<asis>[^@])" ) ;
586586 decode_glyphs_by_regex (
587587 "NormalSymexSyllable" ,
588- & * RX_GLYPHS ,
588+ & RX_GLYPHS ,
589589 lex. slice ( ) ,
590590 Script :: Normal ,
591591 )
0 commit comments