Public Member Functions | Private Attributes | List of all members
xpath_lexer Class Reference
Collaboration diagram for xpath_lexer:
Collaboration graph
[legend]

Public Member Functions

 xpath_lexer (const char_t *query)
 
const char_t * state () const
 
void next ()
 
lexeme_t current () const
 
const char_t * current_pos () const
 
const xpath_lexer_stringcontents () const
 

Private Attributes

const char_t * _cur
 
const char_t * _cur_lexeme_pos
 
xpath_lexer_string _cur_lexeme_contents
 
lexeme_t _cur_lexeme
 

Detailed Description

Definition at line 7512 of file pugixml.cpp.

Constructor & Destructor Documentation

◆ xpath_lexer()

xpath_lexer::xpath_lexer ( const char_t *  query)
inlineexplicit

Definition at line 7521 of file pugixml.cpp.

7521 : _cur(query)
7522 {
7523 next();
7524 }
void next()
Definition pugixml.cpp:7531
const char_t * _cur
Definition pugixml.cpp:7514

References next().

Member Function Documentation

◆ contents()

const xpath_lexer_string & xpath_lexer::contents ( ) const
inline

◆ current()

lexeme_t xpath_lexer::current ( ) const
inline

◆ current_pos()

const char_t * xpath_lexer::current_pos ( ) const
inline

Definition at line 7805 of file pugixml.cpp.

7806 {
7807 return _cur_lexeme_pos;
7808 }
const char_t * _cur_lexeme_pos
Definition pugixml.cpp:7515

References _cur_lexeme_pos.

Referenced by xpath_parser::throw_error().

◆ next()

void xpath_lexer::next ( )
inline

Definition at line 7531 of file pugixml.cpp.

7532 {
7533 const char_t* cur = _cur;
7534
7535 while (PUGI__IS_CHARTYPE(*cur, ct_space)) ++cur;
7536
7537 // save lexeme position for error reporting
7538 _cur_lexeme_pos = cur;
7539
7540 switch (*cur)
7541 {
7542 case 0:
7544 break;
7545
7546 case '>':
7547 if (*(cur+1) == '=')
7548 {
7549 cur += 2;
7551 }
7552 else
7553 {
7554 cur += 1;
7556 }
7557 break;
7558
7559 case '<':
7560 if (*(cur+1) == '=')
7561 {
7562 cur += 2;
7564 }
7565 else
7566 {
7567 cur += 1;
7569 }
7570 break;
7571
7572 case '!':
7573 if (*(cur+1) == '=')
7574 {
7575 cur += 2;
7577 }
7578 else
7579 {
7581 }
7582 break;
7583
7584 case '=':
7585 cur += 1;
7587
7588 break;
7589
7590 case '+':
7591 cur += 1;
7593
7594 break;
7595
7596 case '-':
7597 cur += 1;
7599
7600 break;
7601
7602 case '*':
7603 cur += 1;
7605
7606 break;
7607
7608 case '|':
7609 cur += 1;
7611
7612 break;
7613
7614 case '$':
7615 cur += 1;
7616
7618 {
7620
7621 while (PUGI__IS_CHARTYPEX(*cur, ctx_symbol)) cur++;
7622
7623 if (cur[0] == ':' && PUGI__IS_CHARTYPEX(cur[1], ctx_symbol)) // qname
7624 {
7625 cur++; // :
7626
7627 while (PUGI__IS_CHARTYPEX(*cur, ctx_symbol)) cur++;
7628 }
7629
7631
7633 }
7634 else
7635 {
7637 }
7638
7639 break;
7640
7641 case '(':
7642 cur += 1;
7644
7645 break;
7646
7647 case ')':
7648 cur += 1;
7650
7651 break;
7652
7653 case '[':
7654 cur += 1;
7656
7657 break;
7658
7659 case ']':
7660 cur += 1;
7662
7663 break;
7664
7665 case ',':
7666 cur += 1;
7668
7669 break;
7670
7671 case '/':
7672 if (*(cur+1) == '/')
7673 {
7674 cur += 2;
7676 }
7677 else
7678 {
7679 cur += 1;
7681 }
7682 break;
7683
7684 case '.':
7685 if (*(cur+1) == '.')
7686 {
7687 cur += 2;
7689 }
7690 else if (PUGI__IS_CHARTYPEX(*(cur+1), ctx_digit))
7691 {
7692 _cur_lexeme_contents.begin = cur; // .
7693
7694 ++cur;
7695
7696 while (PUGI__IS_CHARTYPEX(*cur, ctx_digit)) cur++;
7697
7699
7701 }
7702 else
7703 {
7704 cur += 1;
7706 }
7707 break;
7708
7709 case '@':
7710 cur += 1;
7712
7713 break;
7714
7715 case '"':
7716 case '\'':
7717 {
7718 char_t terminator = *cur;
7719
7720 ++cur;
7721
7723 while (*cur && *cur != terminator) cur++;
7725
7726 if (!*cur)
7728 else
7729 {
7730 cur += 1;
7732 }
7733
7734 break;
7735 }
7736
7737 case ':':
7738 if (*(cur+1) == ':')
7739 {
7740 cur += 2;
7742 }
7743 else
7744 {
7746 }
7747 break;
7748
7749 default:
7750 if (PUGI__IS_CHARTYPEX(*cur, ctx_digit))
7751 {
7753
7754 while (PUGI__IS_CHARTYPEX(*cur, ctx_digit)) cur++;
7755
7756 if (*cur == '.')
7757 {
7758 cur++;
7759
7760 while (PUGI__IS_CHARTYPEX(*cur, ctx_digit)) cur++;
7761 }
7762
7764
7766 }
7767 else if (PUGI__IS_CHARTYPEX(*cur, ctx_start_symbol))
7768 {
7770
7771 while (PUGI__IS_CHARTYPEX(*cur, ctx_symbol)) cur++;
7772
7773 if (cur[0] == ':')
7774 {
7775 if (cur[1] == '*') // namespace test ncname:*
7776 {
7777 cur += 2; // :*
7778 }
7779 else if (PUGI__IS_CHARTYPEX(cur[1], ctx_symbol)) // namespace test qname
7780 {
7781 cur++; // :
7782
7783 while (PUGI__IS_CHARTYPEX(*cur, ctx_symbol)) cur++;
7784 }
7785 }
7786
7788
7790 }
7791 else
7792 {
7794 }
7795 }
7796
7797 _cur = cur;
7798 }
@ lex_multiply
Definition pugixml.cpp:7475
@ lex_double_slash
Definition pugixml.cpp:7483
@ lex_not_equal
Definition pugixml.cpp:7468
@ lex_axis_attribute
Definition pugixml.cpp:7488
@ lex_less
Definition pugixml.cpp:7469
@ lex_equal
Definition pugixml.cpp:7467
@ lex_greater_or_equal
Definition pugixml.cpp:7472
@ lex_none
Definition pugixml.cpp:7466
@ lex_union
Definition pugixml.cpp:7476
@ lex_comma
Definition pugixml.cpp:7487
@ lex_close_brace
Definition pugixml.cpp:7479
@ lex_slash
Definition pugixml.cpp:7482
@ lex_dot
Definition pugixml.cpp:7489
@ lex_minus
Definition pugixml.cpp:7474
@ lex_eof
Definition pugixml.cpp:7492
@ lex_plus
Definition pugixml.cpp:7473
@ lex_greater
Definition pugixml.cpp:7470
@ lex_double_dot
Definition pugixml.cpp:7490
@ lex_less_or_equal
Definition pugixml.cpp:7471
@ lex_close_square_brace
Definition pugixml.cpp:7485
@ lex_open_square_brace
Definition pugixml.cpp:7484
@ lex_open_brace
Definition pugixml.cpp:7478
@ lex_double_colon
Definition pugixml.cpp:7491
#define PUGI__IS_CHARTYPE(c, ct)
Definition pugixml.cpp:1195
#define PUGI__IS_CHARTYPEX(c, ct)
Definition pugixml.cpp:1196
@ ct_space
Definition pugixml.cpp:1130
@ ctx_digit
Definition pugixml.cpp:1163
@ ctx_symbol
Definition pugixml.cpp:1164
@ ctx_start_symbol
Definition pugixml.cpp:1162
const char_t * begin
Definition pugixml.cpp:7497
const char_t * end
Definition pugixml.cpp:7498

