Commit Graph

18 Commits

Author SHA1 Message Date
Jordan Ellis Coppard
39c5fba9d9
add elem in map (#121) 2021-06-23 21:03:26 +05:30
Tiago Cavalcante Trindade
6d434db0cb
Add <<= and >>= operators (#119)
* Add <<= and >>=
2021-06-23 19:54:20 +05:30
Thakee Nathees
64bf27674a
in test (ie. elem in container) implemented. (#117)
in keyword will invoke varContains(), the for now the list contains
implemented.
2021-06-23 15:51:59 +05:30
Dmitry Guzeev
dbdb43b8ed
Number literal parsing (#106)
* Implement proper number literal parsing

- Scientific notation support
- Correct error handling in cases of invalid digits present in binary or
  hex literals (0b123, 0x013FK).

* Fix style linter issues

* Support +/- in number literal exponent, add tests

- Add tests for scientific notation number literal parsing
- Add support for +/- in scientific notation exponents
2021-06-23 10:30:06 +05:30
Tiago Cavalcante Trindade
fe45ba3485
Numeric literal starts with decimal point implementation (Fix: #97) 2021-06-23 00:51:19 +05:30
Takashi Idobe
c0f00f6cae
add modeq implementation (#108)
* add modeq implementation

* code review feedback
2021-06-22 17:49:52 +05:30
Thakee Nathees
733f006b03
Merge pull request #95 from ThakeeNathees/pk_doc
[WIP] Docstring extracted and `help()` function added
2021-06-18 15:45:19 +05:30
Thakee Nathees
e1628f1a73 docstring for pocket functions implemented 2021-06-18 14:52:24 +05:30
Derick Alangi
fbcf6fc1a1 use PEEK() so we don't loose reference 2021-06-17 13:43:09 +01:00
Derick Alangi
ac1d825f13 Add support for bitwise NOT (~) operator to pocketlang
Like other bitwise operators like: &, ^, >>, << etc, add support
for the bitwise NOT (~) operator.
2021-06-17 13:40:56 +01:00
Alexander Patel
59333177cd pk_core: implement list addition
This commit implements list addition. A new list is allocated, and
the contents of l1 and l2 are concatenated onto the list.

This is done by extending the buffer template macro to support a
`concat` operation, which given an `other` buffer, appends all
elements of the `other` buffer to the end of the `self` buffer.
Allocations are done as needed.

We implement this additional operation, since the alternative would
be to call `reserve()` for each `write()` operation, which doesn't
seem ideal.

Issue: #55
2021-06-15 20:44:10 -07:00
Thakee Nathees
7ab4e55d6e
bin hex literals implemented (#72) 2021-06-16 00:24:30 +05:30
Alexander Patel
ae4d2971c1 operator oreq and xoreq implemented 2021-06-14 21:36:10 -07:00
Thakee Nathees
72e7522c12 operator andeq implemented 2021-06-14 21:50:07 +05:30
Thakee Nathees
e90763c878 Merge pull request #65 from xSavitar/attr-range-start-end
Add support for `.start` and `.end` attributes on Range objects
2021-06-13 22:30:16 +05:30
Derick Alangi
22be6af376 Add support for bitwise XOR, LSHIFT and RSHIFT operators (#63)
This commit addresses issue #54 in an attempt to add more bitwise
operators to pocketlang. Tests have also been written to verify that
the operators indeed works as expected.

To add, I also introduced a macro PK_RIGHT_OP that just aliases the
string "Right operand" which was already getting too hardcoded and
appearing too much in the pk_core.c file.
2021-06-13 20:27:48 +05:30
Derick Alangi
2707c1eec3
Fix #54: Add bitwise OR operator and make it available in PKVM (#59)
* Fix #54: Add bitwise OR operator and make it available in PKVM

Like the bitwise AND, this is an implementation for pocketlang to
support the bitwise OR operation. In addition, updated "value" ->
"result" in other operation to correctly reflect the container's
purpose. It's indeed the result after the operation, which is a value
too.

In addition, add tests for bitwise AND (&) and bitwise OR (|). Add a
print statement in test file with message that all tests passed with
no errors.

* Fix typo in comment

* Cleanup fixes
2021-06-13 09:43:05 +05:30
Thakee Nathees
9fdab23a94 core attributes refactored and added tests 2021-06-10 23:12:04 +05:30