-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlstsmalltalk.sty
79 lines (75 loc) · 2.08 KB
/
lstsmalltalk.sty
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
\ProvidesFile{lstsmalltalk.sty}
[2009/07/03 0.2 listings Smalltalk definitions file]
%
\RequirePackage{listings}%
\RequirePackage{ifthen}
% \RequirePackage{graphicx}%
% \RequirePackage{stmaryrd}%
%
\newboolean{quickdefs}\setboolean{quickdefs}{true}
\DeclareOption{nodefs}{\setboolean{quickdefs}{false}}
\ProcessOptions\relax
\ifthenelse{\boolean{quickdefs}}
{\lstset{
basicstyle=\ttfamily,
stringstyle=\itshape,
escapeinside={_}{_},
columns=fullflexible,
% frame=tb,
floatplacement=htb}}
{}
\lstnewenvironment{smalltalk}[1][]
{\lstset{language=Smalltalk,#1}}
{}
\newcommand{\st}[1]{{\lstset{language=Smalltalk}\lstinline{#1}}}
\lstdefinelanguage{Smalltalk}{
morekeywords={self,super,true,false,nil,thisContext},
morestring=[d]',
morecomment=[s]{"}{"},
alsoletter={\#:},
upquote=true,
showstringspaces=false,
literate=
% {.}{{\bfseries .}}1
% {;}{{\bfseries ;}}1
% {[}{{\bfseries [}}1
% {]}{{\bfseries ]}}1
% {:}{{\bfseries :}}1
% % {|}{{\ttfamily\textbar{}}}1
% {\#}{{\ttfamily \#}}1
% {\$}{{\ttfamily \$}}1
% {:=}{{$\mathrel{\mathop:}=$\ }}2%$\shortleftarrow$\ }}2
% {^}{{\raisebox{0.5ex}{$\wedge$}}}1%\raisebox{1.5ex}{\scalebox{1}[-1]{$\lightning$}}\,}}2%\textuparrow\ }}2
{>>}{{\,}>>{\,}}3
{>>>}{>>>}3,
tabsize=4
}[keywords,comments,strings]%
\endinput
%%%
%%% And now for something completely different... Some stupid example,
%%% to put in a file to test this language definition...
%%%
% \lstset{
% inputencoding=utf8,
% columns=fullflexible,
% basicstyle=\Large
% }
%
% \begin{lstlisting}[language=Smalltalk]
% SomeClass >> testNumberOfRelationships
% "this is a test"
% | bazEntity |
% self assert: fooEntity numberOfOutgoingRelationships = 1.
% bazEntity := MyEntity named: #baz.
% MyRelationship from: fooEntity to: bazEntity.
% self assert: fooEntity numberOfOutgoingRelationships = 2.
% string := 'Hello, world!'
% aCollection do: [ each |
% | local |
% each someMessage ].
% ^ string
% \end{lstlisting}
%%%%%%%%
% Local Variables:
% coding: utf-8
% End: