MySample
MySample is my version of the sample application that
came with the Crystal Edit
edit control.
(It is the (stand-alone) editor that I use most. It is one
of the main tools to maintain my
web site, of which this page belongs.)
Most of my efforts went into reimplementing the colour
coding making use of the Plug-in
Pattern. This also allows the implementation of real
syntax colouring, not simple lexical colouring as most other
editors do.
Other improvements are:
- Save all button: saves all modified files.
- Refresh button: reloads the current active file, if it has
not been modified and if there is a new version available.
- Menu for dynamically selecting a syntax colourer.
- Having a character wide caret when in overstrike mode.
(Because most of the time, I don't notice the OVR in the status line,
when I hit the insert button by accident.)
- Syntax colouring for JavaScript
also inside HTML.
- Goto (F5) command, which when used inside HREF in
HTML opens the file and searches for 'NAME="label"',
when '#label' is used. (November 3, 2010)
- When opening a file, the initial view is closed in case it
has not been modified. (November 4, 2010)
- Added possibility to open images, making use of GFL from XnView.
- Added a simple script language for manipulating images.
Script language
The grammar for the build-in script (in the notation
used by IParse) language is:
primary_expr
: ident
| int
| double
| char
| string
| "(" expr ")"
.
postfix_expr
: postfix_expr "[" expr LIST "]"
| postfix_expr "(" assignment_expr LIST OPT ")"
| postfix_expr "." ident "(" assignment_expr LIST OPT ")"
| postfix_expr "." ident
| postfix_expr "++"
| postfix_expr "--"
| primary_expr
.
unary_expr
: "++" unary_expr
| "--" unary_expr
| "+" unary_expr
| "-" unary_expr
| "!" unary_expr
| postfix_expr
.
l_expr1
: l_expr1 "*" unary_expr
| l_expr1 "/" unary_expr
| l_expr1 "%" unary_expr
| unary_expr
.
l_expr2
: l_expr2 "+" l_expr1
| l_expr2 "-" l_expr1
| l_expr1
.
l_expr3
: l_expr3 "<<" l_expr2
| l_expr3 ">>" l_expr2
| l_expr2
.
l_expr4
: l_expr4 "<=" l_expr3
| l_expr4 ">=" l_expr3
| l_expr4 "<" l_expr3
| l_expr4 ">" l_expr3
| l_expr4 "==" l_expr3
| l_expr4 "!=" l_expr3
| l_expr3
.
l_expr5 : l_expr5 "&&" l_expr4 | l_expr4 .
l_expr6 : l_expr6 "||" l_expr5 | l_expr5 .
expr
: l_expr6 "?" l_expr6 ":" expr
| l_expr6
.
assignment_expr
: unary_expr assignment_operator assignment_expr
| expr
.
assignment_operator
: "="
| "*="
| "/="
| "%="
| "+="
| "-="
| "<<="
| ">>="
.
declaration
: type_specifier ident "[" expr LIST "]" ";"
| type_specifier ident ("=" expr) OPT ";"
.
type_specifier
: "bool"
| "int"
| "double"
| "string"
| "textbuffer"
| "image"
| "color"
| "point"
.
statement
: declaration
| "{" statement SEQ OPT "}"
| assignment_expr OPT ";"
| "if" "(" expr ")" statement ("else" statement) OPT
| "while" "(" expr ")" statement
| "for" ident "from" expr "to" expr statement
.
root : statement SEQ OPT .
Sources
The following ZIP files contains all the sources sorted by
release date. I am not making any promisses with respect to
program crashes.
- July 21, 2004: Sources
- November 28, 2010: Sources
- December 3, 2010: Sources
- December 4, 2010: Sources
- December 19, 2010: Sources
- December 27, 2010: Lens correction
- July 26, 2011: Using it for correcting raw OCR output
- December 26, 2012: Sources
- April 20, 2013: Sources
- May 24, 2015: Sources
- June 21, 2015: Sources
- November 24, 2015: Sources
Known bugs
- XML colour coding does not deal with <? ?> tags
properly.
- Refresh in combination with a split window does not
work correctly. The other window only is being updated
(partial) when you move the curser there.
- If a different syntax colourer was selected, this
setting is lost when the file is saved.
My life as a hacker |
Software Engineering |
home