Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated or and & #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aurochs/process.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ let parse_file_with_nog pg fn =
end
in
let pt =
let (trace, interactive) = (!Opt.trace or !Opt.debug, !Opt.debug) in
let (trace, interactive) = (!Opt.trace || !Opt.debug, !Opt.debug) in
Nog.execute_positioned
~quick:!Opt.quick
?log_calls:!Opt.log_calls
Expand Down
16 changes: 8 additions & 8 deletions nog/nog.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ let execute_positioned_quick program
| BNEOF -> if c.head < m then run pc' else run pc
| BNBOF -> if c.head > 0 then run pc' else run pc
| BMB -> if c.memo_register = Busy then run pc' else run pc
| BMBF -> if c.memo_register = Busy or c.memo_register = Failure then run pc' else run pc
| BMBF -> if c.memo_register = Busy || c.memo_register = Failure then run pc' else run pc
| BBRS -> if Stack.pop c.boolean then run pc' else run pc
| BBRC -> if not (Stack.pop c.boolean) then run pc' else run pc
| BMF -> if c.memo_register = Failure then run pc' else run pc
| BMUK -> if c.memo_register = Unknown then run pc' else run pc
| BMK -> if c.memo_register <> Unknown then run pc' else run pc
| JSR -> run pc'; run pc
| SBNS ch ->
if c.head = m or u.[c.head] <> ch then
if c.head = m || u.[c.head] <> ch then
run pc'
else
begin
Expand All @@ -252,7 +252,7 @@ let execute_positioned_quick program
| BOR ->
let br1 = Stack.pop c.boolean in
let br2 = Stack.pop c.boolean in
Stack.push (br1 or br2) c.boolean
Stack.push (br1 || br2) c.boolean
| BNOT -> Stack.push (not (Stack.pop c.boolean)) c.boolean
| BTRUE -> Stack.push true c.boolean
| BFALSE -> Stack.push false c.boolean
Expand Down Expand Up @@ -446,7 +446,7 @@ let execute_positioned program
pf "S=[%a]\n" (print_stack print_stack_symbol) c.stack;
in
let iterate () =
if c.pc < 0 or c.pc >= n then
if c.pc < 0 || c.pc >= n then
raise (Error "PC out of bounds")
else
begin
Expand All @@ -466,7 +466,7 @@ let execute_positioned program
| BNEOF -> if c.head < m then c.pc <- pc
| BNBOF -> if c.head > 0 then c.pc <- pc
| BMB -> if c.memo_register = Busy then c.pc <- pc
| BMBF -> if c.memo_register = Busy or c.memo_register = Failure then c.pc <- pc
| BMBF -> if c.memo_register = Busy || c.memo_register = Failure then c.pc <- pc
| BBRS -> if Stack.pop c.boolean then c.pc <- pc
| BBRC -> if not (Stack.pop c.boolean) then c.pc <- pc
| BMF -> if c.memo_register = Failure then c.pc <- pc
Expand All @@ -478,7 +478,7 @@ let execute_positioned program
(*log_call program.pg_start;*)
c.pc <- pc
| SBNS ch ->
if c.head = m or u.[c.head] <> ch then
if c.head = m || u.[c.head] <> ch then
c.pc <- pc
else
c.head <- c.head + 1
Expand All @@ -494,7 +494,7 @@ let execute_positioned program
| BOR ->
let br1 = Stack.pop c.boolean in
let br2 = Stack.pop c.boolean in
Stack.push (br1 or br2) c.boolean
Stack.push (br1 || br2) c.boolean
| BNOT -> Stack.push (not (Stack.pop c.boolean)) c.boolean
| BTRUE -> Stack.push true c.boolean
| BFALSE -> Stack.push false c.boolean
Expand Down Expand Up @@ -838,7 +838,7 @@ let is_space = ("is_space", (=) ' ');;
let is_not_space = ("is_not_space", (<>) ' ');;
(* ***)
(*** is_alpha *)
let is_alpha = ("is_alpha", (fun c -> ('a' <= c && c <= 'z') or ('A' <= c && c <= 'Z')));;
let is_alpha = ("is_alpha", (fun c -> ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')));;
(* ***)
(*** number *)
let number ?root pg iterator =
Expand Down
2 changes: 1 addition & 1 deletion peg/peg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ let is_factor v u i =
in
0 <= i && i < m && n <= m - i &&
let rec loop j =
j = n or
j = n ||
u.[i + j] = v.[j] && loop (j + 1)
in
loop 0
Expand Down
20 changes: 10 additions & 10 deletions util/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let first_line =
fun w ->
Buffer.clear b;
let rec loop i =
if i = String.length w or w.[i] = '\n' then
if i = String.length w || w.[i] = '\n' then
Buffer.contents b
else
begin
Expand Down Expand Up @@ -63,7 +63,7 @@ let split_once_at f s =
else
loop1 (i + 1)
and loop2 i j =
if j = m or not (f s.[j]) then
if j = m || not (f s.[j]) then
(i,j)
else
loop2 i (j + 1)
Expand Down Expand Up @@ -102,7 +102,7 @@ let parse_strings u =
loop2 r (i + 1)
| _ -> loop1 r i
and loop1 r i =
if i = m or is_space u.[i] or u.[i] = '"' then
if i = m || is_space u.[i] || u.[i] = '"' then
begin
let x = Buffer.contents b in
Buffer.clear b;
Expand Down Expand Up @@ -167,7 +167,7 @@ let split_at c u =
else
loop1 r i
and loop1 r i =
if i = m or u.[i] = c then
if i = m || u.[i] = c then
begin
let x = Buffer.contents b in
Buffer.clear b;
Expand Down Expand Up @@ -332,13 +332,13 @@ let word_wrap oc ?(columns=75) u =
(* j: actual cursor column *)
(* k: number of pending spaces *)
and loop2 i0 i j k =
if i = m or u.[i] = ' ' or u.[i] = '\t' or u.[i] = '\n' then
if i = m || u.[i] = ' ' || u.[i] = '\t' || u.[i] = '\n' then
let l = i - i0 in
if j + k + l >= columns then
begin
f '\n';
g u i0 l;
if i < m & u.[i] = '\n' then
if i < m && u.[i] = '\n' then
begin
f '\n';
loop0 (i + 1) 0
Expand Down Expand Up @@ -398,7 +398,7 @@ let substitute_variables env w =
let list_sub_rev l start length =
let rec loop r j = function
| [] -> r (* shall we raise an exception ? *)
| x::y -> loop (if j < start or j >= start + length then r else x::r) (j + 1) y
| x::y -> loop (if j < start || j >= start + length then r else x::r) (j + 1) y
in
loop [] 0 l

Expand All @@ -407,7 +407,7 @@ let is_prefix u v =
and n = String.length v
in
m <= n &&
let rec loop i = i = m or u.[i] = v.[i] && loop (i + 1) in
let rec loop i = i = m || u.[i] = v.[i] && loop (i + 1) in
loop 0

let remove_prefix u v =
Expand All @@ -422,7 +422,7 @@ let is_suffix u v =
and n = String.length v
in
m <= n &&
let rec loop i = i = m or u.[m - 1 - i] = v.[n - 1 - i] && loop (i + 1) in
let rec loop i = i = m || u.[m - 1 - i] = v.[n - 1 - i] && loop (i + 1) in
loop 0

let remove_suffix u v =
Expand Down Expand Up @@ -513,7 +513,7 @@ let array_mem_assoc x a =
if i = m then false
else
let (y,_) = a.(i) in
x = y or loop (i + 1)
x = y || loop (i + 1)
in
loop 0

Expand Down