This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Typedef Documentation
◆ SEG
◆ yyscan_t
Function Documentation
◆ seg_scanner_finish()
void seg_scanner_finish
(
yyscan_t
yyscanner )
Definition at line 116 of file segscan.l.
117{
118 yylex_destroy(yyscanner);
119}
Referenced by seg_in().
◆ seg_scanner_init()
void seg_scanner_init
(
const char *
str,
)
Definition at line 99 of file segscan.l.
100{
102
103 if (yylex_init(yyscannerp) != 0)
105
106 yyscanner = *yyscannerp;
107
108 yy_scan_string(
str, yyscanner);
109}
References elog, ERROR, and str.
Referenced by seg_in().
◆ seg_yyerror()
void seg_yyerror
(
SEG *
result,
const char *
message
)
Definition at line 67 of file segscan.l.
68{
70 * macro */
71
72 /* if we already reported an error, don't overwrite it */
74 return;
75
76 if (*yytext == YY_END_OF_BUFFER_CHAR)
77 {
80 errmsg(
"bad seg representation"),
81 /* translator: %s is typically "syntax error" */
82 errdetail(
"%s at end of input", message)));
83 }
84 else
85 {
88 errmsg(
"bad seg representation"),
89 /* translator: first %s is typically "syntax error" */
90 errdetail(
"%s at or near \"%s\"", message, yytext)));
91 }
92}
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define errsave(context,...)
#define SOFT_ERROR_OCCURRED(escontext)
References errcode(), errdetail(), errmsg(), errsave, and SOFT_ERROR_OCCURRED.
Referenced by seg_in().
◆ seg_yylex()
int seg_yylex
(
union
YYSTYPE *
yylval_param,
)
◆ seg_yyparse()
int seg_yyparse
(
SEG *
result,
)
◆ significant_digits()
int significant_digits
(
const char *
s )
Definition at line 1068 of file seg.c.
1069{
1070 const char *p = s;
1071 int n,
1073 zeroes;
1074
1075 zeroes = 1;
1076 /* skip leading zeroes and sign */
1077 for (
c = *p; (
c ==
'0' ||
c ==
'+' ||
c ==
'-') &&
c != 0;
c = *(++p));
1078
1079 /* skip decimal point and following zeroes */
1080 for (
c = *p; (
c ==
'0' ||
c ==
'.') &&
c != 0;
c = *(++p))
1081 {
1083 zeroes++;
1084 }
1085
1086 /* count significant digits (n) */
1087 for (
c = *p, n = 0;
c != 0;
c = *(++p))
1088 {
1089 if (!((
c >=
'0' &&
c <=
'9') || (
c ==
'.')))
1090 break;
1092 n++;
1093 }
1094
1095 if (!n)
1096 return zeroes;
1097
1098 return n;
1099}