From 73feed06c9ac4b59759bff8f504e3680267c7b2a Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 14 Nov 2017 15:51:35 -0500 Subject: [PATCH] Added some tool scripts for use later. Also added the first lexer for C/C++ --- docs/Buf.Cursor.html | 2 +- docs/Buf.html | 4 ++-- docs/Cfg.Color.Syntax.html | 2 +- docs/Cfg.Color.html | 4 ++-- docs/Cfg.html | 4 ++-- docs/Draw.Cursor.html | 2 +- docs/Draw.html | 4 ++-- docs/Misc.html | 2 +- docs/Rope.html | 2 +- docs/Scrollmap.html | 2 +- docs/View.html | 2 +- docs/X11.GlyphMap.html | 2 +- docs/X11.Rune.html | 2 +- docs/X11.html | 6 +++--- docs/index.html | 7 +++---- docs/index_exceptions.html | 4 ++-- docs/index_modules.html | 18 ++++++++--------- docs/index_types.html | 16 +++++++-------- docs/index_values.html | 40 ++++++++++++++++++------------------- docs/type_X11.GlyphMap.html | 1 - lib/lexers/cpp.mll | 24 ++++++++++++++++++++++ tools/E-S | 2 ++ tools/S-E | 2 ++ tools/del | 2 ++ tools/no-c++ | 2 ++ tools/tofn | 2 ++ 26 files changed, 96 insertions(+), 64 deletions(-) create mode 100644 lib/lexers/cpp.mll create mode 100755 tools/E-S create mode 100755 tools/S-E create mode 100755 tools/del create mode 100755 tools/no-c++ create mode 100755 tools/tofn diff --git a/docs/Buf.Cursor.html b/docs/Buf.Cursor.html index 2952d51..f55b43b 100644 --- a/docs/Buf.Cursor.html +++ b/docs/Buf.Cursor.html @@ -24,7 +24,7 @@  

Module Buf.Cursor

-
module Cursor: sig .. end

+
module Cursor: sig .. end

