Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
f9fbecea
Commit
f9fbecea
authored
25 years ago
by
Martin Stjernholm
Browse files
Options
Downloads
Patches
Plain Diff
Better handling of many cases, e.g. arbitrarily complex types.
Rev: lib/tools/pike.el:1.7
parent
c2769bd3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/tools/pike.el
+49
-41
49 additions, 41 deletions
lib/tools/pike.el
with
49 additions
and
41 deletions
lib/tools/pike.el
+
49
−
41
View file @
f9fbecea
;;; pike.el -- Major mode for editing Pike and other LPC files.
;;; $Id: pike.el,v 1.
6
1999/
08/15 13:32
:5
2
mast Exp $
;;; $Id: pike.el,v 1.
7
1999/
10/02 05:49
:5
4
mast Exp $
;;; Copyright (C) 1995, 1996, 1997, 1998, 1999 Per Hedbor.
;;; This file is distributed as GPL
...
...
@@ -52,8 +52,6 @@ This adds highlighting of Java documentation tags, such as @see.")
"function(.*)\\|"
"array\\|"
"array(.*)\\|"
"function\\|"
"function(.*)\\|"
"mapping\\|"
"mapping(.*)\\|"
"multiset\\|"
...
...
@@ -101,6 +99,7 @@ The name is assumed to begin with a capital letter.")
(
defconst
pike-operator-identifiers
(
concat
"``?\\(!=\\|->=?\\|<[<=]\\|==\\|>[=>]\\|\\[\\]=?\\|\(\)"
"\\|[!%&+*/<>^|~-]\\)"
))
;; Basic font-lock support:
(
setq
pike-font-lock-keywords-1
(
list
...
...
@@ -139,9 +138,8 @@ The name is assumed to begin with a capital letter.")
(
list
1
'font-lock-keyword-face
)
(
list
2
'font-lock-function-name-face
))
;; Methods:
(
list
(
concat
(
concat
"\\("
(
list
(
concat
(
concat
"
^\\s *
\\("
pike-font-lock-type-regexp
"\\|"
pike-font-lock-class-name-regexp
...
...
@@ -156,7 +154,6 @@ The name is assumed to begin with a capital letter.")
"\\s *("
)
4
'font-lock-function-name-face
)
;; Case statements:
;; Any constant expression is allowed.
'
(
"\\<case\\>\\s *\\(.*\\):"
1
font-lock-reference-face
)))
...
...
@@ -212,48 +209,30 @@ The name is assumed to begin with a capital letter.")
(
0
font-lock-variable-name-face
)))
;; Declarations, class types and capitalized variables:
;;
;; Declarations are easy to recognize. Capitalized words
;; followed by a closing parenthesis are treated as casts
;; if they also are followed by an expression.
;; Expressions beginning with a unary numerical operator,
;; e.g. +, can't be cast to an object type.
(
list
(
concat
(
concat
"\\("
pike-font-lock-class-name-regexp
(
concat
"\\("
; 1
pike-font-lock-class-name-regexp
; 2
"\\|"
(
concat
"object("
"\\(\\sw+\\.\\)*"
pike-font-lock-identifier-regexp
"\\(\\sw+\\.\\)*"
; 3
pike-font-lock-identifier-regexp
; 4
")"
)
"\\)"
)
;;"\\s *\\(\\[\\s *\\]\\s *\\)*"
(
concat
"\\("
(
concat
(
concat
"\\("
"\)*\\s *\\.\\.\\."
"[,:|\)]"
"\\|"
(
concat
"[,:|]"
(
concat
"\\("
"["
capital-letter
"]"
"\\|"
pike-font-lock-type-regexp
"\\)"
)
"\\([,:|\(]\\|\\sw\\)*\)"
)
"\\)?"
)
"\\s *"
"\\(`\\|\\<\\|$\\)"
)
"\\|"
(
concat
"\)\\s *"
"\\([\(\"]\\|\\<\\)"
)
"\\|"
"\\s *$"
"\\(\\s *\\.\\.\\.\\)?"
"\\(\\s \\|/\\*\\([^*]\\|\\*[^/]\\)*\\*/\\)*"
"\\(`\\|\\<\\)"
)
"\\)"
))
'
(
2
font-lock-type-face
nil
t
)
'
(
4
font-lock-type-face
nil
t
)
'
(
font-lock-match-pike-types
(
goto-char
(
or
(
match-beginning
2
)
(
match-beginning
4
)))
(
goto-char
(
match-end
1
))
(
1
font-lock-type-face
))
(
list
(
concat
"\\="
pike-font-lock-identifier-regexp
"\\."
)
'
(
progn
...
...
@@ -294,6 +273,35 @@ The name is assumed to begin with a capital letter.")
(
defvar
pike-font-lock-keywords
pike-font-lock-keywords-1
"Additional expressions to highlight in Pike mode."
)
(
defun
font-lock-match-pike-types
(
limit
)
"Match and skip over types."
(
prog1
(
and
(
looking-at
pike-font-lock-identifier-regexp
)
(
save-restriction
(
narrow-to-region
(
save-excursion
(
beginning-of-line
)
(
point
))
limit
)
(
save-match-data
(
let
((
pos
(
point
)))
(
while
(
and
(
condition-case
nil
(
progn
(
up-list
-1
)
t
)
(
error
nil
))
(
eq
(
following-char
)
?\(
)
(
save-excursion
(
skip-syntax-backward
" "
)
(
skip-syntax-backward
"w"
)
(
looking-at
pike-font-lock-type-regexp
)))
(
setq
pos
(
point
)))
(
goto-char
pos
)))
(
condition-case
nil
(
prog2
(
forward-sexp
)
(
save-match-data
(
looking-at
"\\s *\\(`\\|\\<\\|$\\)"
)))
(
error
nil
))))
(
goto-char
limit
)))
;; Match and move over any declaration/definition item after
;; point. Does not match items which look like a type declaration
;; (primitive types and class names, i.e. capitalized words.)
...
...
@@ -312,7 +320,7 @@ The name is assumed to begin with a capital letter.")
(
forward-char
1
))
; (if (looking-at "\\s *\\(\\[\\s *\\]\\s *\\)*")
; (goto-char (match-end 0)))
(
looking-at
"\\s *\\
(
\\.\\.\\
.\\s *\\)?
"
)
(
looking-at
"\\
(\\
s *\\
.
\\.\\.\\
)?\\(\\s \\|/\\*\\([^*]\\|\\*[^/]\\)*\\*/\\)*
"
)
(
goto-char
(
match-end
0
))
(
and
(
looking-at
pike-font-lock-identifier-regexp
)
...
...
@@ -326,7 +334,7 @@ The name is assumed to begin with a capital letter.")
(
not
(
looking-at
(
concat
pike-font-lock-class-name-regexp
;;"\\s *\\(\\[\\s *\\]\\s *\\)*\\<")))))
"\\s *\\
<
"
)))))
"\\s *\\
(\\<\\||\\)
"
)))))
(
save-match-data
(
let
((
start
(
match-end
0
)))
(
condition-case
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment