Skip to content

Commit

Permalink
1) feat : Add container_11(c1 ~ c11), 2) style : Change opt_serial_op…
Browse files Browse the repository at this point in the history
…tion_list to opt_serial_option_list_or_owner_clause
  • Loading branch information
jongmin-won committed Apr 22, 2024
1 parent da187a8 commit 6f33842
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 39 deletions.
1 change: 1 addition & 0 deletions msg/de_DE.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Außer virtuellem Speicher: %1$d Bytes können nicht zugewiesen werden.
Expand Down
1 change: 1 addition & 0 deletions msg/en_US.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/en_US/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/es_ES.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Sin memoria virtual: incapaz de asignar %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/fr_FR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Mémoire virtuelle épuisée: impossible d'allouer %1$d octets.
Expand Down
1 change: 1 addition & 0 deletions msg/it_IT.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Fuori di memoria virtuale: Impossibile allocare %1$d byte.
Expand Down
1 change: 1 addition & 0 deletions msg/ja_JP.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 バチャールメモリーが足りません。: %1$dバイトがアロケーションできません。
Expand Down
1 change: 1 addition & 0 deletions msg/km_KH.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/ko_KR.euckr/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 �̸� �ٲٱ�� �����ڸ� ������ �� �����ϴ�.
316 �̸� �ٲٱ�� ���� �̸����� ������ �� �����ϴ�.
317 �ĺ��ڴ� LIMIT �� �ȿ� ���� �� �����ϴ�.
318 DBA �� DBA �׷� �������� %1$s��(��) ������ �� �ֽ��ϴ�.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 ���� �޸� ����: %1$d ����Ʈ�� �Ҵ��� �� �����ϴ�.
Expand Down
1 change: 1 addition & 0 deletions msg/ko_KR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 이름 바꾸기는 소유자를 변경할 수 없습니다.
316 이름 바꾸기는 같은 이름으로 변경할 수 없습니다.
317 식별자는 LIMIT 절 안에 있을 수 없습니다.
318 DBA 및 DBA 그룹 구성원만 %1$s을(를) 수행할 수 있습니다.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 가상 메모리 없음: %1$d 바이트를 할당할 수 없습니다.
Expand Down
1 change: 1 addition & 0 deletions msg/ro_RO.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Memorie virtuală epuizată: nu s-au putut aloca %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/tr_TR.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Sanal bellek yetersiz: %1$d bayt bölüm ayıramadı.
Expand Down
1 change: 1 addition & 0 deletions msg/vi_VN.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 Out of virtual memory: unable to allocate %1$d bytes.
Expand Down
1 change: 1 addition & 0 deletions msg/zh_CN.utf8/cubrid.msg
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@ $set 8 MSGCAT_SET_PARSER_SEMANTIC
315 Rename cannot change owner.
316 Rename cannot be changed to the same name.
317 Identifiers cannot be in a LIMIT clause.
318 Only DBA and DBA group members can perform %1$s.

$set 9 MSGCAT_SET_PARSER_RUNTIME
1 虚拟内存耗尽: 无法申请 %1$d 字节.
Expand Down
139 changes: 100 additions & 39 deletions src/parser/csql_grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ typedef struct
PT_NODE *c10;
} container_10;

typedef struct
{
PT_NODE *c1;
PT_NODE *c2;
PT_NODE *c3;
PT_NODE *c4;
PT_NODE *c5;
PT_NODE *c6;
PT_NODE *c7;
PT_NODE *c8;
PT_NODE *c9;
PT_NODE *c10;
PT_NODE *c11;
} container_11;

void csql_yyerror_explicit (int line, int column);
void csql_yyerror (const char *s);

Expand Down Expand Up @@ -264,6 +279,7 @@ static bool is_in_create_trigger = false;
#define CONTAINER_AT_7(a) (a).c8
#define CONTAINER_AT_8(a) (a).c9
#define CONTAINER_AT_9(a) (a).c10
#define CONTAINER_AT_10(a) (a).c11

