]> gitweb.factorcode.org Git - factor.git/commitdiff
add extra:syntax.terse, for bitwise ops. Addresses #2641.
authorAlex Maestas <git@se30.xyz>
Tue, 8 Nov 2022 04:19:57 +0000 (04:19 +0000)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 8 Nov 2022 17:57:52 +0000 (11:57 -0600)
extra/syntax/terse/authors.txt [new file with mode: 0644]
extra/syntax/terse/terse.factor [new file with mode: 0644]
misc/fuel/factor-mode.el
misc/fuel/strange-syntax.factor

diff --git a/extra/syntax/terse/authors.txt b/extra/syntax/terse/authors.txt
new file mode 100644 (file)
index 0000000..d514ff4
--- /dev/null
@@ -0,0 +1 @@
+Alex Maestas
diff --git a/extra/syntax/terse/terse.factor b/extra/syntax/terse/terse.factor
new file mode 100644 (file)
index 0000000..66ac59f
--- /dev/null
@@ -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
index c2d64ff2f50d50581fe1ae717ae60b6b175dec63..a1533a378f0872d582b5d3ccd1da1d6c2e807ce2 100644 (file)
@@ -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))
index 538265bbef2c921aba196c2bfca1aef6f39845c3..ee05308e74350298beee33aed9248b4e80945561 100644 (file)
@@ -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