[dylan-lang/melange] b954cf: Support #pragma once.

GitHub <[email protected]> Mon, 19 Oct 2015 08:16:09 -0700
Newsgroups gmane.comp.lang.dylan.gwydion.cvs
Message-ID <562509392d049_420b3fde1c19929c7647d@hookshot-fe6-cp1-prd.iad.github.net.mail>
  Branch: refs/heads/master
  Home:   https://github.com/dylan-lang/melange
  Commit: b954cf2c282d6a12b3e732978c271b29fd441bef
      https://github.com/dylan-lang/melange/commit/b954cf2c282d6a12b3e732978c271b29fd441bef
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-10-19 (Mon, 19 Oct 2015)

  Changed paths:
    M melange-core/c-lexer-cpp.dylan
    M melange-core/c-lexer.dylan
    A tests/test.pragma.once/another.h
    A tests/test.pragma.once/comments.h
    A tests/test.pragma.once/expected-c-ffi.dylan
    A tests/test.pragma.once/pragma.once.h
    A tests/test.pragma.once/repeated.h
    A tests/test.pragma.once/test.intr

  Log Message:
  -----------
  Support #pragma once.

Fixes #11.

* melange-core/c-lexer.dylan
  (<tokenizer>): Track included files.
  (initialize on <tokenizer>): Share included files with the parent
   tokenizer.
  (get-token): When a file has been included and we're done processing it,
   then it should be added to included-files. If we do it earlier, then a
   #pragma once would trigger on the first inclusion.

* melange-core/c-lexer-cpp.dylan
  (try-cpp): Look for #pragma and check to see if it is "#pragma once". If
   it is, and the file has already been included, then stop parsing this
   file by jumping all the way to the end. That way, the caller will end
   up hitting <eof-token> and all will be well.

* tests/test.pragma.once: Test #pragma once support.

_______________________________________________
chatter mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/chatter