mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 06:58:45 +00:00
operator prescendence added
This commit is contained in:
parent
93ac5f8e33
commit
e62144feac
11 changed files with 328 additions and 26 deletions
|
|
@ -20,7 +20,7 @@ def find_prefix_hashes : str = {
|
|||
var hashes = (Array 'H).new: (str.size: + 1)
|
||||
|
||||
; hashes`0 = 'H.of: str`0
|
||||
for i in 1..hashes.size: do {
|
||||
for i in 1--hashes.size: do {
|
||||
; hashes`i = hashes`(i - 1)
|
||||
; hashes`i.append: str`i
|
||||
}
|
||||
|
|
@ -37,8 +37,8 @@ def find_substring : str substr = {
|
|||
const str_hashes = find_prefix_hashes Hash: str
|
||||
const substr_hash = Hash.of: substr
|
||||
|
||||
for i in 0..(str_hashes.size: - substr.size:) do {
|
||||
const part_hash = Hash.diff: str_hashes`(i + substr->size:) str_hashes`i
|
||||
for i in 0--(str_hashes.size: - substr.size:) do {
|
||||
const part_hash = Hash.diff: str_hashes`(i + substr.size:) str_hashes`i
|
||||
|
||||
if part_hash == substr_hash then {
|
||||
; result.push: i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue