forked from deltaray/clide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIDEAS
52 lines (34 loc) · 1.86 KB
/
IDEAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Ideas for syntax
"/\<.*\>/,fg=blue,bg=black"
Allow for predefined keywords that come with the program.
EMAIL,fg=blue,bg=black Match all e-mail addresses
URL,fg=red
DOMAIN,bg=blue Match things that look like domains/hostnames
DEFAULT,fg=blue,bg=black
All keywords should do a case insentive match unless it doesn't make sense to.
Other keywords:
HTMLTAG
FILEPATH
WHITESPACE (spaces, tabs)
Limited flag support. So /\<.*\>/ will match first and /\<.*\>/g will match all on line.
i - case insensitive matching.
Order of expressions: Highest priority is given right to left.
So if multiple things match, an expression on the right will override one on the left arguments.
What to do about existing color sequences? Remove them? Allow them to be replaced, that could be neat.
Should multiple line expressions be allowed? Could use perl's /m flag.
--
Idea for doing color substitutions that would solve some issues.
Instead of directly altering the line, we'd build a data structure
that would keep track of what colors are meant to be inserted at a
position in the string. Actually, what would probably work well
is to use an array the with the same number of elements as the length
of the string and then replace all the elements in the slice of the
array that matches with indexes of the color escape codes in the pallette
and style. If an overlapping expression matches, then it would just
replace the elements it needs to. Then when all replacements are
done, a function goes through and determines the start and end of
various combinations of atttributes so that we're not starting and
stopping a sequence for each character.
Doing it this way would solve the overlapping problem and the 8-bit
character problem and the 256+ color problem. It will also be easier
to work with because we won't have to work with upper 8-bit characters.