Skip to content

Commit

Permalink
Call the '#' sign hash rather than sharp.
Browse files Browse the repository at this point in the history
  • Loading branch information
shindere committed May 9, 2016
1 parent 2d33e16 commit 5014791
Show file tree
Hide file tree
Showing 31 changed files with 119 additions and 118 deletions.
6 changes: 3 additions & 3 deletions config/Makefile-templ
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ MANEXT=1
### Do #! scripts work on your system?
### Beware: on some systems (e.g. SunOS 4), this will work only if
### the string "#!$(BINDIR)/ocamlrun" is less than 32 characters long.
### In doubt, set SHARPBANGSCRIPTS to false.
SHARPBANGSCRIPTS=true
#SHARPBANGSCRIPTS=false
### In doubt, set HASHBANGSCRIPTS to false.
HASHBANGSCRIPTS=true
#HASHBANGSCRIPTS=false

########## Configuration for the bytecode compiler

Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
HASHBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.mingw64
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
HASHBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
HASHBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.msvc64
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
MANEXT=1
SHARPBANGSCRIPTS=false
HASHBANGSCRIPTS=false
PTHREAD_LINK=
X11_INCLUDES=
X11_LINK=
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -985,27 +985,27 @@ echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h

# Do #! scripts work?

if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
if (SHELL=/bin/sh; export SHELL; (./hashbang || ./hashbang2) >/dev/null); then
inf "#! appears to work in shell scripts."
case "$target" in
*-*-sunos*|*-*-unicos*)
wrn "We won't use it, though, because under SunOS and Unicos it breaks " \
"on pathnames longer than 30 characters"
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
echo "HASHBANGSCRIPTS=false" >> Makefile;;
*-*-cygwin*)
wrn "We won't use it, though, because of conflicts with .exe extension " \
"under Cygwin"
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
echo "HASHBANGSCRIPTS=false" >> Makefile;;
*-*-mingw*)
inf "We won't use it, though, because it's on the target platform " \
"it would be used and windows doesn't support it."
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
echo "HASHBANGSCRIPTS=false" >> Makefile;;
*)
echo "SHARPBANGSCRIPTS=true" >> Makefile;;
echo "HASHBANGSCRIPTS=true" >> Makefile;;
esac
else
inf "No support for #! in shell scripts"
echo "SHARPBANGSCRIPTS=false" >> Makefile
echo "HASHBANGSCRIPTS=false" >> Makefile
fi

# Use 64-bit file offset if possible
Expand Down
2 changes: 1 addition & 1 deletion debugger/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ and lexeme = (* Read a lexeme *)
| "."
{ DOT }
| "#"
{ SHARP }
{ HASH }
| "@"
{ AT }
| "$"
Expand Down
4 changes: 2 additions & 2 deletions debugger/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open Parser_aux
%token STAR /* * */
%token MINUS /* - */
%token DOT /* . */
%token SHARP /* # */
%token HASH /* # */
%token AT /* @ */
%token DOLLAR /* $ */
%token BANG /* ! */
Expand Down Expand Up @@ -238,7 +238,7 @@ break_argument_eol :
| integer_eol { BA_pc $1 }
| expression end_of_line { BA_function $1 }
| AT opt_longident INTEGER opt_integer_eol { BA_pos1 ($2, (to_int $3), $4)}
| AT opt_longident SHARP integer_eol { BA_pos2 ($2, $4) }
| AT opt_longident HASH integer_eol { BA_pos2 ($2, $4) }
;

/* Arguments for list */
Expand Down
26 changes: 13 additions & 13 deletions experimental/garrigue/show_types.diff
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ Index: parsing/parser.mly
/* Toplevel directives */

