Skip to content

Commit

Permalink
#79 *Improved handling of Unicode quotes.
Browse files Browse the repository at this point in the history
  • Loading branch information
paladin-t committed Sep 18, 2023
1 parent c760bef commit 67ef347
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
3 changes: 3 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Sep. 18 2023
Improved handling of Unicode quotes

Jul. 21 2022
Fixed an array retrieving bug in the mb_get_vars function, thanks to nurbles for pointing it out

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (C) 2011 - 2022 Tony Wang
Copyright (C) 2011 - 2023 Tony Wang

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
|_|_|_| |_| |_____|__|__|_____|_____|_____|
~~~~~~~~~~

**Copyright (C) 2011 - 2022 Tony Wang**
**Copyright (C) 2011 - 2023 Tony Wang**

[![Build status](https://github.com/paladin-t/my_basic/actions/workflows/c.yml/badge.svg)](https://github.com/paladin-t/my_basic/actions/workflows/c.yml)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
Expand Down
15 changes: 14 additions & 1 deletion core/my_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**
** For the latest info, see https://github.com/paladin-t/my_basic/
**
** Copyright (C) 2011 - 2022 Tony Wang
** Copyright (C) 2011 - 2023 Tony Wang
**
** Permission is hereby granted, free of charge, to any person obtaining a copy of
** this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -773,6 +773,9 @@ MBCONST static const _var_t _VAR_ARGS = { _VAR_ARGS_STR, 0 };
MBCONST static const char _MULTI_LINE_COMMENT_PREFIX[] = "'[";
MBCONST static const char _MULTI_LINE_COMMENT_POSTFIX[] = "']";

MBCONST static const char _UNICODE_OPEN_QUOTE[] = { 0xe2, 0x80, 0x9c };
MBCONST static const char _UNICODE_CLOSE_QUOTE[] = { 0xe2, 0x80, 0x9d };

typedef enum _parsing_state_e {
_PS_NORMAL,
_PS_STRING,
Expand Down Expand Up @@ -5888,6 +5891,16 @@ static int _parse_char(mb_interpreter_t* s, const char* str, int n, int pos, uns
case _PS_NORMAL:
#ifdef MB_ENABLE_UNICODE_ID
if(uc) {
if(n == countof(_UNICODE_OPEN_QUOTE)) {
if(memcmp(str, _UNICODE_OPEN_QUOTE, n) == 0) {
_handle_error_at_pos(s, SE_PS_INVALID_CHAR, s->source_file, pos, row, col, MB_FUNC_ERR, _exit, result);
}
}
if(n == countof(_UNICODE_CLOSE_QUOTE)) {
if(memcmp(str, _UNICODE_CLOSE_QUOTE, n) == 0) {
_handle_error_at_pos(s, SE_PS_INVALID_CHAR, s->source_file, pos, row, col, MB_FUNC_ERR, _exit, result);
}
}
if(context->symbol_state == _SS_IDENTIFIER) {
_mb_check_exit(result = _append_uu_char_to_symbol(s, str, n), _exit);
} else if(context->symbol_state == _SS_OPERATOR) {
Expand Down
2 changes: 1 addition & 1 deletion core/my_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**
** For the latest info, see https://github.com/paladin-t/my_basic/
**
** Copyright (C) 2011 - 2022 Tony Wang
** Copyright (C) 2011 - 2023 Tony Wang
**
** Permission is hereby granted, free of charge, to any person obtaining a copy of
** this software and associated documentation files (the "Software"), to deal in
Expand Down
4 changes: 2 additions & 2 deletions donate.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!--
COPYRIGHT 2011 - 2022 TONY WANG. ALL RIGHTS REESERVED.
COPYRIGHT 2011 - 2023 TONY WANG. ALL RIGHTS REESERVED.
LIST OF DONORS.
-->
<html>
Expand Down Expand Up @@ -135,7 +135,7 @@ <h3>
</p>

<hr />
<p align="center">Copyright (C) 2011 - 2022 Tony Wang, all rights reserved</p>
<p align="center">Copyright (C) 2011 - 2023 Tony Wang, all rights reserved</p>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion resource/my_basic.rc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
VALUE "FileDescription", "MY-BASIC Interpreter for Windows"
VALUE "FileVersion", "1, 2, 1, 0"
VALUE "InternalName", "my_basic"
VALUE "LegalCopyright", "Copyright (C) 2011 - 2022 Tony Wang"
VALUE "LegalCopyright", "Copyright (C) 2011 - 2023 Tony Wang"
VALUE "LegalTrademarks", "MY-BASIC"
VALUE "OriginalFilename", "my_basic.exe"
VALUE "ProductName", "MY-BASIC"
Expand Down
4 changes: 2 additions & 2 deletions shell/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**
** For the latest info, see https://github.com/paladin-t/my_basic/
**
** Copyright (C) 2011 - 2022 Tony Wang
** Copyright (C) 2011 - 2023 Tony Wang
**
** Permission is hereby granted, free of charge, to any person obtaining a copy of
** this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -978,7 +978,7 @@ static void _list_directory(const char* path) {

static void _show_tip(void) {
_printf("MY-BASIC Interpreter Shell - %s\n", mb_ver_string());
_printf("Copyright (C) 2011 - 2022 Tony Wang. All Rights Reserved.\n");
_printf("Copyright (C) 2011 - 2023 Tony Wang. All Rights Reserved.\n");
_printf("For more information, see https://github.com/paladin-t/my_basic/.\n");
_printf("Input HELP and hint enter to view the help information.\n");
}
Expand Down

0 comments on commit 67ef347

Please sign in to comment.