Skip to content

Commit c6c98d6

Browse files
committed
Renamed 'ansi_c', 'dmd', and 'rstats' lexers to 'c', 'd', and 'r', respectively.
Originally this was to prevent clashes with Textadept's language-specific key handling, but this is no longer applicable.
1 parent 6636aa8 commit c6c98d6

File tree

12 files changed

+21
-31
lines changed

12 files changed

+21
-31
lines changed

docs/api.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ and modify, or inherit from that lexer, saving some time and effort. The filenam
5454
lexer should be the name of your programming language in lower case followed by a *.lua*
5555
extension. For example, a new Lua lexer has the name *lua.lua*.
5656

57-
Note: Try to refrain from using one-character language names like "c", "d", or "r". For
58-
example, Scintillua uses "ansi_c", "dmd", and "rstats", respectively.
59-
6057
#### New Lexer Template
6158

6259
There is a *lexers/template.txt* file that contains a simple template for a new lexer. Feel

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ Bugfixes:
424424
Changes:
425425

426426
* Do not match '..' on the trailing end of `lexer.float`.
427-
* Updated dmd lexer.
427+
* Updated D lexer.
428428

429429
[Scintilla 3.10.3]: https://sourceforge.net/projects/scintilla/files/scintilla/3.10.3/scintilla3103.zip/download
430430

docs/manual.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,22 +327,22 @@ doing this:
327327
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
328328
> lexer_path = '/home/mitchell/code/scintillua/lexers/?.lua'
329329
> package.path = package.path .. ';' .. lexer_path
330-
> c = require('lexer').load('ansi_c')
330+
> c = require('lexer').load('c')
331331
> tokens = c:lex('int main() { return 0; }')
332332
> for i = 1, #tokens, 2 do print(tokens[i], tokens[i+1]) end
333333
type 4
334-
whitespace.ansi_c 5
334+
whitespace.c 5
335335
function 9
336336
operator 10
337337
operator 11
338-
whitespace.ansi_c 12
338+
whitespace.c 12
339339
operator 13
340-
whitespace.ansi_c 14
340+
whitespace.c 14
341341
keyword 20
342-
whitespace.ansi_c 21
342+
whitespace.c 21
343343
number 22
344344
operator 23
345-
whitespace.ansi_c 24
345+
whitespace.c 24
346346
operator 25
347347

348348
If you are unsure of which lexer to use for a given filename and/or content line (e.g. shebang line), you can

gen_lexer_props.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ local noglobs = {
88
['Rout.save'] = true, ['Rout.fail'] = true, fstab = true, ['meson.build'] = true
99
}
1010

11-
local alt_name = {
12-
actionscript = 'flash', ansi_c = 'c', dmd = 'd', javascript = 'js', python = 'py', rstats = 'r',
13-
ruby = 'rb'
14-
}
11+
local alt_name = {actionscript = 'flash', javascript = 'js', python = 'py', ruby = 'rb'}
1512

1613
-- Process file patterns and lexer definitions.
1714
local f = io.open('lexers/lexer.lua')
File renamed without changes.
File renamed without changes.

lexers/glsl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
local lexer = lexer
55
local P, S = lpeg.P, lpeg.S
66

7-
local lex = lexer.new(..., {inherit = lexer.load('ansi_c')})
7+
local lex = lexer.new(..., {inherit = lexer.load('c')})
88