toplevel_directive:
- SHARP ident { Ptop_dir($2, Pdir_none) }
- | SHARP ident STRING { Ptop_dir($2, Pdir_string $3) }
- | SHARP ident INT { Ptop_dir($2, Pdir_int $3) }
- | SHARP ident val_longident { Ptop_dir($2, Pdir_ident $3) }
- | SHARP ident FALSE { Ptop_dir($2, Pdir_bool false) }
- | SHARP ident TRUE { Ptop_dir($2, Pdir_bool true) }
+ SHARP ident { Ptop_dir($2, Pdir_none) }
+ | SHARP ident STRING { Ptop_dir($2, Pdir_string $3) }
+ | SHARP ident INT { Ptop_dir($2, Pdir_int $3) }
+ | SHARP ident val_longident { Ptop_dir($2, Pdir_ident (mkrhs $3 3)) }
+ | SHARP ident ident_kind any_longident { Ptop_dir($2, Pdir_show ($3, mkrhs $4 4)) }
+ | SHARP ident FALSE { Ptop_dir($2, Pdir_bool false) }
+ | SHARP ident TRUE { Ptop_dir($2, Pdir_bool true) }
- HASH ident { Ptop_dir($2, Pdir_none) }
- | HASH ident STRING { Ptop_dir($2, Pdir_string $3) }
- | HASH ident INT { Ptop_dir($2, Pdir_int $3) }
- | HASH ident val_longident { Ptop_dir($2, Pdir_ident $3) }
- | HASH ident FALSE { Ptop_dir($2, Pdir_bool false) }
- | HASH ident TRUE { Ptop_dir($2, Pdir_bool true) }
+ HASH ident { Ptop_dir($2, Pdir_none) }
+ | HASH ident STRING { Ptop_dir($2, Pdir_string $3) }
+ | HASH ident INT { Ptop_dir($2, Pdir_int $3) }
+ | HASH ident val_longident { Ptop_dir($2, Pdir_ident (mkrhs $3 3)) }
+ | HASH ident ident_kind any_longident { Ptop_dir($2, Pdir_show ($3, mkrhs $4 4)) }
+ | HASH ident FALSE { Ptop_dir($2, Pdir_bool false) }
+ | HASH ident TRUE { Ptop_dir($2, Pdir_bool true) }
;

