Commit Graph

3863 Commits

Author SHA1 Message Date
Tim Chevalier 5131216fa6 Restore a comment that got lost (comments only) 2012-02-07 17:08:03 -08:00
Kevin Cantu 2b0396c34a core: make str::substr use char positions (and replace other uses) 2012-02-07 16:25:35 -08:00
Kevin Cantu a3f5626ad1 String split renaming:
* Renamed str::split -> str::split_byte
* Renamed str::splitn -> str::splitn_byte
* Renamed str::split_func -> str::split
* Renamed str::split_char -> str::split_char
* Renamed str::split_chars_iter -> str::split_char_iter
* Added u8::is_ascii
* Fixed the behavior of str::split_str, so that it matches split_chars
  and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", "."))
* Fixed str::split_byte and str::splitn_byte so that they handle
  splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle ""
  as the others do
2012-02-07 16:25:35 -08:00
Tim Chevalier a63780afce Minor class-related tweaks to the AST 2012-02-07 12:15:59 -08:00
Marijn Haverbeke 47143ee24a Stop storing cmp glue in tydescs
There's no such thing anymore, we can simply call upcalls.cmp_type.
2012-02-07 14:37:10 +01:00
Marijn Haverbeke b28a5552e3 Reuse monomorphized functions for different box types
The free glue for opaque boxes will pick the actual tydesc out of the
box, and call its glue.

Issue #1736
2012-02-07 14:36:02 +01:00
Brian Anderson 3bd0338c19 Revert "log to stderr instead of stdout"
This is causing mysterious hangs on windows. Issue #1769.

This reverts commit d65eabd5de.
2012-02-06 18:29:58 -08:00
Jyun-Yan You 5563eab227 change gcc_args to cc_args and make win32 use gcc 2012-02-06 17:57:22 -08:00
Jyun-Yan You 98bb5b73a5 use cc instead of gcc 2012-02-06 17:56:41 -08:00
Marijn Haverbeke 87a488048d Make keyword table in reference reflect reality more closely
And remove the part about reserved words.
2012-02-06 22:03:17 +01:00
Marijn Haverbeke a08e589390 Handle built-in typenames in the resolve pass, rather than in parser
Closes #1728

Comments out a section of debuginfo.rs. This code was already broken
(only being called when --xg was passed, and only working on trivial
programs).
2012-02-06 17:06:19 +01:00
Marijn Haverbeke 8673c4f195 Make ty::t type self-sufficient
It is now no longer needed to have a ty::ctxt to get at the contents
of a ty::t. The straight-forward approach of doing this, simply making
ty::t a box type, unfortunately killed our compiler performance (~15%
slower) through refcounting cost. Thus, this patch now represents
ty::t as an unsafe pointer, assuming that the ty::ctxt, which holds
these boxes alive, outlives any uses of the ty::t values. In the
current compiler this trivially holds, but it is does of course add a
new potential pitfall.

ty::get takes a ty::t and returns a boxed representation of the type.
I've changed calls to ty::struct(X) to do ty::get(X).struct. Type
structs are full of vectors, and copying them every time we wanted to
access them was a bit of a cost.
2012-02-06 16:53:25 +01:00
Marijn Haverbeke 6ed8d03784 Make sure iface_methods are set before they are accessed
Closes #1761
2012-02-06 09:56:42 +01:00
Ian D. Bollinger d1158ca333 Removed sendfn from badwords and made the precedence of XOR between that of OR and AND. 2012-02-06 09:56:41 +01:00
Marijn Haverbeke e0fa5cd2ed Self types for ifaces
This allows a 'Name:' to appear in front of an iface declaration's
name, which will cause 'Name' to refer to the self type (with the same
number of type parameters as the iface has) in the method signatures
of the iface. For example:

    iface F: functor<A> {
        fn fmap<B>(f: fn(A) -> B) -> F<B>;
    }

Issue #1718
2012-02-06 09:56:41 +01:00
Marijn Haverbeke 5c42e3df9c Allow non-semicolon-requiring expressions to be followed by .field
There is no valid expression that starts with a dot token (.5 is a number token),
so this introduces no ambiguities.

Issue #1716
2012-02-06 09:13:32 +01:00
Kevin Atkinson b7ec2488ff Fix macro backtraces.
In addition add information about the macro doing the expansion, and
move the printing of the expansion backtrace from codemap::span_to_str
to the diagnostic code.  The backtrace is now more verbose and
includes information on the macro doing the expansion, in addition to
the expansion site.
2012-02-05 15:38:27 -08:00
Kevin Atkinson 1d855ebc51 Remove support for $(...) form of quasi-quotes, use #ast{...} instead. 2012-02-05 15:38:27 -08:00
Brian Anderson 91b6dc5c8e Merge remote-tracking branch 'erickt/master'
Conflicts:
	src/libcore/vec.rs
	src/libstd/getopts.rs
2012-02-05 15:15:21 -08:00
Niko Matsakis 966504c828 don't fail if inference is not complete 2012-02-05 10:06:27 -08:00
Niko Matsakis 7f12358656 resolve some merge failures 2012-02-05 09:56:10 -08:00
Niko Matsakis 77b06d24cd infer modes rather than overwriting with expected ty 2012-02-05 09:12:44 -08:00
Tim Chevalier f3343b3571 Beginnings of front-end support for classes
Added class support to the parser, prettyprinter, fold, and visit.
(See Issue 1726.)

This is WIP -- the test case is xfailed, and attempting to compile
it will error out in resolve.
2012-02-03 22:47:35 -08:00
Ted Horst d65eabd5de log to stderr instead of stdout
includes rustc diagnostics
runtest updated to check stderr for errors
2012-02-03 20:55:53 -08:00
Graydon Hoare 8fc624bc08 Fix various drift issues in the qq branch. 2012-02-03 20:54:18 -07:00
Kevin Atkinson 3604f36938 Implement folding of ast::ty. 2012-02-03 20:54:17 -07:00
Kevin Atkinson 5f6a1159bb Fix q-q so that non-expression q-q actually work when there is embed anti-q. 2012-02-03 20:54:00 -07:00
Kevin Atkinson a2dde9a692 Allow anti-quotes to also be ast::ty rather than just ast::expr. 2012-02-03 20:41:49 -07:00
Kevin Atkinson 6dcd12dc22 Implement quasi-quoting of multiple syntatic categories. 2012-02-03 20:41:49 -07:00
Kevin Atkinson 35a199c036 Formatting cleanups. 2012-02-03 20:41:49 -07:00
Kevin Atkinson 9090a5c03b Store info about file "substr".
That is when a string that is part of a file needs to be parsed for a
reason, record that the string is a substr of the file rather than
using "<anon>" or "-" as the file name.  This will eventually allow
pointing to the right location, for now it just uses a more
meaningful string for the filename.
2012-02-03 20:41:49 -07:00
Kevin Atkinson 4d71285c93 Implement quasi-quotes in more macro form: #ast{...}.
The #(...) form is still supported for now.
2012-02-03 20:41:49 -07:00
Kevin Atkinson 1c91fb4d91 Don't rely on filename to get a file from the filemap
as there may be more than one filemap with the same filename (in the
case of stdin for instance).  This involved storing a pointer to the
filemap rather than the filename in location info such as
codemap::pos.
2012-02-03 20:41:49 -07:00
Kevin Atkinson 4616117f17 Bug fix in lookup_byte_offset. 2012-02-03 20:41:49 -07:00
Kevin Atkinson da74a7f9ca Make macro arg optional in syntax, again untested. 2012-02-03 20:41:48 -07:00
Kevin Atkinson 5ea04c65c1 Add support for recognizing macro body, completely untested. 2012-02-03 20:41:48 -07:00
Kevin Atkinson e76fdeb3a6 Change the type for the macro body to also store the span.
Note: the body is the part of the macro syntax between the {}.
2012-02-03 20:41:48 -07:00
Kevin Atkinson 099290bc73 When replacing $(...) with $0 preserve spacing for better error messages.
That is:
  x + $(foo) + y
becomes:
  x + $0     + y
not:
  x + $0 + y
2012-02-03 20:41:37 -07:00
Kevin Atkinson c0f9073557 Expand result of quasi-quote. 2012-02-03 20:39:00 -07:00
Kevin Atkinson 67e961c17f Implement anti-quotes. 2012-02-03 20:38:44 -07:00
Kevin Atkinson 477714f08e Implement "replace" function. 2012-02-03 20:28:12 -07:00
Kevin Atkinson 485e489ba2 Implement basic quasi-quoter. No anti-quotes yet. 2012-02-03 20:28:11 -07:00
Kevin Atkinson 98450d0dad Rename AST builders to use uniform naming scheme. Also add a few more. 2012-02-03 20:28:11 -07:00
Kevin Atkinson 5ef53382ae Add support for parsing quasi-quotes, doesn't do anything useful yet. 2012-02-03 20:23:49 -07:00
Kevin Atkinson 75edd9ff69 Move useful ast building functions into their own module. 2012-02-03 17:48:17 -08:00
Kevin Atkinson 9dcb674525 Add function to get a code snippet from a span,
and also to get the byte offset within a string from a span chpos.
2012-02-03 17:48:17 -08:00
Marijn Haverbeke 61367e3c27 Fix prefixing of logging paths with crate name 2012-02-03 22:12:09 +01:00
Tom Lee 31b0d1b4bd core: rename str::lteq to str::le 2012-02-03 14:09:44 +01:00
Marijn Haverbeke 633e4502e7 Clean up and update trans::ty_ctxt type definition
It had been messed up by the pretty-printer at some point, and was
partially out of date.
2012-02-03 14:09:16 +01:00
Marijn Haverbeke 3bcd4fe6fa Start on in-crate monomorphizing
Adds a --monomorpize flag to rustc to turn it on. You probably don't
want to use it yet, since it's broken in a whole bunch of ways, but it
successfully monomorphizes simple generic functions called from within
the crate.

Issue #1736
2012-02-03 14:07:35 +01:00