99
-- Word lists.
1010
lex:set_word_list(lexer.KEYWORD, {

lexers/lexer.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
-- lexer should be the name of your programming language in lower case followed by a *.lua*
5151
-- extension. For example, a new Lua lexer has the name *lua.lua*.
5252
--
53-
-- Note: Try to refrain from using one-character language names like "c", "d", or "r". For
54-
-- example, Scintillua uses "ansi_c", "dmd", and "rstats", respectively.
55-
--
5653
-- #### New Lexer Template
5754
--
5855
-- There is a *lexers/template.txt* file that contains a simple template for a new lexer. Feel
@@ -1612,8 +1609,8 @@ function M.detect(filename, line)
16121609
bib = 'bibtex', --
16131610
boo = 'boo', --
16141611
cs = 'csharp', --
1615-
c = 'ansi_c', C = 'ansi_c', cc = 'cpp', cpp = 'cpp', cxx = 'cpp', ['c++'] = 'cpp', h = 'cpp',
1616-
hh = 'cpp', hpp = 'cpp', hxx = 'cpp', ['h++'] = 'cpp', --
1612+
c = 'c', C = 'c', cc = 'cpp', cpp = 'cpp', cxx = 'cpp', ['c++'] = 'cpp', h = 'cpp', hh = 'cpp',
1613+
hpp = 'cpp', hxx = 'cpp', ['h++'] = 'cpp', --
16171614
ck = 'chuck', --
16181615
clj = 'clojure', cljs = 'clojure', cljc = 'clojure', edn = 'clojure', --
16191616
['CMakeLists.txt'] = 'cmake', cmake = 'cmake', ['cmake.in'] = 'cmake', ctest = 'cmake',
@@ -1622,7 +1619,7 @@ function M.detect(filename, line)
16221619
cr = 'crystal', --
16231620
css = 'css', --
16241621
cu = 'cuda', cuh = 'cuda', --
1625-
d = 'dmd', di = 'dmd', --
1622+
d = 'd', di = 'd', --
16261623
dart = 'dart', --
16271624
desktop = 'desktop', --
16281625
diff = 'diff', patch = 'diff', --
@@ -1700,8 +1697,7 @@ function M.detect(filename, line)
17001697
proto = 'protobuf', --
17011698
pure = 'pure', --
17021699
sc = 'python', py = 'python', pyw = 'python', --
1703-
R = 'rstats', Rout = 'rstats', Rhistory = 'rstats', Rt = 'rstats', ['Rout.save'] = 'rstats',
1704-
['Rout.fail'] = 'rstats', --
1700+
R = 'r', Rout = 'r', Rhistory = 'r', Rt = 'r', ['Rout.save'] = 'r', ['Rout.fail'] = 'r', --
17051701
re = 'reason', --
17061702
r = 'rebol', reb = 'rebol', --
17071703
rst = 'rest', --

lexers/output.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ lex:add_rule('python',
6666
local lparen, rparen = text('('), text(')')
6767
local d_filename = filename((lexer.nonnewline - '(')^1)
6868
local d_error = message(lexer.to_eol(S('Ee') * 'rror')) * mark_error
69-
lex:add_rule('dmd', starts_line(d_filename) * lparen * line * rparen * colon * d_error)
69+
lex:add_rule('d', starts_line(d_filename) * lparen * line * rparen * colon * d_error)
7070

7171
-- "filename" line X: message (gnuplot)
7272
local gp_filename = filename((lexer.nonnewline - '"')^1)

lexers/rstats.lua renamed to lexers/r.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local lexer = require('lexer')
55
local token, word_match = lexer.token, lexer.word_match
66
local P, S = lpeg.P, lpeg.S
77

8-
local lex = lexer.new('rstats')
8+
local lex = lexer.new('r')
99

1010
-- Whitespace.
1111
lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1))

scintillua.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ keywords7.$(file.patterns.csharp)=scintillua
188188
keywords8.$(file.patterns.csharp)=scintillua
189189
keywords9.$(file.patterns.csharp)=scintillua
190190
file.patterns.c=*.c;*.C
191-
lexer.$(file.patterns.c)=scintillua.ansi_c
191+
lexer.$(file.patterns.c)=scintillua.c
192192
keywords.$(file.patterns.c)=scintillua
193193
keywords2.$(file.patterns.c)=scintillua
194194
keywords3.$(file.patterns.c)=scintillua
@@ -287,7 +287,7 @@ keywords7.$(file.patterns.cuda)=scintillua
287287
keywords8.$(file.patterns.cuda)=scintillua
288288
keywords9.$(file.patterns.cuda)=scintillua
289289
file.patterns.d=*.d;*.di
290-
lexer.$(file.patterns.d)=scintillua.dmd
290+
lexer.$(file.patterns.d)=scintillua.d
291291
keywords.$(file.patterns.d)=scintillua
292292
keywords2.$(file.patterns.d)=scintillua
293293
keywords3.$(file.patterns.d)=scintillua
@@ -1123,7 +1123,7 @@ keywords7.$(file.patterns.py)=scintillua
11231123
keywords8.$(file.patterns.py)=scintillua
11241124
keywords9.$(file.patterns.py)=scintillua
11251125
file.patterns.r=*.R;*.Rout;*.Rhistory;*.Rt;Rout.save;Rout.fail
1126-
lexer.$(file.patterns.r)=scintillua.rstats
1126+
lexer.$(file.patterns.r)=scintillua.r
11271127
keywords.$(file.patterns.r)=scintillua
11281128
keywords2.$(file.patterns.r)=scintillua
11291129
keywords3.$(file.patterns.r)=scintillua

tests.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,8 @@ end
645645

646646
-- Tests the C lexer.
647647
function test_c()
648-
local c = lexer.load('ansi_c')
649-
assert(c._name == 'ansi_c')
648+
local c = lexer.load('c')
649+
assert(c._name == 'c')
650650
assert_default_tags(c)
651651

652652
-- Lexing tests.
@@ -1686,7 +1686,7 @@ end
16861686

16871687
function test_detect()
16881688
assert(lexer.detect('foo.lua') == 'lua')
1689-
assert(lexer.detect('foo.c') == 'ansi_c')
1689+
assert(lexer.detect('foo.c') == 'c')
16901690
assert(not lexer.detect('foo.txt'))
16911691
assert(lexer.detect('foo', '#!/bin/sh') == 'bash')
16921692
assert(not lexer.detect('foo', '/bin/sh'))

0 commit comments

Comments
 (0)