Parse - Bring in type and variable naming rules
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 26 Oct 2014 06:15:46 +0000 (23:15 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 26 Oct 2014 06:15:46 +0000 (23:15 -0700)
commit0b59c32e1850d05caa4e8212eb010f8642699772
tree97b42e723b5e8efe728231153bee2818990e2a99
parent5a69e90ed23c8f0a1f1cc1917bf193efcdfb1652
Parse - Bring in type and variable naming rules

* We distinguish between type/class names and non-type identifiers
  by the format of the symbol.  This is something I've always wanted to
  do to enforce a little better readability for the code, but it also
  is a huge aid to the front-end parser which has far less context available
  to it than other languages might.  We can differentiate between (type)
  and (subexpression), for example.

  - Any symbol terminating in _t _u _p or _m is considered a type/class id.

  - Otherwise if it starts with a capital letter and all the alpha characters
    are not capitalized, it is a type/class id.

  - If all alpha characters are capitalized it is a constant identifier
    (not currently enforced).

  - Otherwise it is a non-type identifier.

* Examples:

  FUBAR_t - type/class
  FUBAR - constant identifier
  Fubar - type/class
  fubar - normal identifier

* Note that if you are used to a global variable starting with a capital,
  that is not allowed in Rune.  There are numerous reasons for this but
  mainly the problem, other than distinguishing types vs variables, is
  that the global might be referenced by a class path and in that context
  the capitalization can create a lot of confusion.
60 files changed:
classes/gfx/draw.d
classes/gfx/event.d
classes/gfx/fill.d
classes/gfx/frame.d
classes/gfx/main.d
classes/gfx/pen.d
classes/gfx/window.d
classes/stdio/fgets.d
classes/stdio/file.d
classes/stdio/fputs.d
classes/stdio/fread.d
classes/stdio/fwrite.d
classes/stdio/misc.d
classes/stdio/show.d
classes/sys/class.d
classes/sys/str.d
dllx11/main.c
docs/insn.txt
librune/defs.h
librune/lex.c
librune/lex.h
librune/parse1.c
librune/parse2.c
librune/parse3.c
librune/resolve.c
librune/sym.c
tests/align.d
tests/bounds.d
tests/cast.d
tests/cat.d
tests/const.d
tests/defaults.d
tests/defaults2.d
tests/float.d
tests/gfx1.d
tests/gfx2.d
tests/gfxbutton1.d
tests/gfxbutton2.d
tests/gfxinput.d
tests/gfxslider.d
tests/global.d
tests/heap.d
tests/heap2.d
tests/interface.d
tests/loop.d
tests/lvalue.d
tests/method.d
tests/nested.d
tests/nested2.d
tests/operator.d
tests/refine.d
tests/reftype.d
tests/scope.d
tests/shift.d
tests/threads.d
tests/typedef.d
tests/typeof.d
tests/unix.d
tests/unix_tod.d
tests/varargs.d