MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / escapeIdent

Method escapeIdent

cel/src/parser/gen/celparser.rs:5428–5496  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

5426 I: TokenStream<'input, TF = LocalTokenFactory<'input>> + TidAble<'input>,
5427{
5428 pub fn escapeIdent(&mut self) -> Result<Rc<EscapeIdentContextAll<'input>>, ANTLRError> {
5429 let mut recog = self;
5430 let _parentctx = recog.ctx.take();
5431 let mut _localctx = EscapeIdentContextExt::new(_parentctx.clone(), recog.base.get_state());
5432 recog
5433 .base
5434 .enter_rule(_localctx.clone(), 28, RULE_escapeIdent);
5435 let mut _localctx: Rc<EscapeIdentContextAll> = _localctx;
5436 let result: Result<(), ANTLRError> = (|| {
5437 recog.base.set_state(235);
5438 recog.err_handler.sync(&mut recog.base)?;
5439 match recog.base.input.la(1) {
5440 CEL_IDENTIFIER => {
5441 let tmp = SimpleIdentifierContextExt::new(&**_localctx);
5442 recog.base.enter_outer_alt(Some(tmp.clone()), 1)?;
5443 _localctx = tmp;
5444 {
5445 recog.base.set_state(233);
5446 let tmp = recog
5447 .base
5448 .match_token(CEL_IDENTIFIER, &mut recog.err_handler)?;
5449 if let EscapeIdentContextAll::SimpleIdentifierContext(ctx) =
5450 cast_mut::<_, EscapeIdentContextAll>(&mut _localctx)
5451 {
5452 ctx.id = Some(tmp.clone());
5453 } else {
5454 unreachable!("cant cast");
5455 }
5456 }
5457 }
5458
5459 CEL_ESC_IDENTIFIER => {
5460 let tmp = EscapedIdentifierContextExt::new(&**_localctx);
5461 recog.base.enter_outer_alt(Some(tmp.clone()), 2)?;
5462 _localctx = tmp;
5463 {
5464 recog.base.set_state(234);
5465 let tmp = recog
5466 .base
5467 .match_token(CEL_ESC_IDENTIFIER, &mut recog.err_handler)?;
5468 if let EscapeIdentContextAll::EscapedIdentifierContext(ctx) =
5469 cast_mut::<_, EscapeIdentContextAll>(&mut _localctx)
5470 {
5471 ctx.id = Some(tmp.clone());
5472 } else {
5473 unreachable!("cant cast");
5474 }
5475 }
5476 }
5477
5478 _ => Err(ANTLRError::NoAltError(NoViableAltError::new(
5479 &mut recog.base,
5480 )))?,
5481 }
5482 Ok(())
5483 })();
5484 match result {
5485 Ok(_) => {}

Callers 3

member_recMethod · 0.45
optFieldMethod · 0.45

Calls 2

cloneMethod · 0.80
report_errorMethod · 0.80

Tested by

no test coverage detected