Skip to content

Commit

Permalink
add extra:syntax.terse, for bitwise ops. Addresses #2641.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Maestas authored and erg committed Nov 8, 2022
1 parent 44855a8 commit 8c9bb02
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions extra/syntax/terse/authors.txt
@@ -0,0 +1 @@
Alex Maestas
10 changes: 10 additions & 0 deletions extra/syntax/terse/terse.factor
@@ -0,0 +1,10 @@
USING: math words ;
IN: syntax.terse

! shorthand/C-like bitwise ops
ALIAS: `& bitand
ALIAS: `| bitor
ALIAS: `^ bitxor
ALIAS: `~ bitnot
ALIAS: `<< shift
: `>> ( x n -- x/2^n ) neg shift ; inline
2 changes: 1 addition & 1 deletion misc/fuel/factor-mode.el
Expand Up @@ -178,7 +178,7 @@ these lines in your .emacs:
;;; Regexps galore:

;; Utility regexp used by other regexps to match a Factor symbol name
(setq-local symbol-nc "\\(?:\\sw\\|\\s_\\|\"\\|\\s(\\|\\s)\\|\\s\\\\)+")
(setq-local symbol-nc "\\(?:\\sw\\|\\s_\\|`\\|\"\\|\\s(\\|\\s)\\|\\s\\\\)+")
(setq-local symbol (format "\\(%s\\)" symbol-nc))
(setq-local c-symbol-nc "\\(?:\\sw\\|\\s_\\|\\[\\|\\]\\)+")
(setq-local c-symbol (format "\\(%s\\)" c-symbol-nc))
Expand Down
3 changes: 3 additions & 0 deletions misc/fuel/strange-syntax.factor
Expand Up @@ -101,3 +101,6 @@ COLOR: #ffffff COLOR: green NAN: 1234 CHAR: m ALIEN: 93

PRIMITIVE: one ( a -- b )
PRIMITIVE: two ( c -- d )

: `word ( -- ) ;
: word ( -- ) ; ! this isn't strange, just for contrast with the above

0 comments on commit 8c9bb02

Please sign in to comment.