#define YEN_SIGN_TEXT "(\0xa1\0xef)"
#define DOLLAR_SIGN_TEXT "$"
Expand Down Expand Up @@ -304,6 +320,7 @@ typedef enum
SERIAL_MIN,
SERIAL_CYCLE,
SERIAL_CACHE,
SERIAL_CHANGE_OWNER,
} SERIAL_DEFINE;

typedef enum
Expand Down Expand Up @@ -551,6 +568,7 @@ static char *g_plcsql_text;
container_3 c3;
container_4 c4;
container_10 c10;
container_11 c11;
struct json_table_column_behavior jtcb;
}

Expand Down Expand Up @@ -1025,8 +1043,10 @@ static char *g_plcsql_text;

/* define rule type (container) */
/*{{{*/
%type <c10> opt_serial_option_list
%type <c10> serial_option_list
%type <c11> opt_serial_option_list
%type <c11> serial_option_list
%type <c11> opt_serial_option_list_or_owner_clause
%type <c11> serial_owner_clause
%type <c10> connect_info
%type <c10> alter_server_list

Expand All @@ -1038,6 +1058,7 @@ static char *g_plcsql_text;
%type <c3> ref_rule_list
%type <c3> opt_ref_rule_list
%type <c3> of_serial_option
%type <c3> of_serial_owner_clause
%type <c3> delete_from_using
%type <c3> trigger_status_or_priority_or_change_owner

Expand Down Expand Up @@ -3285,8 +3306,8 @@ class_name_for_synonym
opt_serial_option_list
: /* empty */
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list, : );
container_10 ctn;
memset(&ctn, 0x00, sizeof(container_10));
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));
$$ = ctn;
}}
| serial_option_list
Expand All @@ -3295,6 +3316,23 @@ opt_serial_option_list
}}
;

opt_serial_option_list_or_owner_clause
: /* empty */
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, : );
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));
$$ = ctn;
}}
| serial_option_list
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, | serial_option_list);
$$ = $1;
}}
| serial_owner_clause
{{ DBG_TRACE_GRAMMAR(opt_serial_option_list_or_owner_clause, | serial_owner_clause);
$$ = $1;
}}
;

serial_option_list
: serial_option_list of_serial_option
{{ DBG_TRACE_GRAMMAR(serial_option_list, : serial_option_list of_serial_option);
Expand All @@ -3316,7 +3354,7 @@ serial_option_list
* 10: no_cache,
*/

container_10 ctn = $1;
container_11 ctn = $1;

PT_NODE* node = pt_top(this_parser);
PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
Expand Down Expand Up @@ -3411,8 +3449,8 @@ serial_option_list
* 10: no_cache,
*/

container_10 ctn;
memset(&ctn, 0x00, sizeof(container_10));
container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));

switch(TO_NUMBER (CONTAINER_AT_0($1)))
{
Expand Down Expand Up @@ -3489,6 +3527,51 @@ of_serial_option
DBG_PRINT}}
;

serial_owner_clause
: of_serial_owner_clause
{{ DBG_TRACE_GRAMMAR(serial_owner_clause, : of_serial_owner_clause);
/* container order
* 1: start_val
*
* 2: increment_val,
*
* 3: max_val,
* 4: no_max,
*
* 5: min_val,
* 6: no_min,
*
* 7: cyclic,
* 8: no_cyclic,
*
* 9: cached_num_val,
* 10: no_cache,
* 11: owner,
*/

container_11 ctn;
memset(&ctn, 0x00, sizeof(container_11));

switch(TO_NUMBER (CONTAINER_AT_0($1)))
{
case SERIAL_CHANGE_OWNER:
ctn.c11 = CONTAINER_AT_1($1);
break;
}

$$ = ctn;

DBG_PRINT}}
;

of_serial_owner_clause
: OWNER TO identifier
{{ DBG_TRACE_GRAMMAR(of_serial_owner_clause, : OWNER TO identifier);
container_3 ctn;
SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_CHANGE_OWNER), $3, NULL);
$$ = ctn;
DBG_PRINT}}
;

opt_replace
: /* empty */
Expand Down Expand Up @@ -3735,9 +3818,9 @@ alter_stmt
| ALTER /* 1 */
SERIAL /* 2 */
serial_name /* 3 */
opt_serial_option_list /* 4 */
opt_serial_option_list_or_owner_clause /* 4 */
opt_comment_spec /* 5 */
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name opt_serial_option_list opt_comment_spec);
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name opt_serial_option_list_or_owner_clause opt_comment_spec);
/* container order
* 0: start_val
* 1: increment_val,
Expand All @@ -3749,6 +3832,7 @@ alter_stmt
* 7: no_cyclic,
* 8: cached_num_val,
* 9: no_cache,
* 10: owner,
*/

PT_NODE *serial_name = $3;
Expand All @@ -3762,6 +3846,7 @@ alter_stmt
int no_cyclic = (int) TO_NUMBER (CONTAINER_AT_7 ($4));
PT_NODE *cached_num_val = CONTAINER_AT_8 ($4);
int no_cache = (int) TO_NUMBER (CONTAINER_AT_9 ($4));
PT_NODE *owner_name = CONTAINER_AT_10 ($4);
PT_NODE *comment = $5;

PT_NODE *node = parser_new_node (this_parser, PT_ALTER_SERIAL);
Expand All @@ -3778,6 +3863,7 @@ alter_stmt
node->info.serial.no_cyclic = no_cyclic;
node->info.serial.cached_num_val = cached_num_val;
node->info.serial.no_cache = no_cache;
node->info.serial.owner_name = owner_name;
node->info.serial.comment = comment;
node->info.serial.code = PT_SERIAL_OPTION;
}
Expand All @@ -3789,40 +3875,15 @@ alter_stmt
&& cyclic == 0 && no_max == 0 && no_min == 0
&& no_cyclic == 0 && !cached_num_val && no_cache == 0)
{
if (comment != NULL)
if (owner_name != NULL)
{
node->info.serial.code = PT_SERIAL_COMMENT;
node->info.serial.code = PT_CHANGE_OWNER;
}
}

DBG_PRINT}}
| ALTER /* 1 */
SERIAL /* 2 */
serial_name /* 3 */
OWNER TO identifier /* 4, 5, 6 */
opt_comment_spec /* 7 */
{{ DBG_TRACE_GRAMMAR(alter_stmt, | ALTER SERIAL serial_name OWNER TO identifier opt_comment_spec);

PT_NODE *node = parser_new_node (this_parser, PT_ALTER_SERIAL);

if (node)
{
node->info.serial.serial_name = $3;
node->info.serial.owner_name = $6;
node->info.serial.comment = $7;
node->info.serial.code = PT_CHANGE_OWNER;
}

$$ = node;
PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)

if (node->info.serial.owner_name == NULL)
{
if (node->info.serial.comment != NULL)
{
else if (comment != NULL)
{
node->info.serial.code = PT_SERIAL_COMMENT;
}
}
}
DBG_PRINT}}
| ALTER /* 1 */
{ /* 2 */
Expand Down
1 change: 1 addition & 0 deletions src/parser/parser_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
#define MSGCAT_SEMANTIC_SYNONYM_RENAME_CANNOT_CHANGE_OWNER MSGCAT_SEMANTIC_NO(315)
#define MSGCAT_SEMANTIC_SYNONYM_RENAME_CANNOT_SAME_NAME MSGCAT_SEMANTIC_NO(316)
#define MSGCAT_SEMANTIC_IDENTIFIER_IN_LIMIT_CLAUSE MSGCAT_SEMANTIC_NO(317)
#define MSGCAT_SEMANTIC_SERIAL_NOT_OWNER MSGCAT_SEMANTIC_NO(318)

/* Message id in the set MSGCAT_SET_PARSER_RUNTIME */
#define MSGCAT_RUNTIME_NO(n) n
Expand Down

0 comments on commit 6f33842

Please sign in to comment.