References _cur, _cur_lexeme, _cur_lexeme_contents, _cur_lexeme_pos, xpath_lexer_string::begin, ct_space, ctx_digit, ctx_start_symbol, ctx_symbol, xpath_lexer_string::end, lex_axis_attribute, lex_close_brace, lex_close_square_brace, lex_comma, lex_dot, lex_double_colon, lex_double_dot, lex_double_slash, lex_eof, lex_equal, lex_greater, lex_greater_or_equal, lex_less, lex_less_or_equal, lex_minus, lex_multiply, lex_none, lex_not_equal, lex_number, lex_open_brace, lex_open_square_brace, lex_plus, lex_quoted_string, lex_slash, lex_string, lex_union, lex_var_ref, PUGI__IS_CHARTYPE, and PUGI__IS_CHARTYPEX.

Referenced by xpath_parser::parse_expression_rec(), xpath_parser::parse_filter_expression(), xpath_parser::parse_location_path(), xpath_parser::parse_path_or_unary_expression(), xpath_parser::parse_primary_expression(), xpath_parser::parse_relative_location_path(), xpath_parser::parse_step(), and xpath_lexer().

◆ state()

const char_t * xpath_lexer::state ( ) const
inline

Definition at line 7526 of file pugixml.cpp.

7527 {
7528 return _cur;
7529 }

References _cur.

Referenced by xpath_parser::parse_path_or_unary_expression().

Member Data Documentation

◆ _cur

const char_t* xpath_lexer::_cur
private

Definition at line 7514 of file pugixml.cpp.

Referenced by next(), and state().

◆ _cur_lexeme

lexeme_t xpath_lexer::_cur_lexeme
private

Definition at line 7518 of file pugixml.cpp.

Referenced by contents(), current(), and next().

◆ _cur_lexeme_contents

xpath_lexer_string xpath_lexer::_cur_lexeme_contents
private

Definition at line 7516 of file pugixml.cpp.

Referenced by contents(), and next().

◆ _cur_lexeme_pos

const char_t* xpath_lexer::_cur_lexeme_pos
private

Definition at line 7515 of file pugixml.cpp.

Referenced by current_pos(), and next().


The documentation for this class was generated from the following file:

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001