📄 bug.y
字号:
| { SQLStmt = FALSE; } setoption
| updatecursor
| { SQLStmt = FALSE; } whenever
;
selinto: selinto2
| /* empty */
{ $$ = NULL; }
;
selinto2: T_INTO { $<ptr>$ = pa_into_clause_start(); } intohostlist
{ pa_into_clause_done();
$$ = $3;
}
;
close: T_CLOSE id_spec
{ $$ = pa_close( $2 ); }
;
defuid: T_DEFAULT T_USER id_spec
{ $$ = $3; }
| /* empty */
{ $$ = NULL; }
;
database: T_DATABASE id_spec
{ $$ = $2; }
| /* empty */
{ $$ = NULL; }
;
dictionary: T_DICTIONARY id_spec
{ $$ = $2; }
| /* empty */
{ $$ = NULL; }
;
connect: T_CONNECT id_spec T_IDENTIFIED T_BY id_spec
defuid dictionary database
{ $$ = pa_connect( $2, $5, $6, $8, $7 ); }
;
open: T_OPEN id_spec using_sqlda
{ $$ = pa_open( $2, $3 ); }
;
reopen: T_REOPEN id_spec
{ $$ = pa_reopen( $2 ); }
;
using_sqlda: /* empty */
{ $$ = NULL; }
| using_sqlda_ne
;
using_sqlda_ne: T_USING T_DESCRIPTOR structure_spec
{ $$ = pa_using_info( UT_SQLDA, $3 ); }
| T_USING indhostlist
{ $$ = pa_using_info( UT_HOSTLIST, $2 ); }
;
structure_spec: T_IDENTIFIER
;
fetch: T_FETCH position id_spec T_INTO intohostlist
{ a_using_info *ui;
ui = pa_using_info( UT_HOSTLIST, $5 );
$$ = pa_fetch( $3, $2, ui );
}
| T_FETCH position id_spec using_sqlda
{ $$ = pa_fetch( $3, $2, $4 ); }
;
offset: T_HOSTVAR
{ $$ = pa_runhostvar( $1, NULL ); }
| integer
| T_MINUS integer
{ an_integer *i;
i = $2;
i->value = -(i->value);
$$ = i;
}
;
position: /* empty */
{ $$.info = D_RELATIVE;
$$.ptr = pa_makeint( 1L );
}
| direction offset
{ pa_ppspecific( L_SAAEXT );
$$.info = $1;
$$.ptr = $2;
}
| T_NEXT
{ pa_ppspecific( L_SAAEXT );
$$.info = D_RELATIVE;
$$.ptr = pa_makeint( 1L );
}
| T_PRIOR
{ pa_ppspecific( L_SAAEXT );
$$.info = D_RELATIVE;
$$.ptr = pa_makeint( -1L );
}
| T_FIRST
{ pa_ppspecific( L_SAAEXT );
$$.info = D_ABSOLUTE;
$$.ptr = pa_makeint( 1L );
}
| T_LAST
{ pa_ppspecific( L_SAAEXT );
$$.info = D_ABSOLUTE;
$$.ptr = pa_makeint( -1L );
}
;
direction: T_ABSOLUTE
{ $$ = D_ABSOLUTE; }
| T_RELATIVE
{ $$ = D_RELATIVE; }
;
intohostlist: intohostvar
{ $$ = pa_add_list( NULL, $1 ); }
| intohostlist T_COMMA intohostvar
{ $$ = pa_add_list_end( $1, $3 ); }
;
indhostlist: indhostvar
{ $$ = pa_add_list( NULL, $1 ); }
| indhostlist T_COMMA indhostvar
{ $$ = pa_add_list_end( $1, $3 ); }
;
put: putkwd id_spec using_sqlda
{ pa_ppspecific( L_SAAEXT );
$$ = pa_put( $2, $3 );
}
| putkwd id_spec T_FROM indhostlist
{ pa_ppspecific( L_SAAEXT );
$$ = pa_using_info( UT_HOSTLIST, $4 );
$$ = pa_put( $2, $$ );
}
;
putkwd: {SQLStmt=TRUE;} T_PUT
| T_INSERT T_INTO {SQLStmt=TRUE;} T_CURSOR
;
t_update: T_UPDATE {SQLStmt=FALSE;} T_WHERE T_CURRENT T_OF
;
updatecursor: t_update id_spec using_sqlda_ne
{ $$ = pa_update_cursor( $2, $3 ); }
| t_update id_spec T_FROM indhostlist
{ $$ = pa_using_info( UT_HOSTLIST, $4 );
$$ = pa_update_cursor( $2, $$ );
}
;
onetabspec: T_IDENTIFIER T_DOT T_IDENTIFIER
{ $$ = pa_table( $3, $1 );}
| T_IDENTIFIER
{ $$ = pa_table( $1, NULL );}
;
t_delete: T_DELETE
;
delete: t_delete {SQLStmt=FALSE;} T_WHERE T_CURRENT T_OF id_spec
{ $$ = pa_delete_cursor( $6, NULL ); }
| t_delete T_FROM onetabspec
T_WHERE T_CURRENT {SQLStmt=FALSE;} T_OF id_spec
{ $$ = pa_delete_cursor( $8, $3 );
// {T( $$ = pa_delete( $3, NULL, $8 ); )}
}
| t_delete T_FROM onetabspec where
{T( $$ = pa_delete( $3, $4, NULL ); )}
;
scroll: T_SCROLL
{ pa_ppspecific( L_SAAEXT | L_ANSI2 ); }
| /* empty */
;
updatability_clause: /* empty */
| T_FOR T_READ T_ONLY
{ pa_ppspecific( L_ANSI2 ); }
| T_FOR T_UPDATE
{ pa_ppspecific( L_ANSI2 ); }
| T_FOR T_UPDATE T_OF collist
{ pa_ppspecific( L_ANSI2 ); }
;
declare_tok: T_DECLARE
{ New_Buffer();
Stop_Buffer();
}
;
declare: declare_tok id_spec scroll T_CURSOR T_FOR select_stmt
updatability_clause
{ /* declare with order by */
$$ = pa_declare_select( $2, $6 );
}
| declare_tok id_spec scroll T_CURSOR T_FOR insert_stmt
updatability_clause
{ $$ = pa_declare_insert( $2, $6 ); }
| declare_tok id_spec scroll T_CURSOR T_FOR statement_spec
updatability_clause
{ $$ = pa_declare_stmt( $2, $6,
((a_statement_spec *)$6)->program, NULL ); }
;
select_stmt: select
{T( $$ = pa_make_stmt( STMT_SELECT, $1 ); )}
;
insert_stmt: insertvalues
{T( $$ = pa_make_stmt( STMT_INSERT, $1 ); )}
;
statement_spec: T_IDENTIFIER
{ $$ = pa_statement_spec( NULL, $1, NULL ); }
| embhostvar
{ $$ = pa_statement_spec( NULL, NULL, $1 ); }
| embhostvar T_IN ppprogname
{ $$ = pa_statement_spec( $3, NULL, $1 ); }
;
describe: T_DESCRIBE describe_type statement_spec
T_INTO structure_spec desc_using
{ $$ = pa_describe( $3, $2, $5, $6 ); }
;
describe_type: /* empty */
{ $$ = DESCT_SELECTLIST; }
| T_SELECT T_LIST T_FOR
{ pa_ppspecific( L_SAAEXT );
$$ = DESCT_SELECTLIST;
}
| T_BIND T_VARIABLES T_FOR
{ pa_ppspecific( L_SAAEXT );
$$ = DESCT_BINDVARIABLES;
}
;
desc_using: /* empty */
{ $$ = DU_NAMES; }
| T_USING desc_using_element
{ pa_ppspecific( L_PACE );
$$ = $2;
}
;
desc_using_element: T_NAMES
{ $$ = DU_NAMES; }
| T_LABELS
{ $$ = DU_LABELS; }
| T_BOTH
{ $$ = (DU_NAMES | DU_LABELS); }
| T_ANY
{ $$ = DU_ANY; }
;
prepare: T_PREPARE statement_spec T_FROM string_spec prepusing
{ $$ = pa_prepare( $2, $4, $5 ); }
| T_PREPARE T_FROM string_spec
T_SETTING statement_spec prepusing
{ pa_ppspecific( L_SAAEXT );
$$ = pa_prepare( $5, $3, $6 );
}
;
dropstmt: T_DROP {SQLStmt=FALSE;} T_STATEMENT statement_spec
{ $$ = pa_dropstmt( $4 ); }
;
ppprogname: id_spec
{ $$ = pa_ppprogname( NULL, $1 ); }
| id_spec T_DOT id_spec
{ $$ = pa_ppprogname( $1, $3 ); }
;
prepusing: /* empty */
{ $$ = NULL; }
| T_USING T_DESCRIPTOR T_IDENTIFIER
{ $$ = $3; }
;
execute: T_EXECUTE statement_spec using_sqlda
{ $$ = pa_execute( $2, $3 ); }
| T_EXECUTE T_IMMEDIATE string_spec
{ $$ = pa_execute_imm( $3 ); }
;
string_spec: T_STRING
{ $$ = pa_string_spec( ST_STRING, $1 ); }
| embhostvar
{ $$ = pa_string_spec( ST_HOSTVAR, $1 ); }
;
id_spec: T_STRING
{ $$ = pa_string_spec( ST_STRING, $1 ); }
| embhostvar
{ $$ = pa_string_spec( ST_HOSTVAR, $1 ); }
| T_IDENTIFIER
{ $$ = pa_string_spec( ST_STRING, $1 ); }
;
id_indspec: T_STRING
{ $$ = pa_string_spec( ST_STRING, $1 ); }
| indhostvar
{ $$ = pa_string_spec( ST_HOSTVAR, $1 ); }
| T_IDENTIFIER
{ $$ = pa_string_spec( ST_STRING, $1 ); }
;
hostvar: T_HOSTVAR
{ $$ = pa_runhostvar( $1, NULL ); }
| T_HOSTVAR T_HOSTVAR
{ $$ = pa_runhostvar( $1, $2 ); }
;
embhostvar: T_HOSTVAR
{ $$ = pa_embhostvar( $1, NULL, FALSE ); }
;
indhostvar: T_HOSTVAR
{ $$ = pa_embhostvar( $1, NULL, FALSE ); }
| T_HOSTVAR T_HOSTVAR
{ $$ = pa_embhostvar( $1, $2, FALSE ); }
;
intohostvar: T_HOSTVAR
{ $$ = pa_embhostvar( $1, NULL, TRUE ); }
| T_HOSTVAR T_HOSTVAR
{ $$ = pa_embhostvar( $1, $2, TRUE ); }
;
whenever: T_WHENEVER T_SQLERROR when_action
{ pa_set_action( A_ERROR, $3 ); }
| T_WHENEVER T_SQLWARNING when_action
{ pa_set_action( A_WARNING, $3 ); }
| T_WHENEVER notfound when_action
{ pa_set_action( A_NOTFOUND, $3 ); }
;
notfound: T_NOTFOUND
{ pa_ppspecific( L_SAAEXT ); }
| T_NOT T_FOUND
;
when_action: when_action2
{ $$ = $1; }
| T_STOP
{ pa_ppspecific( L_SAAEXT );
strcpy( buff, "sqlstop( &sqlca )" );
$$ = buff;
}
| T_CBLOCK
{ pa_ppspecific( L_SAAEXT );
$$ = $1;
}
;
when_action2: goto T_IDENTIFIER
{ sprintf( buff, "goto %s", $2 );
$$ = buff;
}
| T_CONTINUE
{ $$ = NULL; }
;
goto: T_GOTO
| T_GO T_TO
;
include: T_INCLUDE T_IDENTIFIER
{ $$ = pa_include( $2 ); }
;
/* declarations: begin_decl
| end_decl
;
*/
declexecsql: T_EXECSQL
;
declarations: begin_decl T_SEMI_COLON var_decl_list declexecsql end_decl
;
begin_decl: T_BEGIN T_DECLARE T_SECTION
;
end_decl: T_END T_DECLARE T_SECTION
{ LineInfo(); }
;
var_decl_list: /* empty */
| var_decl_list var_decl
{
pa_end_instr( FALSE );
pa_start_instr();
}
;
var_decl: { hostvar_type = 0; } type_specifier_list declarator_list T_SEMI_COLON
|
error T_SEMI_COLON
;
type_specifier_list: type_specifier
| type_specifier_list type_specifier
;
type_specifier: T_CHAR { hostvar_type |= HT_CHAR; }
| T_VARCHAR { hostvar_type |= HT_VARCHAR; }
| T_DATE { hostvar_type |= HT_DATE; }
| T_FIXCHAR { hostvar_type |= HT_FIXCHAR; }
| T_INTEGER { hostvar_type |= HT_INT; }
| T_SHORT { hostvar_type |= (HT_SHORT|HT_INT); }
| T_LONG { hostvar_type |= (HT_LONG|HT_INT); }
| T_UNSIGNED { hostvar_type |=(HT_UNSIGNED|HT_INT); }
| T_FLOAT { hostvar_type |= HT_FLOAT; }
| T_DOUBLE { hostvar_type |= (HT_FLOAT|HT_LONG); }
| T_DECIMAL { hostvar_type |= HT_DECIMAL; }
| T_STATVAR { hostvar_type |= HT_SQLSTAT; }
| T_STATIC
| T_EXTERN
| T_REGISTER
;
declarator_list: declarator
| declarator_list T_COMMA declarator
;
declarator: pointer declarator2 initializer
{ $$ = pa_decl( $2, hostvar_type|$1, NULL,
!SUBSCRIPTED, !PERMANENT, $3 ); }
| pointer declarator2 T_LBRACE intlist T_RBRACE initializer
{ $$ = pa_decl( $2, hostvar_type|$1, $4,
SUBSCRIPTED, !PERMANENT, $6 ); }
;
pointer: T_TIMES
{ $$ = HT_POINTER; }
| /* empty */
{ $$ = HT_NOTYPE; }
;
initializer: T_INITIALIZER
| /* empty */
{ $$ = NULL; }
;
intlist: intlist1
| /* empty */
{ $$ = NULL; }
;
intlist1: integer
{ $$ = pa_add_list_end( NULL, $1 ); }
| intlist1 T_COMMA integer
{ $$ = pa_add_list_end( $1, $3 ); }
;
declarator2: T_IDENTIFIER
;
setoption: T_SET optionkwd id_spec T_EQ id_indspec
{ $$ = pa_setoption( FALSE, NULL, $3, $5 ); }
| T_SET optionkwd id_spec T_DOT id_spec T_EQ id_indspec
{ $$ = pa_setoption( TRUE, $3, $5, $7 ); }
;
optionkwd: T_OPTION
| /* empty */
;
get_using: T_INTO intohostvar
{ $$ = pa_add_list( NULL, $2 );
$$ = pa_using_info( UT_HOSTLIST, $$ );
}
;
getoption: T_GET T_OPTION id_spec get_using
{ $$ = pa_getoption( FALSE, NULL, $3, $4 ); }
| T_GET T_OPTION id_spec T_DOT id_spec get_using
{ $$ = pa_getoption( TRUE, $3, $5, $6 ); }
;
%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -