// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:43:10
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/app/CommandProperties

package com.macromedia.generator.app;

import java.io.*;
import java.util.Hashtable;
import java.util.Properties;

// Referenced classes of package com.macromedia.generator.app:
//            InvalidCommandException

public class CommandProperties extends Properties
{

    public CommandProperties()
    {
    }

    public CommandProperties(Properties properties)
    {
        super(properties);
    }

    public String parseCommand(String s)
        throws InvalidCommandException
    {
        String s1 = null;
        if(s == null)
            throw new InvalidCommandException("empty command string");
        try
        {
            StreamTokenizer streamtokenizer = new StreamTokenizer(new StringReader(s));
            streamtokenizer.resetSyntax();
            streamtokenizer.whitespaceChars(0, 32);
            streamtokenizer.wordChars(33, 255);
            streamtokenizer.ordinaryChar(61);
            streamtokenizer.quoteChar(34);
            int i = streamtokenizer.nextToken();
            if(i != -3 && i != 34)
                throw new InvalidCommandException("invalid command name");
            s1 = streamtokenizer.sval;
            put("command", s1);
            for(int j = streamtokenizer.nextToken(); j != -1; j = streamtokenizer.nextToken())
            {
                String s2 = null;
                String s3 = null;
                if(j != -3 && j != 34)
                    throw new InvalidCommandException("expected name of parameter");
                s2 = new String(streamtokenizer.sval);
                j = streamtokenizer.nextToken();
                if(j != 61)
                    throw new InvalidCommandException("expected =");
                j = streamtokenizer.nextToken();
                if(j != -3 && j != 34)
                    throw new InvalidCommandException("expected value of parameter");
                s3 = new String(streamtokenizer.sval);
                put(s2, s3);
            }

        }
        catch(IOException _ex)
        {
            throw new InvalidCommandException("command format error");
        }
        return s1;
    }
}