type csr = {
diff --git a/docs/Buf.html b/docs/Buf.html index 2b5147f..fef0b39 100644 --- a/docs/Buf.html +++ b/docs/Buf.html @@ -28,7 +28,7 @@

Module Buf

-
module Buf: sig .. end

+
module Buf: sig .. end

type buf = {
@@ -104,7 +104,7 @@
val length : buf -> int
val iteri : (int -> Rope.rune -> bool) -> buf -> int -> unit
val iter : (Rope.rune -> bool) -> buf -> int -> unit
-
module Cursor: sig .. end
+
module Cursor: sig .. end
val move_to : dest -> buf -> int -> int
val nextc : buf -> int -> int
val prevc : buf -> int -> int
diff --git a/docs/Cfg.Color.Syntax.html b/docs/Cfg.Color.Syntax.html index 1d69c7a..4e24f31 100644 --- a/docs/Cfg.Color.Syntax.html +++ b/docs/Cfg.Color.Syntax.html @@ -24,7 +24,7 @@  

Module Cfg.Color.Syntax

-
module Syntax: sig .. end

+
module Syntax: sig .. end

val normal : int
val comment : int
diff --git a/docs/Cfg.Color.html b/docs/Cfg.Color.html index 0ae0ac9..71da952 100644 --- a/docs/Cfg.Color.html +++ b/docs/Cfg.Color.html @@ -24,7 +24,7 @@  

Module Cfg.Color

-
module Color: sig .. end

+
module Color: sig .. end

val palette : int array
val scroll_nor : int * int
@@ -39,4 +39,4 @@
val edit_csr : int
val edit_rul : int
val borders : int * int
-
module Syntax: sig .. end
\ No newline at end of file +
module Syntax: sig .. end
\ No newline at end of file diff --git a/docs/Cfg.html b/docs/Cfg.html index b566741..6a81cb1 100644 --- a/docs/Cfg.html +++ b/docs/Cfg.html @@ -28,7 +28,7 @@

Module Cfg

-
module Cfg: sig .. end

+
module Cfg: sig .. end

val boolvar : string -> bool -> bool
val intvar : string -> int -> int
@@ -51,4 +51,4 @@
val scroll_lines : int
val dbl_click_time : int
val max_scan_dist : int
-
module Color: sig .. end
\ No newline at end of file +
module Color: sig .. end
\ No newline at end of file diff --git a/docs/Draw.Cursor.html b/docs/Draw.Cursor.html index 425675f..6dd4c39 100644 --- a/docs/Draw.Cursor.html +++ b/docs/Draw.Cursor.html @@ -24,7 +24,7 @@  

Module Draw.Cursor

-
module Cursor: sig .. end

+
module Cursor: sig .. end

type t = {
diff --git a/docs/Draw.html b/docs/Draw.html index 409af29..92f03a4 100644 --- a/docs/Draw.html +++ b/docs/Draw.html @@ -28,14 +28,14 @@

Module Draw

-
module Draw: sig .. end

+
module Draw: sig .. end

val font : X11.font
val font_height : int
val tabglyph : int
val tabwidth : int
val glyph_width : X11.glyph -> int
-
module Cursor: sig .. end
+
module Cursor: sig .. end
val rectangle : int -> int -> int -> Cursor.t -> unit
val dark_bkg : int -> int -> Cursor.t -> unit
val light_bkg : int -> int -> Cursor.t -> unit
diff --git a/docs/Misc.html b/docs/Misc.html index 287bd85..3f975b4 100644 --- a/docs/Misc.html +++ b/docs/Misc.html @@ -26,6 +26,6 @@

Module Misc

-
module Misc: sig .. end

+
module Misc: sig .. end

val load_file : string -> string
\ No newline at end of file diff --git a/docs/Rope.html b/docs/Rope.html index 6b235d1..bbaca59 100644 --- a/docs/Rope.html +++ b/docs/Rope.html @@ -28,7 +28,7 @@

Module Rope

-
module Rope: sig .. end

+
module Rope: sig .. end

exception Out_of_bounds of string
diff --git a/docs/Scrollmap.html b/docs/Scrollmap.html index 36b4e01..be5b11d 100644 --- a/docs/Scrollmap.html +++ b/docs/Scrollmap.html @@ -28,7 +28,7 @@

Module Scrollmap

-
module Scrollmap: sig .. end

+
module Scrollmap: sig .. end

type t = {
diff --git a/docs/View.html b/docs/View.html index 2ad94d5..2d6e1fa 100644 --- a/docs/View.html +++ b/docs/View.html @@ -26,7 +26,7 @@  

Module View

-
module View: sig .. end

+
module View: sig .. end

type t = {
diff --git a/docs/X11.GlyphMap.html b/docs/X11.GlyphMap.html index a603a14..e94cdda 100644 --- a/docs/X11.GlyphMap.html +++ b/docs/X11.GlyphMap.html @@ -26,5 +26,5 @@  

Module X11.GlyphMap

-
module GlyphMap: Map.Make(Rune)

+
module GlyphMap: Map.Make(Rune)

\ No newline at end of file diff --git a/docs/X11.Rune.html b/docs/X11.Rune.html index 38c5d18..2a9f928 100644 --- a/docs/X11.Rune.html +++ b/docs/X11.Rune.html @@ -26,7 +26,7 @@

Module X11.Rune

-
module Rune: sig .. end

+
module Rune: sig .. end

type t = int 
diff --git a/docs/X11.html b/docs/X11.html index dc39ef4..6271273 100644 --- a/docs/X11.html +++ b/docs/X11.html @@ -28,7 +28,7 @@

Module X11

-
module X11: sig .. end

+
module X11: sig .. end

type xatom 
@@ -456,8 +456,8 @@ -
module Rune: sig .. end
-
module GlyphMap: Map.Make(Rune)
+
module Rune: sig .. end
+
module GlyphMap: Map.Make(Rune)
val connect : unit -> unit
val disconnect : unit -> unit
val make_window : int -> int -> xwin
diff --git a/docs/index.html b/docs/index.html index 6cfc26c..d21b245 100644 --- a/docs/index.html +++ b/docs/index.html @@ -19,16 +19,15 @@ -
+

-
- -
+

+
diff --git a/docs/index_exceptions.html b/docs/index_exceptions.html index 6356339..b674928 100644 --- a/docs/index_exceptions.html +++ b/docs/index_exceptions.html @@ -22,10 +22,10 @@  

Index of exceptions

Misc
X11
Cfg
- + - +
B

B
Bad_rotation [Rope]
O

O
Out_of_bounds [Rope]
diff --git a/docs/index_modules.html b/docs/index_modules.html index d23f065..1407eb6 100644 --- a/docs/index_modules.html +++ b/docs/index_modules.html @@ -22,10 +22,10 @@  

Index of modules

- + - + @@ -34,29 +34,29 @@ - + - + - + - + - + - + - +
B

B
Buf
C

C
Cfg
Color [Cfg]
Cursor [Buf]
D

D
Draw
G

G
GlyphMap [X11]
M

M
Misc
R

R
Rope
Rune [X11]
S

S
Scrollmap
Syntax [Cfg.Color]
V

V
View
X

X
X11
diff --git a/docs/index_types.html b/docs/index_types.html index 8e00052..c9e1ebc 100644 --- a/docs/index_types.html +++ b/docs/index_types.html @@ -22,27 +22,27 @@  

Index of types

- + - + - + - + - + - + - + @@ -57,7 +57,7 @@ - + diff --git a/docs/index_values.html b/docs/index_values.html index 9bd4278..5942db1 100644 --- a/docs/index_values.html +++ b/docs/index_values.html @@ -22,7 +22,7 @@  

Index of values

B

B
buf [Buf]
C

C
csr [Buf.Cursor]
D

D
dest [Buf]
F

F
font [X11]
G

G
glyph [X11]
R

R
rope [Rope]
rune [Rope]
T

T
t [View]
t [Scrollmap]
t [X11.Rune]
X

X
xatom [X11]
xcfgvar [X11]
- + @@ -35,7 +35,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -156,14 +156,14 @@ - + - + @@ -194,15 +194,15 @@ - + - + - + @@ -221,7 +221,7 @@ - + @@ -248,7 +248,7 @@ - + @@ -269,12 +269,12 @@ - + - + @@ -307,7 +307,7 @@ - + @@ -320,7 +320,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -382,14 +382,14 @@ - + - + diff --git a/docs/type_X11.GlyphMap.html b/docs/type_X11.GlyphMap.html index b388f49..80ee296 100644 --- a/docs/type_X11.GlyphMap.html +++ b/docs/type_X11.GlyphMap.html @@ -24,7 +24,6 @@   val is_empty : 'a t -> bool
  val mem : key -> 'a t -> bool
  val add : key -> '-> 'a t -> 'a t
-  val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
  val singleton : key -> '-> 'a t
  val remove : key -> 'a t -> 'a t
  val merge :
diff --git a/lib/lexers/cpp.mll b/lib/lexers/cpp.mll new file mode 100644 index 0000000..1c36298 --- /dev/null +++ b/lib/lexers/cpp.mll @@ -0,0 +1,24 @@ +{ open Highlight } + +(* Line and Block Comments *) +let ln_cmt = "//" [^ '\r' '\n']* +let blk_cmt = "/*" _* "*/" + +let const = "true" | "false" | "NULL" + +let keyword = "goto" | "break" | "return" | "continue" | "asm" | "case" + | "default" | "if" | "else" | "switch" | "while" | "for" | "do" | "sizeof" + +let typedef = "bool" | "short" | "int" | "long" | "unsigned" | "signed" | "char" + | "size_t" | "void" | "extern" | "static" | "inline" | "struct" | "enum" + | "typedef" | "union" | "volatile" | "auto" | "const" | "int8_t" | "int16_t" + | "int32_t" | "int64_t" | "uint8_t" | "uint16_t" | "uint32_t" | "uint64_t" + +rule scan color = parse + | const { color Constant } + | keyword { color Keyword } + | typedef { color Type } + | ln_cmt { color Comment } + | blk_cmt { color Comment } + | _ { None } + | eof { raise Eof } diff --git a/tools/E-S b/tools/E-S new file mode 100755 index 0000000..872235f --- /dev/null +++ b/tools/E-S @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's/GNTX_EXTERN\|extern/static/g' diff --git a/tools/S-E b/tools/S-E new file mode 100755 index 0000000..94e333f --- /dev/null +++ b/tools/S-E @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's/GNTX_STATIC\|static/extern/g' diff --git a/tools/del b/tools/del new file mode 100755 index 0000000..a6ebf9a --- /dev/null +++ b/tools/del @@ -0,0 +1,2 @@ +#!/bin/sh +sed "s/$1//g" diff --git a/tools/no-c++ b/tools/no-c++ new file mode 100755 index 0000000..8d1474c --- /dev/null +++ b/tools/no-c++ @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's_\/\/\([^\r\n]\+\)_\/*\1 *\/_g' diff --git a/tools/tofn b/tools/tofn new file mode 100755 index 0000000..2eacda5 --- /dev/null +++ b/tools/tofn @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's/;\r\?$/\n{\n}\n/g' -- 2.52.0
B

B
bol [Buf.Cursor]
bol [Buf]
buffer [Draw]
C

C
cache_update [X11]
char [Cfg.Color.Syntax]
copy_indent [Cfg]
D

D
dark_bkg [Draw]
dbl_click_time [Cfg]
draw_tab [Draw.Cursor]
E

E
edit [Draw]
edit_csr [Cfg.Color]
expand_tabs [Cfg]
F

F
find_line [Scrollmap]
first [Scrollmap]
from_string [Rope]
G

G
get_glyph [X11]
getc [Buf.Cursor]
gutter_sel [Cfg.Color]
H

H
has_next_line [Draw.Cursor]
height [Rope]
hrule [Draw]
I

I
intern [X11]
intvar [Cfg]
iteri [Rope]
J

J
join [Rope]
join_special [Rope]
K

K
keyword [Cfg.Color.Syntax]
L

L
last [Rope]
length [Buf]
load_file [Misc]
M

M
make [View]
make [Scrollmap]
move_x [Draw.Cursor]
N

N
next_glyph [Draw.Cursor]
next_line [Draw.Cursor]
number [Cfg.Color.Syntax]
O

O
offset [Buf.Cursor]
operator [Cfg.Color.Syntax]
P

P
palette [Cfg.Color]
path [View]
puts [Rope]
R

R
rectangle [Draw]
resize [View]
ruler_column [Cfg]
S

S
scroll [Draw]
scroll_dn [View]
syntax_enabled [Cfg]
T

T
tab_width [Cfg]
tabglyph [Draw]
typedef [Cfg.Color.Syntax]
V

V
var_get [X11]
variable [Cfg.Color.Syntax]
vrule [Draw]
W

W
winheight [Cfg]
winwidth [Cfg]