func (this *URLParser) Global_phone_number() (tn *address.TelephoneNumber, ParseException error) { tn = address.NewTelephoneNumber() tn.SetGlobal(true) this.GetLexer().Match(core.CORELEXER_PLUS) b, _ := this.Base_phone_number() tn.SetPhoneNumber(b) if this.GetLexer().HasMoreChars() { tok, _ := this.GetLexer().LookAheadK(0) if tok == ';' { this.GetLexer().ConsumeK(1) nv, _ := this.Tel_parameters() tn.SetParameters(nv) } } return tn, nil }
func (this *URLParser) Local_phone_number() (tn *address.TelephoneNumber, ParseException error) { tn = address.NewTelephoneNumber() tn.SetGlobal(false) b, _ := this.Local_number() tn.SetPhoneNumber(b) if this.GetLexer().HasMoreChars() { tok, _ := this.GetLexer().PeekNextToken() switch tok.GetTokenType() { case TokenTypes_SEMICOLON: this.GetLexer().ConsumeK(1) nv, _ := this.Tel_parameters() tn.SetParameters(nv) default: } } return tn, nil }
/** SIPParser for telephone subscriber. * *@return the parsed telephone number. */ func (this *URLParser) ParseTelephoneNumber() (tn *address.TelephoneNumber, ParseException error) { tn = address.NewTelephoneNumber() this.GetLexer().SelectLexer("charLexer") c, _ := this.GetLexer().LookAheadK(0) if c == '+' { tn, _ = this.Global_phone_number() } else if this.GetLexer().IsAlpha(c) || this.GetLexer().IsDigit(c) || c == '-' || c == '*' || c == '.' || c == '(' || c == ')' || c == '#' { tn, _ = this.Local_phone_number() } else { return nil, this.CreateParseException("unexpected char " + string(c)) } return tn, nil }