001    // Copyright 2008 Waterken Inc. under the terms of the MIT X license
002    // found at http://www.opensource.org/licenses/mit-license.html
003    package org.waterken.syntax;
004    
005    import org.joe_e.Powerless;
006    import org.joe_e.array.IntArray;
007    import org.joe_e.array.PowerlessArray;
008    import org.ref_send.deserializer;
009    import org.ref_send.name;
010    
011    /**
012     * Signals invalid syntax.
013     */
014    public class
015    BadSyntax extends Exception implements Powerless {
016        static private final long serialVersionUID = 1L;
017    
018        /**
019         * path to the source code
020         */
021        public final String source;
022    
023        /**
024         * location within {@link #source}
025         */
026        public final PowerlessArray<IntArray> span;
027        
028        /**
029         * Constructs an instance.
030         * @param source    {@link #source}
031         * @param span      {@link #span}
032         * @param cause     {@link #getCause}
033         */
034        public @deserializer
035        BadSyntax(@name("source") final String source,
036                  @name("span") final PowerlessArray<IntArray> span,
037                  @name("cause") final Exception cause) {
038            super("<" + source + "> " + span + " : ", cause);
039            this.source = source;
040            this.span = span;
041        }
042    }