Home | History | Annotate | Download | only in parser
      1 /*
      2 * Conditions Of Use
      3 *
      4 * This software was developed by employees of the National Institute of
      5 * Standards and Technology (NIST), an agency of the Federal Government.
      6 * Pursuant to title 15 Untied States Code Section 105, works of NIST
      7 * employees are not subject to copyright protection in the United States
      8 * and are considered to be in the public domain.  As a result, a formal
      9 * license is not needed to use the software.
     10 *
     11 * This software is provided by NIST as a service and is expressly
     12 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
     13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
     14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
     15 * AND DATA ACCURACY.  NIST does not warrant or make any representations
     16 * regarding the use of the software or the results thereof, including but
     17 * not limited to the correctness, accuracy, reliability or usefulness of
     18 * the software.
     19 *
     20 * Permission to use this software is contingent upon your acceptance
     21 * of the terms of this agreement
     22 *
     23 * .
     24 *
     25 */
     26 package gov.nist.javax.sip.parser;
     27 import gov.nist.javax.sip.header.From;
     28 import gov.nist.javax.sip.header.SIPHeader;
     29 
     30 import java.text.ParseException;
     31 
     32 /** From header parser.
     33  *
     34  * @version 1.2 $Revision: 1.12 $ $Date: 2009/10/22 10:27:37 $
     35  *
     36  * @author M. Ranganathan   <br/>
     37  *
     38  *
     39  *
     40  */
     41 public class FromParser extends AddressParametersParser {
     42 
     43     public FromParser(String from) {
     44         super(from);
     45     }
     46 
     47     protected FromParser(Lexer lexer) {
     48         super(lexer);
     49     }
     50 
     51     public SIPHeader parse() throws ParseException {
     52 
     53         From from = new From();
     54 
     55         this.lexer.match(TokenTypes.FROM);
     56         this.lexer.SPorHT();
     57         this.lexer.match(':');
     58         this.lexer.SPorHT();
     59         super.parse(from);
     60         this.lexer.match('\n');
     61         return from;
     62     }
     63 
     64 
     65 }
     66 /*
     67  * $Log: FromParser.java,v $
     68  * Revision 1.12  2009/10/22 10:27:37  jbemmel
     69  * Fix for issue #230, restructured the code such that parsing for any address appearing without '<' '>'
     70  * stops at ';', then parameters are assigned to the header as expected
     71  *
     72  * Revision 1.11  2009/07/17 18:58:00  emcho
     73  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
     74  *
     75  * Revision 1.10  2007/10/23 17:34:55  mranga
     76  * Issue number:
     77  * Obtained from:
     78  * Submitted by:  mranga
     79  * Reviewed by:   mranga
     80  *
     81  * Refactored header collections.
     82  *
     83  * Revision 1.9  2006/07/13 09:02:16  mranga
     84  * Issue number:
     85  * Obtained from:
     86  * Submitted by:  jeroen van bemmel
     87  * Reviewed by:   mranga
     88  * Moved some changes from jain-sip-1.2 to java.net
     89  *
     90  * CVS: ----------------------------------------------------------------------
     91  * CVS: Issue number:
     92  * CVS:   If this change addresses one or more issues,
     93  * CVS:   then enter the issue number(s) here.
     94  * CVS: Obtained from:
     95  * CVS:   If this change has been taken from another system,
     96  * CVS:   then name the system in this line, otherwise delete it.
     97  * CVS: Submitted by:
     98  * CVS:   If this code has been contributed to the project by someone else; i.e.,
     99  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    100  * CVS:   address here. If this is your work then delete this line.
    101  * CVS: Reviewed by:
    102  * CVS:   If we are doing pre-commit code reviews and someone else has
    103  * CVS:   reviewed your changes, include their name(s) here.
    104  * CVS:   If you have not had it reviewed then delete this line.
    105  *
    106  * Revision 1.3  2006/06/19 06:47:27  mranga
    107  * javadoc fixups
    108  *
    109  * Revision 1.2  2006/06/16 15:26:28  mranga
    110  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
    111  *
    112  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
    113  *
    114  * Import
    115  *
    116  *
    117  * Revision 1.7  2004/08/10 21:35:44  mranga
    118  * Reviewed by:   mranga
    119  * move test cases out to another package
    120  *
    121  * Revision 1.6  2004/04/22 22:51:17  mranga
    122  * Submitted by:  Thomas Froment
    123  * Reviewed by:   mranga
    124  *
    125  * Fixed corner cases.
    126  *
    127  * Revision 1.5  2004/01/22 13:26:31  sverker
    128  * Issue number:
    129  * Obtained from:
    130  * Submitted by:  sverker
    131  * Reviewed by:   mranga
    132  *
    133  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
    134  *
    135  * CVS: ----------------------------------------------------------------------
    136  * CVS: Issue number:
    137  * CVS:   If this change addresses one or more issues,
    138  * CVS:   then enter the issue number(s) here.
    139  * CVS: Obtained from:
    140  * CVS:   If this change has been taken from another system,
    141  * CVS:   then name the system in this line, otherwise delete it.
    142  * CVS: Submitted by:
    143  * CVS:   If this code has been contributed to the project by someone else; i.e.,
    144  * CVS:   they sent us a patch or a set of diffs, then include their name/email
    145  * CVS:   address here. If this is your work then delete this line.
    146  * CVS: Reviewed by:
    147  * CVS:   If we are doing pre-commit code reviews and someone else has
    148  * CVS:   reviewed your changes, include their name(s) here.
    149  * CVS:   If you have not had it reviewed then delete this line.
    150  *
    151  */
    152