@@ -54,7 +54,7 @@ pub struct Error {
54
54
/// The column number at which the error occurred
55
55
priv col: uint ,
56
56
/// A message describing the type of the error
57
- priv msg: @ ~str ,
57
+ priv msg: ~str ,
58
58
}
59
59
60
60
fn escape_str ( s : & str ) -> ~str {
@@ -525,7 +525,7 @@ impl<T : Iterator<char>> Parser<T> {
525
525
}
526
526
527
527
fn error < T > ( & self , msg : ~str ) -> Result < T , Error > {
528
- Err ( Error { line : self . line , col : self . col , msg : @ msg } )
528
+ Err ( Error { line : self . line , col : self . col , msg : msg } )
529
529
}
530
530
531
531
fn parse_value( & mut self ) -> Result < Json , Error > {
@@ -1327,7 +1327,7 @@ impl to_str::ToStr for Json {
1327
1327
1328
1328
impl to_str:: ToStr for Error {
1329
1329
fn to_str ( & self ) -> ~str {
1330
- format ! ( "{}:{}: {}" , self . line, self . col, * self . msg)
1330
+ format ! ( "{}:{}: {}" , self . line, self . col, self . msg)
1331
1331
}
1332
1332
}
1333
1333
@@ -1593,35 +1593,35 @@ mod tests {
1593
1593
#[test]
1594
1594
fn test_trailing_characters() {
1595
1595
assert_eq!(from_str(" nulla"),
1596
- Err(Error {line: 1u, col: 5u, msg: @ ~" trailing characters"}));
1596
+ Err(Error {line: 1u, col: 5u, msg: ~" trailing characters"}));
1597
1597
assert_eq!(from_str(" truea"),
1598
- Err(Error {line: 1u, col: 5u, msg: @ ~" trailing characters"}));
1598
+ Err(Error {line: 1u, col: 5u, msg: ~" trailing characters"}));
1599
1599
assert_eq!(from_str(" falsea"),
1600
- Err(Error {line: 1u, col: 6u, msg: @ ~" trailing characters"}));
1600
+ Err(Error {line: 1u, col: 6u, msg: ~" trailing characters"}));
1601
1601
assert_eq!(from_str(" 1 a"),
1602
- Err(Error {line: 1u, col: 2u, msg: @ ~" trailing characters"}));
1602
+ Err(Error {line: 1u, col: 2u, msg: ~" trailing characters"}));
1603
1603
assert_eq!(from_str(" [ ] a"),
1604
- Err(Error {line: 1u, col: 3u, msg: @ ~" trailing characters"}));
1604
+ Err(Error {line: 1u, col: 3u, msg: ~" trailing characters"}));
1605
1605
assert_eq!(from_str(" { } a"),
1606
- Err(Error {line: 1u, col: 3u, msg: @ ~" trailing characters"}));
1606
+ Err(Error {line: 1u, col: 3u, msg: ~" trailing characters"}));
1607
1607
}
1608
1608
1609
1609
#[test]
1610
1610
fn test_read_identifiers() {
1611
1611
assert_eq!(from_str(" n"),
1612
- Err(Error {line: 1u, col: 2u, msg: @ ~" invalid syntax"}));
1612
+ Err(Error {line: 1u, col: 2u, msg: ~" invalid syntax"}));
1613
1613
assert_eq!(from_str(" nul"),
1614
- Err(Error {line: 1u, col: 4u, msg: @ ~" invalid syntax"}));
1614
+ Err(Error {line: 1u, col: 4u, msg: ~" invalid syntax"}));
1615
1615
1616
1616
assert_eq!(from_str(" t"),
1617
- Err(Error {line: 1u, col: 2u, msg: @ ~" invalid syntax"}));
1617
+ Err(Error {line: 1u, col: 2u, msg: ~" invalid syntax"}));
1618
1618
assert_eq!(from_str(" truz"),
1619
- Err(Error {line: 1u, col: 4u, msg: @ ~" invalid syntax"}));
1619
+ Err(Error {line: 1u, col: 4u, msg: ~" invalid syntax"}));
1620
1620
1621
1621
assert_eq!(from_str(" f"),
1622
- Err(Error {line: 1u, col: 2u, msg: @ ~" invalid syntax"}));
1622
+ Err(Error {line: 1u, col: 2u, msg: ~" invalid syntax"}));
1623
1623
assert_eq!(from_str(" faz"),
1624
- Err(Error {line: 1u, col: 3u, msg: @ ~" invalid syntax"}));
1624
+ Err(Error {line: 1u, col: 3u, msg: ~" invalid syntax"}));
1625
1625
1626
1626
assert_eq!(from_str(" null"), Ok(Null));
1627
1627
assert_eq!(from_str(" true "), Ok(Boolean(true)));
@@ -1649,20 +1649,20 @@ mod tests {
1649
1649
#[test]
1650
1650
fn test_read_number() {
1651
1651
assert_eq!(from_str(" +"),
1652
- Err(Error {line: 1u, col: 1u, msg: @ ~" invalid syntax"}));
1652
+ Err(Error {line: 1u, col: 1u, msg: ~" invalid syntax"}));
1653
1653
assert_eq!(from_str(" . "),
1654
- Err(Error {line: 1u, col: 1u, msg: @ ~" invalid syntax"}));
1654
+ Err(Error {line: 1u, col: 1u, msg: ~" invalid syntax"}));
1655
1655
1656
1656
assert_eq!(from_str(" -"),
1657
- Err(Error {line: 1u, col: 2u, msg: @ ~" invalid number"}));
1657
+ Err(Error {line: 1u, col: 2u, msg: ~" invalid number"}));
1658
1658
assert_eq!(from_str(" 00 "),
1659
- Err(Error {line: 1u, col: 2u, msg: @ ~" invalid number"}));
1659
+ Err(Error {line: 1u, col: 2u, msg: ~" invalid number"}));
1660
1660
assert_eq!(from_str(" 1. "),
1661
- Err(Error {line: 1u, col: 3u, msg: @ ~" invalid number"}));
1661
+ Err(Error {line: 1u, col: 3u, msg: ~" invalid number"}));
1662
1662
assert_eq!(from_str(" 1 e"),
1663
- Err(Error {line: 1u, col: 3u, msg: @ ~" invalid number"}));
1663
+ Err(Error {line: 1u, col: 3u, msg: ~" invalid number"}));
1664
1664
assert_eq!(from_str(" 1 e+"),
1665
- Err(Error {line: 1u, col: 4u, msg: @ ~" invalid number"}));
1665
+ Err(Error {line: 1u, col: 4u, msg: ~" invalid number"}));
1666
1666
1667
1667
assert_eq!(from_str(" 3 "), Ok(Number(3.0)));
1668
1668
assert_eq!(from_str(" 3.1 "), Ok(Number(3.1)));
@@ -1708,10 +1708,10 @@ mod tests {
1708
1708
#[test]
1709
1709
fn test_read_str() {
1710
1710
assert_eq!(from_str("\" " ) ,
1711
- Err ( Error { line: 1 u, col: 2 u, msg: @ ~"EOF while parsing string"
1711
+ Err ( Error { line: 1 u, col: 2 u, msg: ~"EOF while parsing string"
1712
1712
}));
1713
1713
assert_eq!(from_str(" \" lol"),
1714
- Err(Error {line: 1u, col: 5u, msg: @ ~" EOF while parsing string"
1714
+ Err(Error {line: 1u, col: 5u, msg: ~" EOF while parsing string"
1715
1715
}));
1716
1716
1717
1717
assert_eq!(from_str("\" \" " ) , Ok ( String ( ~"") ) ) ;
@@ -1768,15 +1768,15 @@ mod tests {
1768
1768
#[ test]
1769
1769
fn test_read_list( ) {
1770
1770
assert_eq!( from_str( "[" ) ,
1771
- Err ( Error { line: 1 u, col: 2 u, msg: @ ~"EOF while parsing value"}));
1771
+ Err ( Error { line: 1 u, col: 2 u, msg: ~"EOF while parsing value"}));
1772
1772
assert_eq!(from_str(" [ 1 "),
1773
- Err(Error {line: 1u, col: 3u, msg: @ ~" EOF while parsing list"}));
1773
+ Err(Error {line: 1u, col: 3u, msg: ~" EOF while parsing list"}));
1774
1774
assert_eq!(from_str(" [ 1 , "),
1775
- Err(Error {line: 1u, col: 4u, msg: @ ~" EOF while parsing value"}));
1775
+ Err(Error {line: 1u, col: 4u, msg: ~" EOF while parsing value"}));
1776
1776
assert_eq!(from_str(" [ 1 , ] "),
1777
- Err(Error {line: 1u, col: 4u, msg: @ ~" invalid syntax"}));
1777
+ Err(Error {line: 1u, col: 4u, msg: ~" invalid syntax"}));
1778
1778
assert_eq!(from_str(" [ 6 7 ] "),
1779
- Err(Error {line: 1u, col: 4u, msg: @ ~" expected `, ` or `] `"} ) ) ;
1779
+ Err(Error {line: 1u, col: 4u, msg: ~" expected `, ` or `] `"} ) ) ;
1780
1780
1781
1781
assert_eq!( from_str( "[]" ) , Ok ( List ( ~[ ] ) ) ) ;
1782
1782
assert_eq!( from_str( "[ ]" ) , Ok ( List ( ~[ ] ) ) ) ;
@@ -1824,49 +1824,49 @@ mod tests {
1824
1824
Err ( Error {
1825
1825
line: 1 u,
1826
1826
col: 2 u,
1827
- msg: @ ~"EOF while parsing object"}));
1827
+ msg: ~"EOF while parsing object"}));
1828
1828
assert_eq!(from_str(" { "),
1829
1829
Err(Error {
1830
1830
line: 1u,
1831
1831
col: 3u,
1832
- msg: @ ~" EOF while parsing object"}));
1832
+ msg: ~" EOF while parsing object"}));
1833
1833
assert_eq!(from_str(" { 1 "),
1834
1834
Err(Error {
1835
1835
line: 1u,
1836
1836
col: 2u,
1837
- msg: @ ~" key must be a string"}));
1837
+ msg: ~" key must be a string"}));
1838
1838
assert_eq!(from_str(" { \"a\" ") ,
1839
1839
Err ( Error {
1840
1840
line: 1 u,
1841
1841
col: 6 u,
1842
- msg: @ ~"EOF while parsing object"}));
1842
+ msg: ~"EOF while parsing object"}));
1843
1843
assert_eq!(from_str(" { \" a\" ") ,
1844
1844
Err ( Error {
1845
1845
line: 1 u,
1846
1846
col: 5 u,
1847
- msg: @ ~"EOF while parsing object"}));
1847
+ msg: ~"EOF while parsing object"}));
1848
1848
assert_eq!(from_str(" { \" a\" "),
1849
1849
Err(Error {
1850
1850
line: 1u,
1851
1851
col: 6u,
1852
- msg: @ ~" EOF while parsing object"}));
1852
+ msg: ~" EOF while parsing object"}));
1853
1853
1854
1854
assert_eq!(from_str(" { \" a\" 1 "),
1855
- Err(Error {line: 1u, col: 6u, msg: @ ~" expected `: `"} ) ) ;
1855
+ Err(Error {line: 1u, col: 6u, msg: ~" expected `: `"} ) ) ;
1856
1856
assert_eq!( from_str( "{\" a\" :" ) ,
1857
- Err ( Error { line: 1 u, col: 6 u, msg: @ ~"EOF while parsing value"}));
1857
+ Err ( Error { line: 1 u, col: 6 u, msg: ~"EOF while parsing value"}));
1858
1858
assert_eq!(from_str(" { \" a\" : 1 "),
1859
1859
Err(Error {
1860
1860
line: 1u,
1861
1861
col: 7u,
1862
- msg: @ ~" EOF while parsing object"}));
1862
+ msg: ~" EOF while parsing object"}));
1863
1863
assert_eq!(from_str(" { \" a\" : 1 1 "),
1864
- Err(Error {line: 1u, col: 8u, msg: @ ~" expected `, ` or `} `"} ) ) ;
1864
+ Err(Error {line: 1u, col: 8u, msg: ~" expected `, ` or `} `"} ) ) ;
1865
1865
assert_eq!( from_str( "{\" a\" :1," ) ,
1866
1866
Err ( Error {
1867
1867
line: 1 u,
1868
1868
col: 8 u,
1869
- msg: @ ~"EOF while parsing object"}));
1869
+ msg: ~"EOF while parsing object"}));
1870
1870
1871
1871
assert_eq!(from_str(" { } ").unwrap(), mk_object([]));
1872
1872
assert_eq!(from_str(" { \" a\" : 3 } ").unwrap(),
@@ -1966,7 +1966,7 @@ mod tests {
1966
1966
Err ( Error {
1967
1967
line: 3 u,
1968
1968
col: 8 u,
1969
- msg: @ ~"EOF while parsing object"}));
1969
+ msg: ~"EOF while parsing object"}));
1970
1970
}
1971
1971
1972
1972
#[deriving(Decodable)]
0 commit comments