lexer.c

来自「这是关于RFC3261实现sip的源代码」· C语言 代码 · 共 2,036 行 · 第 1/5 页

C
2,036
字号
      459,  458,  457,  456,  455,  454,  453,  452,  451,  450,      447,  446,  445,  444,  443,  442,  441,  440,  439,  438,      437,  436,  435,  434,  433,  432,  431,  430,  429,  428,      409,  408,  407,  406,  405,  404,  403,  402,  401,  400,      399,  398,  397,  396,  395,  394,  393,  392,  391,  390,      389,  388,  387,  386,  385,  384,  383,  382,  377,  376,      354,  351,  350,  349,  348,  347,  346,  345,  344,  343,      342,  341,  340,  339,  338,  337,  336,  335,  334,  333,      332,  331,  330,  329,  328,  327,  326,  325,  324,  302,      301,  300,  299,  298,  297,  294,  293,  292,  291,  290,      289,  288,  287,  286,  285,  284,  283,  282,  281,  280,      279,  278,  277,  276,  275,  274,  273,  231,  221,  244,      243,  242,  241,  240,  239,  238,  237,  236,  235,  234,      233,  232,  229,  228,  227,  226,  223,  220,  219,  216,      215,  214,  174,  172,  168,  152,  177,  176,  171,  167,      163,  157,  154,  151,  150,  108,  107,   88,   58,  702,       40,    7,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702    } ;static yyconst flex_int16_t yy_chk[1597] =    {   0,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    2,    5,    4,    2,    4,    5,        6,   11,   11,   12,    6,   13,   12,   13,   13,   14,       14,   14,   14,   14,   15,   45,   45,   16,   15,   16,       16,   17,  710,   17,   17,   19,   19,   19,   20,   20,       20,   21,   21,   21,   22,   22,   22,  699,   23,   23,       23,   24,   24,   24,   95,   21,   25,   25,   25,   26,       26,   26,   37,   95,   20,   37,   27,   27,   27,   28,       28,   28,   29,   29,   29,   30,   30,   30,  697,   16,       31,   31,   31,   32,   32,   32,   51,   23,   51,   22,       23,   26,   47,   23,  105,   47,   24,   33,   33,   33,       25,   26,   49,   49,   29,   34,   34,   34,  105,   25,       27,   52,   52,   52,   28,   35,   35,   35,   54,  164,       54,   30,   32,   32,  164,   32,   50,   31,   50,   50,       31,   89,   32,   33,   89,   53,   33,   53,   53,   53,       59,   59,   59,   93,   33,   53,   62,   62,   62,   34,      696,   33,   65,   65,   65,   35,  695,   60,   60,   60,       35,   38,   38,   38,   38,   38,   38,   38,  104,   38,       93,   53,   38,   38,   60,   38,   38,  156,   38,   38,       38,   97,   38,   61,   61,   61,   63,   63,   63,  156,      104,   62,   64,   64,   64,  693,   65,   66,   66,   66,       67,   67,   67,  692,   61,   68,   68,   68,  145,   97,       69,   69,   69,   70,   70,   70,   98,  145,   63,   71,       71,   71,   98,   98,   64,   72,   72,   72,   73,   73,       73,   74,   74,   74,   75,   75,   75,   76,   76,   76,       77,   77,   77,   78,   78,   78,  110,   66,  110,  158,       67,   68,   69,   79,   79,   79,  179,  179,   70,   80,       80,   80,   81,   81,   81,  146,  158,   74,   71,   72,       76,   73,  435,  237,   75,   82,   82,   82,  146,   75,      237,   78,   83,   83,   83,   77,  435,   84,   84,   84,      691,   80,   85,   85,   85,   86,   86,   86,   79,   87,       87,   87,  153,  100,  153,   81,   80,  100,  102,  245,      245,  102,  689,  102,  109,  109,  100,  114,  114,  114,      301,  109,   82,  111,  111,  301,  111,  111,  111,  116,      116,  116,   83,   84,  114,  115,  115,  115,  685,   87,       85,  684,   86,   90,  683,   90,   90,  109,  682,   90,      522,  522,   90,   90,  681,   90,   90,  680,  679,   90,       90,  117,  117,  117,  678,  397,  115,  118,  118,  118,      397,  116,  119,  119,  119,  677,  120,  120,  120,  121,      121,  121,  122,  122,  122,  123,  123,  123,  676,  124,      124,  124,  125,  125,  125,  674,  126,  126,  126,  127,      127,  127,  128,  128,  128,  129,  129,  129,  117,  120,      130,  130,  130,  673,  672,  118,  131,  131,  131,  670,      119,  124,  121,  669,  122,  132,  132,  132,  668,  133,      133,  133,  667,  123,  126,  127,  134,  134,  134,  135,      135,  135,  136,  136,  136,  137,  137,  137,  666,  128,      138,  138,  138,  139,  139,  139,  129,  664,  131,  130,      140,  140,  140,  141,  141,  141,  142,  142,  142,  143,      143,  143,  132,  133,  178,  178,  663,  662,  178,  178,      180,  661,  180,  180,  180,  134,  660,  659,  135,  139,      658,  137,  136,  657,  656,  138,  140,  181,  655,  181,      181,  181,  653,  141,  143,  182,  182,  182,  183,  183,      183,  184,  184,  184,  183,  142,  185,  185,  185,  186,      186,  186,  187,  187,  187,  652,  188,  188,  188,  183,      183,  183,  183,  189,  189,  189,  190,  190,  190,  191,      191,  191,  192,  192,  192,  193,  193,  193,  194,  194,      194,  195,  195,  195,  196,  196,  196,  197,  197,  197,      198,  198,  198,  199,  199,  199,  651,  186,  188,  650,      649,  187,  200,  200,  200,  191,  190,  201,  201,  201,      202,  202,  202,  195,  648,  647,  196,  203,  203,  203,      646,  192,  645,  197,  643,  642,  194,  204,  204,  204,      198,  205,  205,  205,  200,  206,  206,  206,  200,  207,      207,  207,  199,  208,  208,  208,  209,  209,  209,  641,      202,  203,  210,  210,  210,  201,  246,  246,  246,  247,      247,  247,  248,  248,  248,  249,  249,  249,  640,  204,      250,  250,  250,  638,  207,  246,  251,  251,  251,  637,      636,  208,  248,  205,  250,  635,  634,  250,  633,  247,      252,  252,  252,  632,  249,  631,  209,  253,  253,  253,      254,  254,  254,  255,  255,  255,  256,  256,  256,  257,      257,  257,  258,  258,  258,  259,  259,  259,  260,  260,      260,  630,  261,  261,  261,  262,  262,  262,  263,  263,      263,  627,  626,  253,  254,  625,  264,  264,  264,  265,      265,  265,  266,  266,  266,  267,  267,  267,  268,  268,      268,  624,  260,  623,  622,  257,  261,  269,  269,  269,      621,  258,  620,  619,  259,  270,  270,  270,  618,  617,      263,  264,  271,  271,  271,  616,  266,  272,  272,  272,      268,  303,  303,  303,  305,  305,  305,  614,  304,  304,      304,  305,  613,  612,  267,  611,  304,  304,  306,  306,      306,  270,  307,  307,  307,  304,  610,  609,  304,  272,      608,  303,  304,  304,  307,  607,  271,  606,  306,  308,      308,  308,  309,  309,  309,  310,  310,  310,  311,  311,      311,  312,  312,  312,  313,  313,  313,  605,  604,  308,      314,  314,  314,  315,  315,  315,  316,  316,  316,  317,      317,  317,  318,  318,  318,  319,  319,  319,  603,  602,      311,  320,  320,  320,  601,  310,  321,  321,  321,  600,      313,  322,  322,  322,  599,  326,  312,  323,  323,  323,      355,  355,  355,  357,  357,  357,  356,  356,  356,  314,      326,  326,  356,  595,  316,  326,  594,  357,  358,  358,      358,  593,  592,  321,  355,  591,  590,  322,  589,  588,      320,  587,  358,  359,  359,  359,  360,  360,  360,  323,      359,  361,  361,  361,  362,  362,  362,  363,  363,  363,      364,  364,  364,  360,  363,  365,  365,  365,  584,  362,      366,  366,  366,  367,  367,  367,  583,  361,  582,  364,      581,  361,  368,  368,  368,  369,  369,  369,  580,  579,      365,  370,  370,  370,  371,  371,  371,  372,  372,  372,      373,  373,  373,  374,  374,  374,  578,  367,  375,  375,      375,  410,  410,  410,  411,  411,  411,  571,  570,  366,      569,  568,  412,  412,  412,  567,  566,  370,  410,  368,      412,  411,  565,  372,  413,  413,  413,  564,  374,  414,      414,  414,  415,  415,  415,  416,  416,  416,  417,  417,      417,  418,  418,  418,  414,  560,  415,  559,  413,  558,      557,  418,  419,  419,  419,  556,  416,  555,  554,  417,      420,  420,  420,  421,  421,  421,  420,  419,  422,  422,      422,  423,  423,  423,  424,  424,  424,  425,  425,  425,      426,  426,  426,  427,  427,  427,  462,  462,  462,  553,      552,  463,  463,  463,  421,  464,  464,  464,  465,  465,      465,  466,  466,  466,  551,  539,  462,  423,  463,  538,      537,  466,  425,  467,  467,  467,  468,  468,  468,  535,      464,  467,  534,  465,  469,  469,  469,  470,  470,  470,      471,  471,  471,  468,  469,  470,  472,  472,  472,  473,      473,  473,  474,  474,  474,  533,  531,  473,  473,  475,      475,  475,  530,  472,  503,  503,  503,  504,  504,  504,      529,  471,  528,  504,  505,  505,  505,  506,  506,  506,      507,  507,  507,  508,  508,  508,  527,  526,  507,  503,      509,  509,  509,  508,  510,  510,  510,  511,  511,  511,      509,  512,  512,  512,  513,  513,  513,  525,  524,  512,      512,  514,  514,  514,  515,  515,  515,  540,  540,  540,      521,  520,  511,  541,  541,  541,  519,  518,  515,  517,      541,  514,  542,  542,  542,  543,  543,  543,  544,  544,      544,  545,  545,  545,  546,  546,  546,  547,  547,  547,      548,  548,  548,  549,  549,  549,  516,  542,  572,  572,      572,  547,  502,  501,  546,  573,  573,  573,  498,  548,      574,  574,  574,  497,  496,  572,  495,  549,  575,  575,      575,  576,  576,  576,  577,  577,  577,  494,  493,  574,      596,  596,  596,  597,  597,  597,  598,  598,  598,  492,      596,  491,  575,  615,  615,  615,  703,  703,  703,  703,      704,  704,  704,  704,  705,  705,  705,  705,  706,  706,      706,  706,  707,  707,  708,  708,  709,  490,  709,  709,      489,  488,  486,  485,  484,  483,  482,  481,  480,  479,      478,  477,  476,  461,  460,  459,  458,  456,  455,  454,      453,  452,  451,  450,  449,  448,  447,  446,  445,  441,      440,  438,  437,  433,  432,  431,  430,  429,  409,  408,      407,  406,  405,  404,  403,  402,  401,  400,  399,  398,      396,  395,  394,  393,  392,  390,  389,  388,  387,  386,      385,  384,  383,  382,  381,  380,  379,  378,  377,  376,      354,  353,  352,  351,  350,  349,  348,  347,  346,  345,      344,  343,  342,  341,  340,  339,  338,  337,  336,  335,      334,  333,  332,  331,  330,  329,  328,  327,  325,  324,      302,  300,  299,  298,  297,  296,  295,  294,  293,  292,      291,  290,  289,  288,  287,  286,  285,  284,  283,  282,      281,  280,  279,  278,  277,  276,  275,  274,  273,  243,      242,  241,  240,  239,  238,  236,  235,  234,  233,  232,      231,  230,  229,  228,  227,  226,  225,  224,  223,  222,      221,  218,  217,  216,  215,  214,  213,  212,  211,  177,      176,  175,  174,  173,  172,  171,  170,  169,  168,  167,      166,  165,  163,  162,  161,  159,  157,  155,  154,  152,      151,  150,  149,  148,  147,  144,  107,  106,  103,  101,       99,   96,   94,   92,   91,   44,   41,   36,   18,    7,        3,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702,  702,  702,  702,  702,      702,  702,  702,  702,  702,  702    } ;static yy_state_type yy_last_accepting_state;static char *yy_last_accepting_cpos;extern int yy_flex_debug;int yy_flex_debug = 0;/* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */#define REJECT reject_used_but_not_detected#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSETchar *yytext;#line 1 "lexer.l"/* * The SIP lexer. * * Copyright (c) 2006 * 	Riverbank Computing Limited <info@riverbankcomputing.co.uk> *  * This file is part of SIP. *  * This copy of SIP is licensed for use under the terms of the SIP License * Agreement.  See the file LICENSE for more details. *  * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */#line 17 "lexer.l"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include "sip.h"#include "parser.h"#ifndef FLEX_SCANNER#error "Only flex is supported at the moment"#endif#define	YY_FATAL_ERROR(s)	fatallex(s)#define	MAX_INCLUDE_DEPTH	10#define	MAX_CODE_LINE_LENGTH	1000static struct inputFile {	int		lineno;		/* The line number. */	YY_BUFFER_STATE	bs;		/* The flex buffer state handle. */	char		*name;		/* The file name. */	char		*cwd;		/* The path part of the file name. */	parserContext	pc;		/* The parser context. */} inputFileStack[MAX_INCLUDE_DEPTH];static int currentFile = -1;		/* Index of the current input file. */static char codeLine[MAX_CODE_LINE_LENGTH + 2];	/* The current code line. */static int codeIdx = -1;		/* Index of next code character. */static FILE *openFile(char *);static void fatallex(char *);#line 1092 "lexer.c.tmp"#define INITIAL 0#define code 1#define ccomment 2#ifndef YY_NO_UNISTD_H/* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */#endif#ifndef YY_EXTRA_TYPE#define YY_EXTRA_TYPE void *#endifstatic int yy_init_globals (void );/* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int yywrap (void );#elseextern int yywrap (void );#endif#endif    static void yyunput (int c,char *buf_ptr  );    #ifndef yytext_ptrstatic void yy_flex_strncpy (char *,yyconst char *,int );#endif#ifdef YY_NEED_STRLENstatic int yy_flex_strlen (yyconst char * );#endif#ifndef YY_NO_INPUT#ifdef __cplusplusstatic int yyinput (void );#elsestatic int input (void );#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \		{ \		int c = '*'; \		size_t n; \		for ( n = 0; n < max_size && \			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \			buf[n] = (char) c; \		if ( c == '\n' ) \			buf[n++] = (char) c; \		if ( c == EOF && ferror( yyin ) ) \			YY_FATAL_ERROR( "input in flex scanner failed" ); \		result = n; \		} \	else \		{ \		errno=0; \		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \			{ \			if( errno != EINTR) \				{ \				YY_FATAL_ERROR( "input in flex scanner failed" ); \				break; \				} \			errno=0; \			clearerr(yyin); \			} \		}\\#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* end tables serialization structures and prototypes *//* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL_IS_OURS 1extern int yylex (void);#define YY_DECL int yylex (void)#endif /* !YY_DECL *//* Code executed at the beginning of each rule, after yytext and yyleng * have been set up.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?