/* Miscellaneous */
Expand Down
2 changes: 1 addition & 1 deletion lex/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ rule main = parse
| ')' { Trparen }
| '^' { Tcaret }
| '-' { Tdash }
| '#' { Tsharp }
| '#' { Thash }
| eof { Tend }
| _
{ raise_lexical_error lexbuf
Expand Down
6 changes: 3 additions & 3 deletions lex/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ let as_cset = function
%token <Syntax.location> Taction
%token Trule Tparse Tparse_shortest Tand Tequal Tend Tor Tunderscore Teof
Tlbracket Trbracket Trefill
%token Tstar Tmaybe Tplus Tlparen Trparen Tcaret Tdash Tlet Tas Tsharp
%token Tstar Tmaybe Tplus Tlparen Trparen Tcaret Tdash Tlet Tas Thash

%right Tas
%left Tor
%nonassoc CONCAT
%nonassoc Tmaybe Tstar Tplus
%left Tsharp
%left Thash
%nonassoc Tident Tchar Tstring Tunderscore Teof Tlbracket Tlparen

%start lexer_definition
Expand Down Expand Up @@ -145,7 +145,7 @@ regexp:
{ Alternative(Epsilon, $1) }
| regexp Tplus
{ Sequence(Repetition (remove_as $1), $1) }
| regexp Tsharp regexp
| regexp Thash regexp
{
let s1 = as_cset $1
and s2 = as_cset $3 in
Expand Down
2 changes: 1 addition & 1 deletion man/ocaml.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
read-eval-print loop. In this mode, the system repeatedly reads OCaml
phrases from the input, then typechecks, compiles and evaluates
them, then prints the inferred type and result value, if any. The
system prints a # (sharp) prompt before reading each phrase.
system prints a # (hash) prompt before reading each phrase.

A toplevel phrase can span several lines. It is terminated by ;; (a
double-semicolon). The syntax of toplevel phrases is as follows.
Expand Down
2 changes: 1 addition & 1 deletion ocamldoc/ocamldoc.hva
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
\newcommand\textbar{|}
\newcommand\textbackslash{\begin{rawhtml}\\end{rawhtml}}
\newcommand\textasciicircum{\^{}}
\newcommand\sharp{#}
\newcommand\hash{#}

\let\ocamldocvspace\vspace
\newenvironment{ocamldocindent}{\list{}{}\item\relax}{\endlist}
Expand Down
2 changes: 1 addition & 1 deletion parsing/lexer.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

val init : unit -> unit
val token: Lexing.lexbuf -> Parser.token
val skip_sharp_bang: Lexing.lexbuf -> unit
val skip_hash_bang: Lexing.lexbuf -> unit

type error =
| Illegal_character of char
Expand Down
6 changes: 3 additions & 3 deletions parsing/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ rule token = parse
{ update_loc lexbuf name (int_of_string num) true 0;
token lexbuf
}
| "#" { SHARP }
| "#" { HASH }
| "&" { AMPERSAND }
| "&&" { AMPERAMPER }
| "`" { BACKQUOTE }
Expand Down Expand Up @@ -492,7 +492,7 @@ rule token = parse
| ['*' '/' '%'] symbolchar *
{ INFIXOP3(Lexing.lexeme lexbuf) }
| '#' (symbolchar | '#') +
{ SHARPOP(Lexing.lexeme lexbuf) }
{ HASHOP(Lexing.lexeme lexbuf) }
| eof { EOF }
| _
{ raise (Error(Illegal_character (Lexing.lexeme_char lexbuf 0),
Expand Down Expand Up @@ -652,7 +652,7 @@ and quoted_string delim = parse
{ store_string_char(Lexing.lexeme_char lexbuf 0);
quoted_string delim lexbuf }
and skip_sharp_bang = parse
and skip_hash_bang = parse
| "#!" [^ '\n']* '\n' [^ '\n']* "\n!#\n"
{ update_loc lexbuf None 3 false 0 }
| "#!" [^ '\n']* '\n'
Expand Down
58 changes: 29 additions & 29 deletions parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ let package_type_of_module_type pmty =
%token RPAREN
%token SEMI
%token SEMISEMI
%token SHARP
%token <string> SHARPOP
%token HASH
%token <string> HASHOP
%token SIG
%token STAR
%token <string * string option> STRING
Expand Down Expand Up @@ -639,9 +639,9 @@ The precedences must be listed from low to high.
%nonassoc prec_unary_minus prec_unary_plus /* unary - */
%nonassoc prec_constant_constructor /* cf. simple_expr (C versus C x) */
%nonassoc prec_constr_appl /* above AS BAR COLONCOLON COMMA */
%nonassoc below_SHARP
%nonassoc SHARP /* simple_expr/toplevel_directive */
%left SHARPOP
%nonassoc below_HASH
%nonassoc HASH /* simple_expr/toplevel_directive */
%left HASHOP
%nonassoc below_DOT
%nonassoc DOT
/* Finally, the first tokens of simple_expr are above everything else. */
Expand Down Expand Up @@ -1350,7 +1350,7 @@ let_pattern:
{ mkpat(Ppat_constraint($1, $3)) }
;
expr:
simple_expr %prec below_SHARP
simple_expr %prec below_HASH
{ $1 }
| simple_expr simple_labeled_expr_list
{ mkexp(Pexp_apply($1, List.rev $2)) }
Expand Down Expand Up @@ -1384,9 +1384,9 @@ expr:
{ syntax_error() }
| expr_comma_list %prec below_COMMA
{ mkexp(Pexp_tuple(List.rev $1)) }
| constr_longident simple_expr %prec below_SHARP
| constr_longident simple_expr %prec below_HASH
{ mkexp(Pexp_construct(mkrhs $1 1, Some $2)) }
| name_tag simple_expr %prec below_SHARP
| name_tag simple_expr %prec below_HASH
{ mkexp(Pexp_variant($1, Some $2)) }
| IF ext_attributes seq_expr THEN expr ELSE expr
{ mkexp_attrs(Pexp_ifthenelse($3, $5, Some $7)) $2 }
Expand Down Expand Up @@ -1457,9 +1457,9 @@ expr:
{ bigarray_set $1 $4 $7 }
| label LESSMINUS expr
{ mkexp(Pexp_setinstvar(mkrhs $1 1, $3)) }
| ASSERT ext_attributes simple_expr %prec below_SHARP
| ASSERT ext_attributes simple_expr %prec below_HASH
{ mkexp_attrs (Pexp_assert $3) $2 }
| LAZY ext_attributes simple_expr %prec below_SHARP
| LAZY ext_attributes simple_expr %prec below_HASH
{ mkexp_attrs (Pexp_lazy $3) $2 }
| OBJECT ext_attributes class_structure END
{ mkexp_attrs (Pexp_object $3) $2 }
Expand Down Expand Up @@ -1567,9 +1567,9 @@ simple_expr:
{ mkexp(Pexp_open(Fresh, mkrhs $1 1, mkexp (Pexp_override [])))}
| mod_longident DOT LBRACELESS field_expr_list error
{ unclosed "{<" 3 ">}" 5 }
| simple_expr SHARP label
| simple_expr HASH label
{ mkexp(Pexp_send($1, $3)) }
| simple_expr SHARPOP simple_expr
| simple_expr HASHOP simple_expr
{ mkinfix $1 $2 $3 }
| LPAREN MODULE ext_attributes module_expr RPAREN
{ mkexp_attrs (Pexp_pack $4) $3 }
Expand Down Expand Up @@ -1597,19 +1597,19 @@ simple_labeled_expr_list:
{ $2 :: $1 }
;
labeled_simple_expr:
simple_expr %prec below_SHARP
simple_expr %prec below_HASH
{ (Nolabel, $1) }
| label_expr
{ $1 }
;
label_expr:
LABEL simple_expr %prec below_SHARP
LABEL simple_expr %prec below_HASH
{ (Labelled $1, $2) }
| TILDE label_ident
{ (Labelled (fst $2), snd $2) }
| QUESTION label_ident
{ (Optional (fst $2), snd $2) }
| OPTLABEL simple_expr %prec below_SHARP
| OPTLABEL simple_expr %prec below_HASH
{ (Optional $1, $2) }
;
label_ident:
Expand Down Expand Up @@ -1810,7 +1810,7 @@ simple_pattern_not_ident:
{ mkpat(Ppat_construct(mkrhs $1 1, None)) }
| name_tag
{ mkpat(Ppat_variant($1, None)) }
| SHARP type_longident
| HASH type_longident
{ mkpat(Ppat_type (mkrhs $2 2)) }
| simple_delimited_pattern
{ $1 }
Expand Down Expand Up @@ -2240,9 +2240,9 @@ core_type2:
;
simple_core_type:
simple_core_type2 %prec below_SHARP
simple_core_type2 %prec below_HASH
{ $1 }
| LPAREN core_type_comma_list RPAREN %prec below_SHARP
| LPAREN core_type_comma_list RPAREN %prec below_HASH
{ match $2 with [sty] -> sty | _ -> raise Parse_error }
;
Expand All @@ -2261,11 +2261,11 @@ simple_core_type2:
{ let (f, c) = $2 in mktyp(Ptyp_object (f, c)) }
| LESS GREATER
{ mktyp(Ptyp_object ([], Closed)) }
| SHARP class_longident
| HASH class_longident
{ mktyp(Ptyp_class(mkrhs $2 2, [])) }
| simple_core_type2 SHARP class_longident
| simple_core_type2 HASH class_longident
{ mktyp(Ptyp_class(mkrhs $3 3, [$1])) }
| LPAREN core_type_comma_list RPAREN SHARP class_longident
| LPAREN core_type_comma_list RPAREN HASH class_longident
{ mktyp(Ptyp_class(mkrhs $5 5, List.rev $2)) }
| LBRACKET tag_field RBRACKET
{ mktyp(Ptyp_variant([$2], Closed, None)) }
Expand Down Expand Up @@ -2393,7 +2393,7 @@ operator:
| INFIXOP2 { $1 }
| INFIXOP3 { $1 }
| INFIXOP4 { $1 }
| SHARPOP { $1 }
| HASHOP { $1 }
| BANG { "!" }
| PLUS { "+" }
| PLUSDOT { "+." }
Expand Down Expand Up @@ -2465,14 +2465,14 @@ class_longident:
/* Toplevel directives */
toplevel_directive:
SHARP ident { Ptop_dir($2, Pdir_none) }
| SHARP ident STRING { Ptop_dir($2, Pdir_string (fst $3)) }
| SHARP ident INT { let (n, m) = $3 in
HASH ident { Ptop_dir($2, Pdir_none) }
| HASH ident STRING { Ptop_dir($2, Pdir_string (fst $3)) }
| HASH ident INT { let (n, m) = $3 in
Ptop_dir($2, Pdir_int (n ,m)) }
| SHARP ident val_longident { Ptop_dir($2, Pdir_ident $3) }
| SHARP ident mod_longident { Ptop_dir($2, Pdir_ident $3) }
| SHARP ident FALSE { Ptop_dir($2, Pdir_bool false) }
| SHARP ident TRUE { Ptop_dir($2, Pdir_bool true) }
| HASH ident val_longident { Ptop_dir($2, Pdir_ident $3) }
| HASH ident mod_longident { Ptop_dir($2, Pdir_ident $3) }
| HASH ident FALSE { Ptop_dir($2, Pdir_bool false) }
| HASH ident TRUE { Ptop_dir($2, Pdir_bool true) }
;
/* Miscellaneous */
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ camlheader target_camlheader camlheader_ur \
camlheaderd target_camlheaderd \
camlheaderi target_camlheaderi: \
header.c ../config/Makefile
if $(SHARPBANGSCRIPTS); then \
if $(HASHBANGSCRIPTS); then \
for suff in '' d i; do \
echo '#!$(BINDIR)/ocamlrun'$$suff > camlheader$$suff && \
echo '#!$(TARGET_BINDIR)/ocamlrun'$$suff >target_camlheader$$suff; \
Expand Down
Loading

0 comments on commit 5014791

Please sign in to comment.